[antlr-interest] Manual tree construction?
Sohail Somani
sohail at taggedtype.net
Sun Oct 23 18:32:30 PDT 2005
Hey guys,
Please bear with a tree parser newb.
I have a couple of grammar rules as follows:
fnDefn
: FUNCTION ID parameters;
codeBlock
END
;
parameters
: LPAREN (parameter (COMMA parameters)*)? RPAREN
;
I want to construct the tree:
(FUNCTION ID (parameter parameter) (codeBlock))
But how can I construct the tree in the parameters rule so that theres
no LPAREN or weird ugliness there?
I've done this which kinda does what I want:
parameters
: LPAREN^ (parameter (COMMA! parameter)*)? RPAREN!
;
But I can't think of how to manually or automatically construct the tree
above because of the (parameter (COMMA parameter)*)? business. Is there
an example?
Thanks in advance!
Sohail
More information about the antlr-interest
mailing list