spg
Building
Pom-first and manifest-first projects cannot be mixed in the same reactor build (source), so we need to separately build org.metaborg.spg.sentence and org.metaborg.spg.sentence.eclipse*:
mvn clean install -f org.metaborg.spg.sentence.shared/pom.xml
mvn clean install -f org.metaborg.spg.sentence/pom.xml
mvn clean install -f org.metaborg.spg.sentence.antlr/pom.xml
mvn clean install -f org.metaborg.spg.sentence.eclipse.externaldeps/pom.xml
mvn clean install -f pom.xml
Testing
Only the org.metaborg.spg.sentence project contains tests. To run the tests:
mvn test -f org.metaborg.spg.sentence/pom.xml
mvn test -f org.metaborg.spg.sentence.antlr/pom.xml
Usage
Make sure you are using the Java parse table generator. This is the case when metaborg.yaml contains the following:
language:
sdf:
sdf2table: java
Using org.metaborg.spg.sentence.(sdf|antlr)
The Main class expects as its first and second argument the path to a Spoofax language artifact and the path to a Spoofax project, respectively.
Using org.metaborg.spg.sentence.eclipse*
An update site is generated at org.metaborg.spg.sentence.antlr.eclipse.site/target/site/. This Eclipse plugin contains both the SDF-generator (ambiguity testing) and ANTLR-generator (difference testing). To install the plugin in Eclipse:
- Help > Install New Software...
- Work with: the built update site.
- Check the Spoofax Generator Eclipse Plugin
- Follow the installation process.
After installing the Eclipse plugin:
- Select the project in the Package Explorer.
- Click Spoofax (meta) > SPG > Generate sentences.
- Choose a maximum term size and maximum number of terms.
- The generated sentences appear in the Console.
Warning: If you rebuild this project, uninstall the Eclipse plugin, and reinstall the Eclipse plugin, then Eclipse still uses the old (now uninstalled) version. The only solution I have found is to download a fresh Spoofax Eclipse from spoofax.org.
Using org.metaborg.spg.sentence.evaluation
The Main class runs the generator on a predefined list of languages. These projects can be found here. Use download.sh to download these languages. To run the main class:
mvn clean package exec:java
