[antlr-interest] Modifying tree based on semantic content

David Jameson dhjdhj at gmail.com
Thu May 14 20:38:44 PDT 2009


Is there any way to control the built-in tree generation (from an  
initial parse phase) based on semantics of what is being parsed?

As a simple example,    if   I see the expression
        a + b

then I want to produce
     (PLUS a b)
or
    (CONCATENATE a b)

depending on whether a and b are numeric or string.


How can I do this with rewrite rules (for example)?   Or do I have to  
construct my own trees?


Thanks,
D


More information about the antlr-interest mailing list