[antlr-interest] Help! AST thing is driving me nuts!

Jorge Scandaliaris j_scandaliaris at yahoo.es
Sat Mar 22 11:42:01 PST 2003


Hi,

            Yeah, I am at the point where you start tearing out your
hair! Ok, here it goes. I have built the recognizer and I am now moving
into AST. I turned the option on in the parser and to start I generated
just the linked list (no ^ nor !). Now I want to complicate things up,
but besides ^ and ! operators I would like to use actions to insert
imaginary tokens and change the tree structure. I have not worked with
the treewalker yet, just the parser, but it seems I am missing the
picture big time. Example:

Tokens { IMAG_TOK;}

start_rule:   (rule)+  EOF! {#start_rule=#(#[IMAG_TOK], #start_rule);};

 

This either doesn’t do what I wanted (create an IMAG_TOK node and set it
as root of the tree) or I get fancy compile errors about not being able
to convert 1 parameter from void (void) to antlr::ASTRefCount<class
antlr::AST>. I have tried several changes, but I must be missing
something big.

Last thing, I can´t find anywhere in the doc about the use of ## for
actions (I picked this from some examples) and it does have an effect
over generated code.

I would appreciate some help, especially in directing me towards the
good approach and documentation/examples about this. Thanks,

 

Jorge Scandaliaris

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030322/b984e5b9/attachment.html


More information about the antlr-interest mailing list