Skip to content


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.


The sources of the SDF3 implementation can be found at

Last update: 2023-02-02