I wanted to create a simple compiler using ANTLR 3.5 and java 1.6 + I added jar files but I am getting this error and "Reason could not create a grammar" but I don't understand why any help? It is not the whole code but I tried to the code by bits and it is still not compiling
grammar LittleNic;
@members {
public ErrorReporter err;
public void displayRecognitionError(String[] tokenNames,
RecognitionException e) {
String msg = getErrorMessage(e, tokenNames);
err.reportSyntaxError(e.line, e.charPositionInLine, msg);
}
}
@lexer::members {
public ErrorReporter err;
public void displayRecognitionError(String[] tokenNames,
RecognitionException e) {
String msg = getErrorMessage(e, tokenNames);
err.reportSyntaxError(e.line, e.charPositionInLine, msg);
}
}
options {
language = Java;
}
program: 'PROGRAM' IDEN ';' (dec (';' dec)*)? body ';' ;
dec:' ';
body: 'BEGIN' statementlist 'END';
statementlist:' ';
fragment FIRSTS: 'a'..'z'|'A'..'Z';
IDEN: (FIRSTS(FIRSTS|'0'..'9'|'_')*);