Hi ,
I not sure whether I wrote the tree grammer are right , so please take look and
give some comments please, that will help a lot.
here is a grammer to parse the java source .
fileDeclaration
: ( (annotations)? packageDeclaration )? (importDeclaration)*
(typeDeclaration)*
;
so i defined an imaginary token named FILEDEC and rewrite the tree grammer as
->^( FILEDEC ( (annotations)? packageDeclaration )? (importDeclaration)*
(typeDeclaration)* )
because all in the grammer are rules too. so I used an imaginary token here.
but this one below, there is a ',' can be the root of the subtree
expressionList
: expression (',' expression)*
;
so I rewrote the tree as this ,EXP is an imaginary token also
->^(EXP expression (','^ expression)* )
right ? or any better way ? I am really need you help
Thanks a lot
waitting online :)
BILL YUAN
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address