I'm new to ANTLR and trying to write grammar in ANTLR4 without any prior brush with the previous version. I'm following the book 'The Definitive ANTLR 4 Reference'. I use Eclipse and installed ANTLR4 IDE as given in here. I wrote the following grammar in Expr.g4:
grammar Expr;
import Common;
options{
language = Java;
}
prog: stat+;
stat: expr NEWLINE
| ID '=' expr NEWLINE
| NEWLINE;
expr: expr ('/'|'*') expr
| expr ('+'|'-') expr
| INT
| ID
| '('expr')';
The Common.g4 contains the following:
lexer grammar Common;
ID: [A-Za-z]+;
INT: [0-9]+;
NEWLINE: '\r'?'\n';
WS: [\t]+ -> skip;
The lexer.java was created but not parser.java and visitor.java and other base file. Please help me fix the problem. Thanks in advance.