[antlr-interest] imaginary tree nodes

Ruslan Zasukhin sunshine at public.kherson.ua
Sun Aug 25 15:11:41 PDT 2002


on 8/25/02 18:15, James Peckol at jasonyipwa at yahoo.com wrote:

> Hi,
> 
>  I am very new to ANTLR. So I am asking some basic things. When I am reading
> the tree construction part in the documentation, I just didn't understand what
> it was talking about.
> 
>  I especially don't understand what this does:
> 
>  rule  : A b:B C
>           {#rule = #(#b, [IMAG, "IMAG"]);}
> 
>  ;
>  What is an imaginary tree node and what it does with the AST? Why do I have
> to use it?   I look at the grammar file, then compiled the code, and look at
> the result. I also look at the documentation.
>  None of it helped me to understand what it is, just made me even more
> confusing.
>  Could anybody helps me? Thanks!Jason

Look into Java grammar as example.
There is many points where is used imaginary token.

May happens that you do not need to use them in your grammar.

I think it become obvious that you need add imaginary token when you start
develop tree walker -- second phase of parsing. The you return to your
Parser and add for needed rule this imaginary token

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on at lists.macserve.net
-------------------------------------------------------------


 

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



More information about the antlr-interest mailing list