[antlr-interest] Re: code that takes in a Java file and outputs the names of the classes and methods?

jw9315 jw9315 at bris.ac.uk
Sat May 3 17:05:29 PDT 2003


--- In antlr-interest at yahoogroups.com, iank at b... wrote:
> 
>   I've written a .class file disassembler which will output class 
and
>   method information.  This can be found at
>   http://www.bearcave.com/software/java/javad/index.html.  If you 
want
>   to go from source, you might start with the ANTLR Java parser.  
You
>   can build abstract syntax trees for the Java class information and
>   then output this.
> 
>   Ian
Hi,
Thanks for that info. I have the Abstract Syntax Tree in memory and 
was wondering what the easiest way to extract the class and method 
information from this? Would it just be a case of calling getChild() 
and getNextSibling() recursively, and looking for class and method 
names? Alternatively, could I look though the string representation 
of the tree for all the class and method types?

Is there a set algorithm for going through all the nodes in an AST, 
as I'm having trouble getting my head round it! I don't think I have 
time to implement a tree parser, so I have to use getFirstChild() and 
getNextSibling() when walking the tree...
Any help would be greatly appreciated, (dissertation handin is very 
near!)
Jon


 

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




More information about the antlr-interest mailing list