[antlr-interest] Hi, is there anybody tell me how to get parse tree?

Jeff Barnes jbarnesweb at yahoo.com
Sun Feb 5 13:41:35 PST 2006


You should probably read the fine manual again. It
took me several readings to begin to wrap my head
around the subject matter. 

To get the AST to ignore '(' your parser should have
something along the lines of

expr:
    ((LPAREN)?)! multexpr (PLUS^ multexpr)?
((RPAREN)?)!
;

Tweak until it fits...

Regards,
Jeff

--- ÐÂÂò <inshua at gmail.com> wrote:

> as (1+2) + 3
> parse tree will include the "(" token, which will be
> ignore in AST.
> so the expression (1+2) has 5 leaf : ( , 1, + , 2, 
> ).
> 
> for I wanna make an IDE, so locating source code is
> necessary, is there
> anybody tell me about it?
> 



More information about the antlr-interest mailing list