Grammar for python is given on antlr site but on using it to generate AST its giving error. I am using same procedure as for java grammar which generated AST .
Errors:
> C:\testpython>java -cp antlr-3.2.jar org.antlr.Tool Python.g
error(10): internal error: : java.lang.Error: Error parsing Python.g: 'class' not expected 'grammar' org.antlr.tool.GrammarSpelunker.match(GrammarSpelunker.java:74) org.antlr.tool.GrammarSpelunker.grammarHeader(GrammarSpelunker.java:112) org.antlr.tool.GrammarSpelunker.parse(GrammarSpelunker.java:84) org.antlr.Tool.sortGrammarFiles(Tool.java:552) org.antlr.Tool.process(Tool.java:408) org.antlr.Tool.main(Tool.java:91) error(100): Python.g:56:1: syntax error: antlr: Python.g:56:1: unexpected token: class error(8): file Python.g contains grammar PythonParser; names must be identical error(100): Python.g:56:20: syntax error: antlr: Python.g:56:20: expecting SEMI, found 'extends' error(100): syntax error: invalid char literal: '\014' error(150): grammar file Python.g has no rules error(100): Python.g:0:0: syntax error: assign.types: :0:0: unexpected end of subtree error(100): Python.g:0:0: syntax error: define: :0:0: unexpected end of subtree
Any help?