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

Hensley, Richard richard.hensley at mckesson.com
Wed Sep 18 08:39:05 PDT 2002


I ended up implementing the grammar level trace and the rule level
trace. The reason that rule level trace is useful is because it is one
of the only ways to get println's when rules are guessing. The trace
also gives a very good standard picture of where the parser is and what
tokens are being examined in the context. I've been using trace on
various rules to get a clear understanding of how rules are interacting,
etc.

This was not very hard to implement. By the way, the grammar level trace
option is very useful because it allows turning on trace without having
to modify an ant build.xml. It would also be useful for things like the
eclipse antlr integration that does not allow the setting of options.

If there is interest in the community, I can send a diff patch to the
list. 

Richard 

-----Original Message----- 
From: mzukowski at yci.com [ mailto:mzukowski at yci.com
<mailto:mzukowski at yci.com> ] 
Sent: Wednesday, September 18, 2002 7:42 AM 
To: antlr-interest at yahoogroups.com 
Subject: RE: [antlr-interest] trace as an grammar and rule option 


I've been thinking about rule-level trace too.  Nearly always you will
want 
to know the whole context from which the rule has been called.  Rarely
is 
the problem in a rule per se, it's more likely to be how the rules
relate to 
one another, so I'm not sure how useful it would be to have a rule-level

trace.  Inspecting the code for a rule will probably give you all the 
insight you need. 

Monty 

> -----Original Message----- 
> From: Ric Klaren [ mailto:klaren at cs.utwente.nl
<mailto:klaren at cs.utwente.nl> ] 
> Sent: Wednesday, September 18, 2002 1:59 AM 
> To: antlr-interest at yahoogroups.com 
> Subject: Re: [antlr-interest] trace as an grammar and rule option 
> 
> 
> Hi, 
> 
> On Tue, Sep 17, 2002 at 09:08:29PM -0000, richardhensley99 wrote: 
> > I was wondering if anybody has ever thought about a trace option at 
> > the grammar and at the rule level? 
> 
> I'm not sure I completely understand the rule level trace. I 
> kindoff got a 
> hunch that you want to do something similar to parts of the parseView 
> hooks (look at the code generated with -debug) 
> 
> Dunno, my first reaction is something like why not put a few 
> println's in 
> the rule to see what happens? Done in a few minutes, nothing 
> fancy always 
> works :) Of course it can very much be that I misunderstood 
> what you want 
> to do exactly.... 
> 
> Cheers, 
> 
> Ric 
> -- 
> -----+++++**************************************************** 
> *+++++++++------- 
>     ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 
> 4893722  ---- 
> -----+++++**************************************************** 
> *+++++++++------- 
>  Why don't we just invite them to dinner and massacre them 
> all when they're 
>   drunk? You heard the man. There's seven hundred thousand of 
> them. Ah? .. 
>            So it'd have to be something simple with pasta, then. 
>                  From: Interesting Times by Terry Pratchet 
> 
> 
>  
> 
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/>

> 
> 

  

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20020918/1ce04d85/attachment.html


More information about the antlr-interest mailing list