[antlr-interest] Tree Grammar from parser grammar
G R
relationalalgebra at gmail.com
Tue Sep 25 06:25:48 PDT 2007
Hi all
I'm actually trying to move from my parser grammar to a tree grammar using
AST rewriting rules as much as I can.
The problem is that I've got 2 rule that I don't know how to deal with using
rewriting rules.
Here is a part of my grammar :
select : Select LeftBrack condition RightBrack (LeftParent raQuery
RightParent | Name)
-> ^(Select condition raQuery? Name?);
condition
: conditionTerm
->^(Condition conditionTerm);
conditionTerm
: logicalTerm (Or^ logicalTerm)*;
logicalTerm
: logicalFactor (And^ logicalFactor)*;
logicalFactor
: Not? o1=operand CompareOperator o2=operand
-> ^(CompareOperator Not? $o1 $o2)
|LeftParent conditionTerm RightParent
-> ^(conditionTerm);
operand : Name
|Numeric;
The rules for conditionTerm and logicalTerm are the ones that I've try to
change using rewriting rule, but i can't any solution...
Could anyone giving me a hand ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070925/2436f8da/attachment.html
More information about the antlr-interest
mailing list