[antlr-interest] Walking TreeParser question

mzukowski at yci.com mzukowski at yci.com
Fri Sep 19 10:28:53 PDT 2003


Look at the source code.  Your main program calls the tree parser, you can
call it as many times as you want.

Monty

-----Original Message-----
From: Nico [mailto:nico123 at adinet.com.uy] 
Sent: Thursday, September 18, 2003 8:38 PM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Walking TreeParser question


Hi all:

I will use the Antlr to parse a source code and to get some metrics.
I will read source, to create the AST with parser and walk it with the
TreeParser.
(as seen in the java.g and java.g.tree example)
TreeParser has the same structure to the one that were used to create the
AST.

My question is:

How do I iterate recursively in the tree (or call it several times) ?
(The java tree parser example walks it once)

For example, If I want to count the number of classes, one pass is enough.
But if want to get the number of overridden methods in a sub class, I need
to walk the 
tree more than once.

Is my question clear?



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

 

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




More information about the antlr-interest mailing list