[antlr-interest] Help! AST thing is driving me nuts!
mzukowski at yci.com
mzukowski at yci.com
Mon Mar 24 08:08:05 PST 2003
## is shorthand for the root of the tree currently being built. It's the
same as #ruleName
Monty
-----Original Message-----
From: Jorge Scandaliaris [mailto:j_scandaliaris at yahoo.es]
Sent: Saturday, March 22, 2003 6:17 PM
To: antlr-interest at yahoogroups.com
Subject: RE: [antlr-interest] Help! AST thing is driving me nuts!
Thanks. I was actually doing such a silly thing that I am now ashamed. I
had modified the start rule in the grammar but forgot to reflect that in
the main file, and so I could have tried for ages to modify the start
rule and nothing would have happened in the output.
I still wonder what the ## (instead of just #) does in an AST action. I
have looked at the generated code, but I can't figure it out.
I guess I move forward now 'till the next bump in the road :)
I would still appreciate if someone can point me to useful info
regarding ASTs (other than antlr's ref. manual or getting started
tutorials).
Jorge
PS: I am not experienced with Antlr, (nor with c++ either to be honest)
so I apologize if my questions seem evident to you.
> -----Mensaje original-----
> De: Ross Bencina [mailto:rbencina at iprimus.com.au]
> Enviado el: sábado, 22 de marzo de 2003 21:45
> Para: antlr-interest at yahoogroups.com
> Asunto: Re: [antlr-interest] Help! AST thing is driving me nuts!
>
> It's a while since I did this, so i'm just going on code I wrote at
the
> time, but I think what you want is:
>
> Tokens { IMAG_TOK;}
>
> start_rule!: a:rules EOF! {#start_rule=#([IMAG_TOK], #a);};
>
> rules: (rule)+
>
> Best wishes,
>
> Ross.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list