The Spoofax language workbench supports the high-level definition of (domain-specific) programming languages by means of meta-languages and the automatic derivation of implementations from such definitions. A declarative meta-language allows the language designer to abstract from irrelevant implementation details and focus on the essence of a language.
This tutorial will provide an introduction to two meta-languages from the Spoofax language workbench for the definition of syntax and static semantics and demonstrate their application. The tutorial will cover three topics:
(1) Declarative syntax definition with SDF3: the extension of context-free grammars to syntax definitions by means of features such as constructors, layout templates, lexical syntax, and declarative disambiguation in order to derive full featured syntax aware editors.
(2) Name binding and resolution with scope graphs: the definition of a framework for the representation of a wide range of name binding rules, including (mutually recursive) modules and imports.
(3) Type system definition with the Statix constraint language: the interaction between name and type resolution and the automatic scheduling of name resolution queries in order to ensure that all information is collected before it is used.
During the tutorial I will do mostly live programming building the syntax and type checker of a small language. You can find the code that I will recreate during the tutorial at https://github.com/MetaBorgCube/statix-sandbox/tree/master/london. In the first part of the tutorial we look at syntax using the london.syntax project. In the second part we look at static semantics using the london.statics project. The complete code is in the london project, examples in london.example and tests in london.syntax.test and london.test.
I will be using a recent development release (from June 10) of Spoofax, which you can find at http://www.metaborg.org/en/latest/source/release/development.html. I have not installed the very latest development release, so there is a slight chance that something will break.
For more information see http://www.metaborg.org
Eelco Visser is Antoni van Leeuwenhoek Professor of Computer Science at Delft University of Technology. He received a master’s and doctorate in computer science from the University of Amsterdam in 1993 and 1997, respectively. Previously he served as postdoc at the Oregon Graduate Institute, as Assistant Professor at Utrecht University, and as Associate Professor at TU Delft.
His research interests include programming languages, software language engineering, domain-specific programming languages, program transformation, syntax definition, and parsing. With his students he has designed and implemented the Spoofax language workbench, as well as many domain-specific languages, including DSLs for syntax definition (SDF2, SDF3), program transformation (Stratego), static semantics (NaBL, Statix), dynamic semantics (DynSem), software deployment (Nix), web application development (WebDSL), and mobile phone applications (mobl). In the language designer’s workbench project he is pursuing high-level declarative language definition that serves for language implementation and verification.