0
votes

I have downloaded ANTLR 1.3 and ANTLRWorks and can generate rules and syntax diagrams OK. When I try to generate code (e.g. by GenerateCode in ANTLRWorks or with java org.antlr.Tool Temp.g I get

error(100): C:\temp\Temp.g 0:0: syntax error: codegen: <AST>: 0:0: unexpected end of subtree

I'm on Windows 7 beta, Java 1.6. I have not specifically set up a classpath as the distro implied ANTLRWorks worked out of the box.

EDIT This is a trivial grammar (generated by ANTLRWorks example) and yes, the file exists, with contents:

grammar Temp;

ID  :   ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*
    ;
1
Does this happen with a trivial grammar?Jonathan Feinberg
Does the file c:\temp\Temp.g exist? The error is one that you can get if you are passed an empty file.chollida

1 Answers

3
votes

I think this is because there were only lexical rules (of the type above). When I included:

prog: ID;

it worked