[antlr-interest] ANTLRv3: How to get the parser traces as in ANTLR v2.X without using the DEbugSocketProxxy??

Kay Röpke kroepke at classdump.org
Sun Aug 10 08:25:23 PDT 2008


Hi!

On Aug 10, 2008, at 5:05 PM, Francis ANDRE wrote:

> I am using ANTLR generated parser/lexer under Eclipse.
>
> How can I run a parser with the old ANTLR V2 traces that were quite  
> ok for a debugging under Eclipse??? (when compiling ANTLRv3 with the  
> -debug option, I am stacked on the DebugEventSocketProxy...)


AFAIK there's no option to directly turn traces on in v3.
However, take a look at http://www.antlr.org/wiki/pages/viewpage.action?pageId=1760 
  on how to build a parse tree.
Alternatively you can make a subclass of  
org.antlr.runtime.debug.BlankDebugEventListener and print out rules as  
you enter/exit them. With tracking nesting levels you can easily print  
out a parse trace. The interface you need to override is minimal,  
though most likely the ParseTreeBuilder already gives you enough  
information to work with.

cheers,
-k
-- 
Kay Röpke
http://classdump.org/








More information about the antlr-interest mailing list