[antlr-interest] AST with optional parameters

Bart Kiers bkiers at gmail.com
Tue Jun 7 05:26:15 PDT 2011


Hi John,


> Have you tried:
>
>    |   (ID GETS) => ID GETS e=expr (s=SEMI)? -> ^(GETS ID $e $s?)
>
> is the semicolon really necessary in the tree? (e.g. does the presence
> of the semicolon actually change the meaning of of the statement?)
>

Exactly my thought after I sent my previous e-mail!


> perhaps:
>
>    | (ID GETS) => ID GETS^ expr SEMI!?
>

Or the equivalent rewrite rule:

(ID GETS) => ID GETS expr SEMI? -> ^(GETS ID expr)


Regards,

Bart.



> Hope this helps...
>    -jbb
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list