[antlr-interest] Changing from buildAST=false to buildAST=true

Loring Craymer Loring.G.Craymer at jpl.nasa.gov
Wed Jun 8 14:42:13 PDT 2005


As I recall, the translation is

#tok in the parser is translated to "tok", and #tok_in to tok_in
In tree parsers, #tok_in becomes tok and #tok becomes tokAST (or tok, if 
there is no output AST)

There is also an inconsistency (I can't recall when this occurs) that 
requires you to use tok in some circumstance where #tok should be correct, 
but does not work.

--Loring


At 11:32 AM 6/8/2005, Terence Parr wrote:

>On Jun 8, 2005, at 11:24 AM, Bryan Ewbank wrote:
>
>>Okay, so I'm changing one of my passes from exploration/annotation to
>>tree surgery, and therefore need to change it from buildAST=false to
>>buildAST=true.
>>
>>The problem I'm encoutering is that this seems to mean I need to
>>change all references to subrule names from simply "subrule" to
>>"#subrule" in my actions.
>>
>>E.g., given this:
>>      a: #(A b c d)   { b->setValue(foo); }
>>It appears I need to change this to:
>>      a: #(A b c d)   { #b->setValue(foo); }
>>
>>Is this true, or do I misunderstand?
>
>Hi Bryan,
>
>It probably is...
>
>Unfortunately, I allowed label to work just like #label.  Technically
>it should be #label, but by virtue of the implementation plain label
>also worked...i'm going to disallow that in this new version.
>
>Ter
>--
>CS Professor & Grad Director, University of San Francisco
>Creator, ANTLR Parser Generator, http://www.antlr.org
>Cofounder, http://www.jguru.com




More information about the antlr-interest mailing list