[antlr-interest] Printing parser rule names

Bryan Ewbank ewbank at gmail.com
Tue Jan 30 06:11:22 PST 2007


It's a bit brutal, but consider using the trace mechanism - it reports the
function names as they are entered/exited, and this may contain enough
information to parse out what you want.

On 1/28/07, Jono Juggler <jono at mail2juggler.com> wrote:
>
>  Hello,
>
> I need a way to count the number of function calls, if statements, etc in
> source code. I am using several languages, but I am starting with the
> java.g grammar. If DumpASTVisitor printed the names of the parser rules
> instead of the token type, that would be fine.
>
> I know I can edit the grammar file to add print statements into each rule,
> but I would rather not since I am going to be using more then one language.
>
> I have done the getting started tutorial, and taken a quick look at the
> API, but I have not found a way to print the names of the rules.
>
> Any ideas?
> Thanks.
>
>
> FHA Home Loan Rates, Compare Rates
> Refinance your FHA home loan today. Get 4 quotes from leading lenders!<http://tagline.bidsystem.com/fc/MhtXpK1Q3oPXyfCgKIX5RyVPFbOH2LnBL8ZVU/>
>
> _______________________________________________________________
> Get the Free email that has everyone talking at http://www.mail2world.com
> Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070130/3c177cc8/attachment.html 


More information about the antlr-interest mailing list