January 16, 2006 Re: Lexer related questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Casper Ellingsen | Casper Ellingsen wrote:
> There's two conflicting definitions of postfix expressions in http://www.digitalmars.com/d/expression.html. In the BNF at the top a postfix expression is defined as
>
> PostfixExpression:
> PrimaryExpression
> PostfixExpression . Identifier
> PostfixExpression ++
> PostfixExpression --
> PostfixExpression ( )
> PostfixExpression ( ArgumentList )
> IndexExpression
> SliceExpression
>
> IndexExpression:
> PostfixExpression [ ArgumentList ]
>
> SliceExpression:
> PostfixExpression [ ]
> PostfixExpression [ AssignExpression .. AssignExpression ]
>
> On the other hand, in the textual description further down, a postfix expression is defined as
>
> PostfixExpression:
> PostfixExpression . Identifier
> PostfixExpression -> Identifier
> PostfixExpression ++
> PostfixExpression --
> PostfixExpression ( ArgumentList )
> PostfixExpression [ ArgumentList ]
> PostfixExpression [ AssignExpression .. AssignExpression ]
>
> The first one has
>
> PostfixExpression ( )
> PostfixExpression [ ]
>
> which the second one doesn't have, whereas the second one has
>
> PostfixExpression -> Identifier
>
> which the first one doesn't have. What's the correct definition? Oh, if only the BNF grammar was correct. :/
Obviously the second one is obselete.
D doesn't have the -> operator, it seems like it had it in the past though.
Also, the [] on expressions is a ``slice`` operator, which goes (I think) like [0..$]
|
January 18, 2006 Re: Lexer related questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Don Clugston | Don Clugston wrote: > Casper Ellingsen wrote: > >> On Fri, 13 Jan 2006 22:38:18 +0100, Casper Ellingsen <no@reply.com> wrote: >> >> A version condition is defined in http://www.digitalmars.com/d/version.html as >> >> VersionCondition: >> version () Integer >> version () Identifier >> >> One valid version condition is >> >> version(X86) >> >> so why isn't the BNF rules defined as >> >> VersionCondition: >> version ( Integer ) >> version ( Identifier ) >> >> instead? It just seems odd to me, and really confused me for a while. > > > The parentheses are in the wrong place all through the docs. Indeed. I've wondered if that was wrong, or if it was just a different kind of notation for the grammar, that I was unfamiliar with, since I'm no expert in this subject. > I think it's a ddoc problem (the docs weren't updated properly when they were converted to Ddoc). Hum... What does the grammar doc have anything to do with ddoc ? -- Bruno Medeiros - CS/E student "Certain aspects of D are a pathway to many abilities some consider to be... unnatural." |
January 18, 2006 Re: Lexer related questions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bruno Medeiros | Bruno Medeiros wrote:
> Don Clugston wrote:
>
>> Casper Ellingsen wrote:
>>
>>> On Fri, 13 Jan 2006 22:38:18 +0100, Casper Ellingsen <no@reply.com> wrote:
>>>
>>> A version condition is defined in http://www.digitalmars.com/d/version.html as
>>>
>>> VersionCondition:
>>> version () Integer
>>> version () Identifier
>>>
>>> One valid version condition is
>>>
>>> version(X86)
>>>
>>> so why isn't the BNF rules defined as
>>>
>>> VersionCondition:
>>> version ( Integer )
>>> version ( Identifier )
>>>
>>> instead? It just seems odd to me, and really confused me for a while.
>>
>>
>>
>> The parentheses are in the wrong place all through the docs.
>
> Indeed. I've wondered if that was wrong, or if it was just a different kind of notation for the grammar, that I was unfamiliar with, since I'm no expert in this subject.
>
>> I think it's a ddoc problem (the docs weren't updated properly when they were converted to Ddoc).
>
>
> Hum...
> What does the grammar doc have anything to do with ddoc ?
Nothing, except that they are no longer written in HTML, they're .ddoc files which are converted into HTML (so that they get proper D code colouring, etc). Funny things happened to the ampersands (in ddoc you can write &, in HTML it must be &), and apparently the parentheses, too.
|
Copyright © 1999-2021 by the D Language Foundation