[antlr-interest] Is it possible to debug tree rewriters (grammars translating AST to AST)?

piotr.sobczyk sobczyk.peter at gmail.com
Fri Nov 11 03:47:59 PST 2011


This post has NOT been accepted by the mailing list yet.
This is a very minimal example of something called TreeRewriter in Antlr: 

tree grammar Test; 

options { 
    ASTLabelType = CommonTree; 
    output = AST; 
    filter = true; 
} 

tokens { 
TEST; 
} 

test 
    : 
    ^(TEST .) -> ^(TEST) 
    ; 

The important chunks are options: output = AST and filter = true. These two
combined together make a TreeRewriter (this is a class name that generated
parser extends). 

Now please compile it with -debug flag like that: 

java -cp antlr-3.3-complete.jar org.antlr.Tool -debug Test.g 

What is generated in my case is a class defined like this: 

public class MyTreeRewriter extends DebugTreeRewriter{ 

And here the problems start. There is no class DebugTreeRewriter defined in
Antlr jar so I'm getting a compilation error. Moreover when I googled
DebugTreeRewriter I didn't found any single trace of such class existence! 

I'm getting a lot more compilation errors because it seems generated class
assumes that it inherited a lot of members from DebugTreeRewriter and they
obviously can't be found. 

I'm starting to be suspicious that there is not support for debugging tree
rewriters at all so far. Can someone confirm/deny this? Did anyone succeeded
to debug a tree rewriter?

--
View this message in context: http://antlr.1301665.n2.nabble.com/Is-it-possible-to-debug-tree-rewriters-grammars-translating-AST-to-AST-tp6985126p6985126.html
Sent from the ANTLR mailing list archive at Nabble.com.


More information about the antlr-interest mailing list