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

Eric researcher0x00 at gmail.com
Mon Nov 14 04:56:07 PST 2011


Hi,

Only a few people can update the ANTLR bug list at
http://www.antlr.org/jira/browse/ANTLR

I am not one of them.

Currently the best way to submit a bug report is to submit it here. I try
to put the word "bug", the name of the software, i.e org.antlr.Tool,
ANTLRWorks, String Template, and the version in the title of the e-mail so
it is know to be a bug report.

However, ANTLR 3.x is now in maintenance mode and this probably will not
get fixed for ANTLR 3.x. ANTLR 4.x should be out in a month or so, and if
the problem exist for v4, then I would definitely report it here with a
minimal reproducible example if possible.

Eric

On Mon, Nov 14, 2011 at 4:04 AM, piotr.sobczyk <sobczyk.peter at gmail.com>wrote:

> Should I file this issue as a bug? I think antlr should rather display
> error message in this case (when -debug is used) that debugging
> TreeRewriters is not yet supported instead of generating parser
> extending non existing class DebugTreeRewriter?!
>
> 2011/11/11 Eric [via ANTLR] <ml-node+s1301665n6986144h0 at n2.nabble.com>:
> > On Fri, Nov 11, 2011 at 12:24 PM, Eric <[hidden email]> wrote:
> >
> >>
> >>
> >> On Fri, Nov 11, 2011 at 12:12 PM, Piotr Sobczyk <[hidden email]>wrote:
> >>
> >>> Thanks, Eric but did you read my question carefully? I have no
> >>> problems with debugging a plain TreeGrammar and I know how to do it.
> >>> My problems occur when I add output = AST and filter = true options to
> >>> that grammar. Then the generated parser can't be even compiled by
> >>> javac. You can copy-paste my minimal example, generate a parser from
> >>> it and then try to compile the parser to see exactly what the problem
> >>> is.
> >>>
> >>> 2011/11/11 Eric <[hidden email]>:
> >>>
> >>
> >> Thanks for pointing that out. My mistake.
> >>
> >> I don't have an answer to that as I have never tryied that. If I find a
> >> way to do it or can verify that it can't be done I will post something.
> >>
> >> Thanks, Eric
> >>
> >>
> >>
> >>
> >>> >
> >>> >
> >>> > On Fri, Nov 11, 2011 at 6:47 AM, piotr.sobczyk <[hidden email]
> >>> >
> >>> > wrote:
> >>> >>
> >>> >> 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?
> >>> >
> >>> >
> >>> > Yes.
> >>> >
> >>> > See http://www.antlr.org/wiki/pages/viewpage.action?pageId=4554901
> >>> >
> >>> >
> >>> >>
> >>> >> --
> >>> >> 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.
> >>> >>
> >>> >> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> >>> >> Unsubscribe:
> >>> >>
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >>> >
> >>> >
> >>>
> >>
> >>
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe:
> > http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> >
> >
> > ________________________________
> > If you reply to this email, your message will be added to the discussion
> > below:
> >
> http://antlr.1301665.n2.nabble.com/Is-it-possible-to-debug-tree-rewriters-grammars-translating-AST-to-AST-tp6985126p6986144.html
> > To unsubscribe from Is it possible to debug tree rewriters (grammars
> > translating AST to AST)?, click here.
> > See how NAML generates this email
>
>
> --
> View this message in context:
> http://antlr.1301665.n2.nabble.com/Is-it-possible-to-debug-tree-rewriters-grammars-translating-AST-to-AST-tp6985126p6991792.html
> Sent from the ANTLR mailing list archive at Nabble.com.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list