Installing JavaCC for Mac

udaiveer singh
Code Wave
Published in
3 min readDec 2, 2015

Every developer knows that one of the biggest problems with using a new technology is the installation. In this post I am going to go over the steps and quirks needed to install JavaCC on your Mac OS with Eclipse integration. JavaCC is a parser code generation tool like YACC that build the frontend of your compiler and generates an AST using the user defined EBNF grammar rules.

Technology

Operating System: Mac OS X 10.xx

Dev Environment: Eclipse Mars IDE for Java 8

Eclipse Plugin: JavaCC Eclipse Plugin

Step 1 : Go to Eclipse Marketplace

Step 2: Install the JavaCC plugin

Step 3: Create a new file of type other

Step 4: Create a new JavaCC file

Step 5: Select folder and package (blank = default) or your package name)

Step 6: Double checking the .jar paths

Default build paths for my Mac were not the ones set by default

/Applications/Eclipse.app/Contents/Eclipse/plugins/sf.eclipse.javacc_1.5.30/javacc-5.0.jar

for the JTB the path is:

/Applications/Eclipse.app/Contents/Eclipse/plugins/sf.eclipse.javacc_1.5.30/jtb-1.4.9.jar

these only need to be set once.

Step 7: the actual paths in my Eclipse

Step 8: Now compile the JavaCC file with some sample code

You just need to be careful when compiling the javaCC files because sometimes they output code in a different package. Make sure to look at the options for the sample code in the .jj or .jjt to see if everything matches your project structure.

Finally you can now attach run as command to the javaCC file or the files that are generated because they act like .java files.

--

--