[antlr-interest] trace as an grammar and rule option

mzukowski at yci.com mzukowski at yci.com
Tue Sep 17 14:14:57 PDT 2002


FYI there are separate options for lexer, parser and tree parser.  

They are:

-trace
-traceLexer
-traceParser
-traceTreeWalker

Rule level might be nice, but I've never needed it.

Monty

> -----Original Message-----
> From: richardhensley99 [mailto:richard.hensley at mckesson.com]
> Sent: Tuesday, September 17, 2002 2:08 PM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] trace as an grammar and rule option
> 
> 
> Hello,
> 
> I have a situation where I can only reproduce a bug by testing my 
> grammar on a file that is about 20k lines long. I used antlr and 
> turned on -traceParser, and this looks like it will generate the 
> output I need, however it is taking a very long time to run... 
> 
> I was wondering if anybody has ever thought about a trace option at 
> the grammar and at the rule level?
> 
> I've been poking around in the antlr source, and I think it would be 
> implemented very much like the defaultErrorHandler option. It seems 
> that the touch points would be the following:
> 
> MakeGrammar.java is the only place the creates rule blocks. When it 
> creates them, it copies the defaultErrorHandler option from the 
> grammar. I think the same rules would apply for a trace option.
> 
> JavaCodeGenerator.java checks the grammar for the traceRules flag. 
> This would be changed to test the rule block currently in context.
> 
> Grammar.java the setOption method would be modified to allow a trace 
> option.
> 
> RuleBlock.java the setOption method would be modified to allow a 
> trace option.
> 
> Are there any other touch points that I missed?
> 
> I think this would be useful because I would be able to reduce the 
> number of rules that are trace that I really don't care about. At 
> this time, my test for debugging takes enough time that I was able to 
> research this change and start on the changes.
> 
> From my research, I think the changes would allow the option in 
> lexers, parsers, and tree parsers.
> 
> If anybody thinks this is useful, I would be more that willing to 
> submit the source files, or a diff patch back to the list. I'm using 
> 2.7.2a2, so I think this is fairly recent.
> 
> Richard
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
http://docs.yahoo.com/info/terms/ 


 

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



More information about the antlr-interest mailing list