An experimental project to develop a generic, multi-objective superoptimizer (GMOSO).
Java ANTLR Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


An experimental project to develop a generic superoptimizer. That is, a superoptimizer that works with any programming language that can be expressed in a context-free grammar.

Building GMOSO

  • Run the Ant job "all" in the Apache Ant build file "generic_superoptimizer.xml", and a set of jar files will be created in the out\artifacts\generic_superoptimizer_jar folder.
  • If you change the ANTLR v4 grammar (in the conf/ANTLRv4Grammar folder), you will need to run the "create.module.gso.antlrv4parser" task in the "compile_antlrv4_parser_from_g4_file.xml" to regenerate the java files used to parse the ANTLR v4 grammar files.

Running GMOSO

GMOSO requires a single properties file to configure paths to required settings. Two example properties files: "conf/properties/" or "conf/properties/" are included.

From IntelliJ Idea:

  • Import project into IDE (I'm using Windows 8/ Mac OSX Yosemite with IntelliJ IDEA version 14).
  • Set project to use Java 8 (ensure Java 8 is also available by checking that running "java" or "javac" works).
  • run "Main.class" with a single parameter: a relative/absolute path to a properties file.

From above "Building GMOSO" step:

  • In the folder containing the "generic_superoptimizer.jar" file, run "java -jar generic_superoptimizer.jar PROPERTIES_FILE_PATH" where PROPERTIES_FILE_PATH is the path to the properties file mentioned previously.

The "gso_test" app generates a small subset of Java basic primitive functions (see tests/gso_test/grammars/java_lejos_superoptimizer_training.g4) and the "Test" sees if the function contains "VariableA". The scenarios determine the number of characters in the statements generated, and the size of the class when the statements generated is included in an example program.

Tab-delimited files are generated by the application (defined in the configuration path) that output all programs created and the results obtained from the scenarios and tests.


In addition to this program's licence, the following libraries used have the associated licences: