Visit the SugarJ web site http://sugarj.org
- Install Eclipse (follow instructions on eclipse.org).
- Start Eclipse.
- In Eclipse, select 'Install New Software' in the 'Help' menu.
- In the 'work with' field, copy the SugarJ update site http://update.sugarj.org and hit enter.
- Be sure to deselect the 'Group items by category' checkbox on the bottom of the window.
- 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.
- Create a new Java project.
- 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: org.sugarj.editor.SugarJBuilder
- We're ready to go. Note: SugarJ source files must have the file extension ".sugj".
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.
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>
--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
files.
--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.