Installation
Some setup is required before the Polyglot framework can be used. This page
provides instructions and links to the necessary tools.
Prerequisites
First, install the following tools, following the instructions found at the links:
- Java SE Development Kit 7: The Polyglot framework is written in Java 7, so we need a Java compiler to compile the framework code. (Polyglot does compile itself, but the output is a collection of Java source files. We need Java bytecode to run the framework; javac does the rest of the job.)
- Eclipse Standard 4.3.2: Use of Eclipse is not required with Polyglot, but we recommend it and use it in this tutorial.
Tutorial participants: Download the
Eclipse workspace prepared for the tutorial
and skip the rest of this section. The prepared workspace includes version
2.6.1 of Polyglot and the skeleton of a sample extension.
Next, open Eclipse and choose a workspace directory of your choice. Go to the
workbench. Go to menu Project → Build Automatically to uncheck
the option to avoid headache in the next step.
Download the Polyglot distribution from GitHub
using Eclipse's Import wizard. Go to menu File → Import... and select Git
→ Projects from Git.
Select Clone URI on the next screen, and enter (paste) this URI:
On the next screen, Deselect All branches, and then choose only the master
branch.
Select an empty Local Destination Directory of your choice on the next screen.
Eclipse will then clone the project on the next screen. When done, select
Import existing projects, and click Finish.

Deselect Build Automatically before downloading Polyglot.

We will import the Polyglot project from GitHub.
https://github.com/polyglot-compiler/polyglot.giton the screen that follows. The remaining fields will be populated automatically.

Paste the above URI in the URI field.

Clone only the master branch.
Probably because of an Eclipse bug, a lot of undesired directories will be
included on the build path. To fix this, right click on the project name and go
to Build Path → Configure Build Path....
On Source tab, change the Default output folder to polyglot-git/bin_ (note the
underscore) and click OK. Select No when asked whether generated resources
should be removed.

We don't need all these directories!

Change the output folder to bin_.
Now we are ready to build Polyglot.
Building Polyglot
Polyglot is compiled with the Ant build tool,
which is already included in the Eclipse distribution. Therefore, we will
build Polyglot in Eclipse directly.
First, locate
Locate the tab Targets on the configuration dialog. The compile target should
be checked by default. Also select the jar target and make sure that the Target
execution order towards the bottom of the dialog shows "compile, jar" in that
order.
Finally, press Run. The Polyglot project will start building, which usually
takes about a minute for a fresh build. Java files for lexers and parsers will
be generated at this time. Once the build is successful, refresh the project by
right-clicking the project name and select Refresh on the menu that pops up.
Lastly, check the Build Automatically that we deselected before downloading
Polyglot. Eclipse will then build the project, which is useful for running Java
applications within Eclipse itself. The CUP JAR file located at
lib/java_cup.jar will also be necessary for a successful build in Eclipse; add
it to build path by right-clicking the file name and select Build Path →
Add to Build Path from the menu that pops up.
build.xml
under the Polyglot root directory.
Right-click on the file and select Run As → Ant Build... from the menu that
pops up to open the build configuration dialog.

Select Ant Build... to open the build dialog

Select compile and jar as the targets.