Antlr v3 & Trees (was: [antlr-interest] if-then-else - Grammar generates faulty parser code)
Monty Zukowski
monty at codetransform.com
Thu Apr 22 21:41:45 PDT 2004
On Apr 22, 2004, at 9:26 PM, Terence Parr wrote:
> My typical example of where you want a "placeholder" is when you have
> multiple optional things in a row. For example, the expressions in a
> FOR statement. Do you want
>
> forRule : #(FOR (expr)? (expr)? (expr)?) ;
>
> ?? Probably not as the grammar is inherently ambiguous. Position has
> "meaning" in this case.
>
> Is that a good example?
Well, my select statement is multiple optional things in a row:
> selectStatement
> :
> queryExpression
> (computeClause)?
> (forClause)?
> (optionClause)?
> ;
And I'm arguing that it's ok in this case because the grammar is not
ambiguous. So is the rule "when you have multiple optional things in a
row and it is ambiguous?" Or are there other considerations too?
Monty
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list