-1

With executing org.antlr.Tool in antlr-3.5.1-complete.jar with grammar Java.g (e.g. Java.g) there are no method JavaParser.javaSource() and class JavaParser.javaSource_return generated, but in Java Tree parser output for ANTLR - Stack Overflow. Why?

Community
  • 1
  • 1

1 Answers1

1

The two posts are not using the same Java.g file. For the file you referenced, the entry point is the rule compilationUnit, which produces JavaParser.compilationUnit() and JavaParser.compilationUnit_return.

Sam Harwell
  • 97,721
  • 20
  • 209
  • 280
  • The grammar Java.g producing JavaParser.javaSource() and JavaParser.javaSource_return is not longer avaiable in http://www.antlr3.org/grammar/list.html (http://www.antlr3.org/grammar/1207932239307/Java1_5Grammars/ gives 404: Page not found), but in https://github.com/grammarware/slps/tree/master/topics/grammars/java-5/habelitz. – user3285922 Feb 08 '14 at 22:17
  • Unfortunately the grammar JavaTreeParser.g in https://github.com/grammarware/slps/tree/master/topics/grammars/java-5/habelitz, ist not capable for code rewriting purposes depicted in http://danielveselka.blogspot.de/2011/01/antlr-java-source-code-rewrite.html, because there ist not generated a method JavaTreeParser.setTemplateLib(StringTemplateGroup). Elsewhere I could'nt find a capable JavaTreeParser.g file. – user3285922 Feb 08 '14 at 22:29