Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Library-based Language Extensibility
Java JavaScript Puppet CSS Other

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


SugarJ Eclipse plugin (recommended)


1. Install Eclipse (follow instructions on
2. Start Eclipse.
3. In Eclipse, select 'Install New Software' in the 'Help' menu.
4. In the 'work with' field, copy the SugarJ update site and hit enter.
5. Be sure to deselect the 'Group items by category' checkbox on the bottom of
   the window.
6. Select the latest instance of Sugarclipse and click continue. This will
   install the SugarJ compiler, Spoofax and the Sugarclipse plugin.

In addition, please ensure enough stack space (about 4-16 MB) is available for
the SDF parser. You can set the stack space of your Java runtime using the
-Xss16m command line argument when starting Eclipse or setting -Xss16m in your
eclipse.ini file.

Setting up a SugarJ project

1. Create a new Java project.
2. As for now, we need to register the SugarJ builder for this project by hand:
   Open your project's '.project' file in any text editor and replace the Java
   build command by the following code:
3. We're ready to go. Note: SugarJ source files must have the file extension

SugarJ standalone compiler

Installing SugarJ

The SugarJ compiler is almost self-contained and only requires an installation
of a Java runtime version 6 or higher. Download and compile the SugarJ compiler
as well as the standard library (stdlib) using javac.

Invoking SugarJ

The main class of the compiler is org.sugarj.driver.Driver. You can invoke the
SugarJ compiler like this:

    java -Xss64M -Xmx1024M \
      -cp bin:strategoxt.jar:commons-cli-1.2.jar:commons-collections-3.2.1.jar:make_permissive.jar \
       org.sugarj.driver.Driver <source_file>

Compiler options

    --atomic-imports         Parse all import statements simultaneously.
    --buildpath <arg>        Specify where to find compiled files.
                             Multiple paths can be given separated by ':'.
    --cache <arg>            Specifiy a directory for caching.
    --cache-info             show where files are cached
    -d <arg>                 Specify where to place compiled files
    --full-command-line      show all arguments to subprocesses
    --gen-java               Generate the resulting Java file in the
                             source folder.
    --help                   Print this synopsis of options
    --imports-changed        Declare that the imported modules have
                             changed since last compilation.
    --no-checing             Do not check resulting SDF and Stratego
    --read-only-cache        Specify the cache to be read-only.
    --silent-execution       try to be silent
    --sourcepath <arg>       Specify where to find source files. Multiple
                             paths can be given separated by ':'.
    --sub-silent-execution   do not display output of subprocesses
     -v,--verbose            show verbose output
    --write-only-cache       Specify the cache to be write-only.
Something went wrong with that request. Please try again.