SDF3¶
SDF3 is the meta-language in Spoofax for syntax definition.
A syntax definition is structured as a collection of modules, which may import each other.
Symbols are the building blocks of productions. Productions are defined for lexical, context-free, or kernel syntax.
Start symbols indicate the entry point of a syntax definition.
SDF3 automatically generates a pretty-printer for template-based productions.
Grammars can be disambiguated by means of rejects, priorities, associativity, and restrictions.
SDF3 provides additional constructs for the definition of layout-sensitivite languages.
Permissive grammars are automatically generated for error-recovery parsing. Handwritten recovery rules can be added to tweak recovery behavior.
Several aspects related to syntax definition and parsing can be configured in the metaborg.yaml.
file.
Source¶
The sources of the SDF3 implementation can be found at
- https://github.com/metaborg/sdf/tree/master/org.metaborg.meta.lang.template: The SDF3 language implementation (SDF3 was called TemplateLang before and it has not been renamed everywhere yet)