An example for setting up an Eclipse project an running the TPL project
Download TPL.zip to some directory Extract files Download TPL.zip to some directory
Start a new Java project
Specify the TPL directory
Browse for the directory and choose it
Make sure you chose the right directory (not the sub-direcitory src/TPL) Click next
The folders tree should look like this
Click on the ‘Libraries’ tab Add the java_cup.runtime jar file
Choose the jar file from the lib sub-directory
Make sure the jar file is successfully added
Let’s change the default output directory from ‘bin’ to ‘classes’ Let’s change the default output directory from ‘bin’ to ‘classes’. This is done to match the output directory specified in build.xml
After change
Compiler signals an error because Lexer does not exist – we need to generate it
Open a command line and go to the TPL directory Run ant with the ‘scanner’ target
Now Lexer.java exists under src/TPL
Run ant with the ‘classes’ target to compile all sources Run Main on prog.tpl, specifying that the CLASSPATH should contain the /classes sub-directory and the java-cup-runtime jar file The scanner signals a lexical error in line 0 since it include a comment and TPL.lex does not identify comments as tokens (yet)