SableCC Gradle plugin
Use the SableCC parser generator as part of a Gradle build.
This plugin has been developed for use with the STUPS fork of SableCC, but it is also compatible with the official SableCC 3.x releases.
Features
- Automatically calls SableCC and manages the generated files
- Supports multiple grammars per project
- Allows choosing a custom version of SableCC
How to use
Apply the plugin:
plugins {
id "de.hhu.stups.sablecc" version "1.0.0"
}
Set the SableCC version to use:
repositories {
mavenCentral()
}
dependencies {
sableCC(group: "sablecc", name: "sablecc", version: "3.2-1")
}
Then put your SableCC grammar(s) under src/main/sablecc. Extensions .scc and .sablecc are recognized.
SableCC will now run automatically as part of your build -
the plugin automatically adds SableCC as a dependency of compileJava
, sourcesJar
, etc.
You can also generate the parsers manually by running the task generateSableCCSource
(or generate<SourceSetName>SableCCSource
for other source sets).
Advanced configuration
Some advanced options can be configured directly on the SableCC tasks. You normally don't need to do this - all of these options have reasonable defaults.
tasks.named("generateSableCCSource").configure {
sableCCClasspath = sourceSets.something.runtimeClasspath
maxHeapSize = "512M"
// WARNING: The destination dirs will be DELETED every time the SableCC task runs!
destinationJavaDir = "my/custom/out/java"
destinationResourcesDir = "my/custom/out/resources"
// Supports all standard SourceTask configuration options
include("my/custom/grammars/**.scc")
}
License
The source code is distributed under the Eclipse Public License - v 2.0.
The SableCC Gradle plugin comes with ABSOLUTELY NO WARRANTY OF ANY KIND ! This software is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY. The author(s) do not accept responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all. No warranty is made about the software or its performance.
(c) 2022 STUPS group, Heinrich Heine University Düsseldorf