[antlr-interest] [Tree grammar] Mismatch tree node
Jakub Lambrych
lambrych at gmail.com
Sun Feb 10 13:11:02 PST 2008
Hello Everybody!
I would like to ask You whether exists in Tree Grammar a posibility of
not walking through the whole AST tree (in my pass I'm only interested
in data stored on the first level in the tree).
I'll give a working example:
I only want to read the "label" staff
<code>
operation
: ^(OPERATION ^(LABEL label?) IDENTIFIER ^(ARGUMENTS
arguments*))
;
label : a=ETIQUETA {System.out.println($a.text);}
;
</code>
but Anlr forces me to implement whole "walking" (implementing
"arguments" rule, tha depends on another rule etc. etc.)
My question is, whether exists a solution with what I could define the
tree grammar more or less like:
<code>
operation: ^(OPERATION ^(LABEL label?) IDENTIFIER ARGUMENTS;
label : a=ETIQUETA {System.out.println($a.text);}
;
</code>
Of course in the example above i get Mismathed tree node error : down
expected <UP>.
I would be very very grateful for the answer as I'm sitting few hours
already trying to fix it somehow.
Once again thanx,
Jakub Lambrych
--
OpenPGP Public Key: http://lambrych.info/Jakub_Lambrych.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080210/167490be/attachment.bin
More information about the antlr-interest
mailing list