On Fri, Nov 11, 2011 at 12:24 PM, Eric <researcher0...@gmail.com> wrote:
> > > On Fri, Nov 11, 2011 at 12:12 PM, Piotr Sobczyk > <sobczyk.pe...@gmail.com>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 <researcher0...@gmail.com>: >> > > 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 <sobczyk.pe...@gmail.com >> > >> > 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 -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.