I was provided with ANTLR grammar for a subset of the Java compiler known as the static Java compiler. I am trying to expand the grammar to include more Java features, for example, I just added a grammar for For Loops.
Using the Eclipse and ANTLR plugin, I then "Compiled ANTLR Grammar". Instead of compiling, he made two errors in the first bit of code:
grammar ExtendedStaticJava;
options { backtrack=true; memoize=true; }
@header
{
package sjc.parser.extended;
import java.math.BigInteger;
}
First error on line 1: “Unexpected token: grammar” Second error on line 5: “Unexpected char: @ '
Why doesn't it recognize this basic ANTLR syntax? My first thought was that I was missing something on the class path, but I went into the project properties and made sure that the following JAR libraries were included in the libraries:
- ANTLR-2.7.7.jar
- StringTemplate-3.2.1.jar
- antlr.jar
- ANTLR--3.0.1.jar
?