In this talk we present our work on a syntax definition for the OCaml language in the syntax definition formalism SDF3. SDF3 supports high-level definition of concrete and abstract syntax through declarative disambiguation and definition of constructors, enabling a direct mapping to abstract syntax. Based on the SDF3 syntax definition, the Spoofax language workbench produces a complete syntax aware editor with a parser, syntax checking, parse error recovery, syntax highlighting, formatting with correct parenthesis insertion, and syntactic completion. The syntax definition should provide a good basis for experiments with the design of OCaml and the development of further tooling. In the talk we will highlight interesting aspects the syntax definition, discuss issues we encountered in the syntax of OCaml, and demonstrate the editor.
For an introduction to SDF3 with an OCaml inspired running example, see the paper
Luís Eduardo Amorim de Souza, Eelco Visser. Multi-Purpose Syntax Definition with SDF3. To appear in SEFM 2020. [PDF]