Antlr question: cannot get Antlr tool to compile simple file from ANTLRWorks
- by Don Henton
Here is the grammar file:
grammar fred;
test : 'fred';
Here is the batch file to launch the tool:
SET JAVA_HOME=C:\Program Files\Java\jdk1.6.0_24
SET PATH=%PATH%;%JAVA_HOME%\bin
SET ANTLR_HOME=c:/users/don/workspace/antlrAssign/lib/
java -cp %ANTLR_HOME%/antlr-3.3-complete.jar antlr.Tool fred.g
Here's the result:
ANTLR Parser Generator Version 2.7.7 (20060906) 1989-2005
fred.g:1:1: unexpected token: grammar
error: Token stream error reading grammar(s):
fred.g:3:19: expecting ''', found 'r'
fred.g:1:1: rule grammar trapped:
fred.g:1:1: unexpected token: grammar
TokenStreamException: expecting ''', found 'r'
Prior postings refer to "org.antlr.Tool" but the 3.3 jar has it located as above. The idea was to create a debug version of a tree parser, and according to the documentation, you have to use the command line tool.
Has anyone seen this before? Am I nuts? It's two lines long and its dying on the first word in the file.
Of course this compiles in antlrworks.
Any help appreciated, I can't afford any more adjustments to my medications.