[antlr-interest] Parser question
Dima Suliman
suliman at zib.de
Thu May 27 08:34:37 PDT 2004
Hello Terence,
I've tried:
statement: (equation)+;
equation: EQ^ expr expr;
(the mathematical expression are in prefix form: e.g., + a b)
It didn't work. Printing the AST you see only the first equation....
Regards
Dima
>
>
>On May 27, 2004, at 4:28 AM, Dima Suliman wrote:
>
>> Hello,
>>
>> I have the parser start rule:
>>
>> statement: (expr EQ^ expr)+;
>>
>> expr is a mathematical expr. It works but when I have more than one
>> expr,
>> and I print the ast, the ast shows only the first one!
>>
>> any suggestions?
>
>The ^ works on the tree created for the current rule not the subrule.
>Move the stuff in the (...)+ to another rule and then reference it. :)
>You will find the sequence of EQ trees you want :)
>
>Terence
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
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