Configuring your Development Environment
This page contains information on how to setup your environment to help develop SableCC. It provides installation, configuration, and other information on the various recommended tools.
Mercurial
Mercurial is a lightweight distributed source control system. SableCC uses it to host its source code repository.
Installation
You can find the Mercurial download link and installation instructions the lastest at http://www.selenic.com/mercurial/wiki/index.cgi/Download.
Configuration
Simply copy the following into your ~/.hgrc configuration file:
[defaults] diff = --git email = --git export = --git [ui] username = Your Name <your@address>
Documentation
For additional information and short tutorials, visit the main site of Mercurial at http://www.selenic.com/mercurial.
You can also find a complete user manual online at http://hgbook.red-bean.com/.
Ant
Ant is a terrific build tool for compiling and packaging code easily.
Installation
The latest version of Ant can be download from http://ant.apache.org/bindownload.cgi.
To install Ant, simply unpack the binary distribution file in an appropriate location.
Configuration
Set up the following environment variables:
- ANT_HOME must point to the location where you unpacked the distribution file.
- PATH must include the bin subdirectory of the location where you unpacked the distribution file.
If installing under Windows, the Ant user manual recommends that you avoid using a long filename for your ANT_HOME.
Documentation
The Ant user manual is available at http://ant.apache.org/manual/index.html.
A short step-by-step tutorial is available at http://ideoplex.com/focus/java#ant.
JUnit
JUnit is an extremely useful, yet simple framework for writing tests.
Installation
To get JUnit, simply click on the download link at the top of the http://junit.org/ web page.
To install it, simply unpack the distribution file in an appropriate directory.
Configuration
Set up the following environment variable:
- JUNIT_HOME must point to the location where you unpacked the distribution file.
- CLASSPATH must include the path to the junit.jar (usually JUNIT_HOME/junit.jar).
If you encounter any problem, visit the JUnit FAQ page at http://junit.sourceforge.net/doc/faq/faq.htm#started.
Documentation
You can find links to additional information on the JUnit home page at http://junit.org/.
A short tutorial is available at http://today.java.net/pub/a/today/2006/12/07/junit-reloaded.html.
Eclipse
Eclipse is a very powerful Open Source integrated development environment written in Java.
Installation
You should get the Eclipse IDE for Java Developers http://www.eclipse.org/downloads/.
To install it, simply unpack the downloaded distribution file in an appropriate directory.
Configuration
The current version of Eclipse requires some special configuration for developing SableCC, as the versions of JUnit and Ant it includes are outdated.
- To set up JUnit, you must edit the JUNIT_HOME and the JUNIT_SRC_HOME variables in Window/Preferences.../Java/Build Path/Classpath.
- To set up Ant, you must edit the ANT_HOME variable in Window/Preferences.../Ant/Runtime/Ant Home. From there, click on Ant Home... and choose the directory where you previously installed Ant.
- SableCC uses a specific code style formatter. The style is available in the eclipse subdirectory of the SableCC repository. You can download it using the Original Format link at the bottom of source:eclipse/SableCC-source-formatter.xml. To import this file into Eclipse, select Window/Preferences.../Java/CodeStyle/Formatter. From there, Import the SableCC-source-formatter.xml file.
Importing Project from repository
(TODO: fix this section)
- hg clone in workspace
- File/Import...
Code Clean Up
(TODO: fix this section)
- running the code formatter with SableCC formatter
- organizing imports
- Source/Clean Up... preferences:
- Code Style
- always use blocs in if/while...
- convert for loops
- only use parentheses when necesseray
- member access
- always use this for fields
- only use this when necessary for methods
- change all static accesses through subtypes
- change all static accesses through instances
- unnecessary code
- remove unused imports
- remove unnecessary casts
- remove unnecessary $NON-NLS$
- missing code
- add @Override
- add @Deprecated
- Code Style
