[antlr-interest] How to walk AST tree

ytriffy ytriffy at gmail.com
Fri Mar 21 14:35:56 PDT 2008


Alexander Ga"ngel <alexander at gaengel.de>" wrote:
> you can use a Tree Grammar
>
> En Example is in the Wiki 
> http://www.antlr.org/wiki/display/ANTLR3/Expression+evaluator
>
> or you interface the AST directly: 
> http://www.antlr.org/wiki/display/ANTLR3/Interfacing+AST+with+Java
>
> Alexander
>
> ytriffy schrieb:
>> Hi, all.
>> I need to walk ast tree that was produced for java 5 source code.
>> And basicly I need to get method names and variable names from it(and 
>> maybe imports).
>> So what I/m trying to do is to get this structure:
>> 0                                classname
>> 1 variables array   methods array   imports array
>> I'm not very familiar with ast api. What is the most simple way to do 
>> this?
>>
>
Thanks.


More information about the antlr-interest mailing list