January 2013
Intermediate to advanced
328 pages
8h 5m
English
Once we’ve run ANTLR on our grammar, we need to compile the generated Java source code. We can do that by simply compiling everything in our /tmp/array directory.
| | $ cd /tmp/array |
| | $ javac *.java # Compile ANTLR-generated code |
If you get a ClassNotFoundException error from the compiler, that means you probably haven’t set the Java CLASSPATH correctly. On UNIX systems, you’ll need to execute the following command (and likely add to your start-up script such as .bash_profile):
| | $ export CLASSPATH=".:/usr/local/lib/antlr-4.0-complete.jar:$CLASSPATH" |
To test our grammar, we use the TestRig via alias grun that we saw in the previous chapter. Here’s how to print out the tokens created by ...
Read now
Unlock full access