Multi-purpose Syntax Definition with SDF3

Luis Eduardo de Souza Amorim, Eelco Visser. Multi-purpose Syntax Definition with SDF3. In Frank S. de Boer, Antonio Cerone, editors, Software Engineering and Formal Methods - 18th International Conference, SEFM 2020, Amsterdam, The Netherlands, September 14-18, 2020, Proceedings. Volume 12310 of Lecture Notes in Computer Science, pages 1-23, Springer, 2020. [doi]


SDF3 is a syntax definition formalism that extends plain context-free grammars with features such as constructor declarations, declarative disambiguation rules, character-level grammars, permissive syntax, layout constraints, formatting templates, placeholder syntax, and modular composition. These features support the multi-purpose interpretation of syntax definitions, including derivation of type schemas for abstract syntax tree representations, scannerless generalized parsing of the full class of context-free grammars, error recovery, layout-sensitive parsing, parenthesization and formatting, and syntactic completion. This paper gives a high level overview of SDF3 by means of examples and provides a guide to the literature for further details.