- Install Java Runtime Environment (JRE).
- Verify the above using "java -version" command.
- Set the Java CLASSPATH variable to point the ANTLR package version you want to use. Ex: antlr-3.1.3.jar
- Build the ANTLR project to verify that there are no issues using following command:
- java -cp "path to ANTLR package" org.antlr.Tool "grammer file name"
- Ex: java -cp "C:\antlr\antlr-3.1.3.jar" org.antlr.Tool tsqllexer.g
If you get "java.lang.OutofMemoryError: Java heap space" issue, use the following command to modify the JVM heap size.
If you get "Multiple token rules can match input such as X, Tokens X.Y was disabled for that input" issue, use the following command to set NFA conversion timeout for each decision for a suitable value.
- Create new C# project.
- Add these dlls as references: antlr.runtime.dll, Antlr3.Runtime.dll, Antlr3.Utility, StringTemplate.dll
- Build the C# project.