Syntax Definition Formalism


The Syntax Definition Formalism is a metasyntax used to define context-free grammars: that is, a formal way to describe formal languages. It can express the entire range of context-free grammars. Its current version is SDF3. A parser and parser generator for SDF specifications are provided as part of the free ASF+SDF Meta Environment. These operate using the SGLR. An SDF parser outputs parse trees or, in the case of ambiguities, parse forests.

Overview

Features of SDF:
The following example defines a simple Boolean expression syntax in SDF2:
module basic/Booleans
exports
sorts Boolean
context-free start-symbols Boolean
context-free syntax
"true" -> Boolean
"false" -> Boolean
lhs:Boolean "|" rhs:Boolean -> Boolean
lhs:Boolean "&" rhs:Boolean -> Boolean
"not" "" -> Boolean
"" -> Boolean
context-free priorities
Boolean "&" Boolean -> Boolean >
Boolean "|" Boolean -> Boolean

Program analysis and transformation systems using SDF