[antlr-interest] working with AST

Adrian Sandor aditsu at yahoo.com
Sat Jul 19 06:36:25 PDT 2003


I have a parser which builds an AST, and uses some syntactic
predicates; currently it's basically a list, it doesn't have levels,
and when I parse the AST for translation, I need to use similar
predicates for correct recognition
I know I should create subtrees for easier processing, but the only
example I saw was for expressions where it was very easy to use the
operators as roots, but in my case I can't find any specific token to
identify the subtree uniquely
is there any way to create and add non-existing tokens as roots to
mark certain kinds of subtrees?

e.g. I have:
rule1: (test1) => alt1 | alt2;

then I want to "label" the two alternatives, e.g. #(ALT1 alt1) and
#(ALT2 alt2), where ALT1 and ALT2 did not exist in the lexer
can I do that? or something similar?

Adrian


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list