Declarative Specification of Indentation Rules: A Tooling Perspective on Parsing and Pretty-Printing Layout-Sensitive Languages
In layout-sensitive languages, the indentation of an expression or statement can influence how a program is parsed. While some layout-sensitive languages (e.g., Python) have wide adoption in practice, there is little support for software language engineers in building tools for layout-sensitive languages. As a result, parsers, pretty-printers, program analyses, or refactorings often need to be handwritten, which decreases the maintainability and extensibility of these tools. Even state-of-the-art language workbenches have yet little support for layout-sensitive languages, restricting the development and prototyping of such languages.
To ease dealing with layout-sensitive languages in practice, we introduce a novel approach to support declarative specifications of layout-sensitive languages using layout declarations. Layout declarations are high-level specifications of indentation rules that occur in layout-sensitive languages, abstracting from low-level technicalities. We show how to automatically derive an efficient layout-sensitive generalized parser and a corresponding pretty-printer from a language specification with layout declarations. We validate our approach in a case-study using a syntax definition for the Haskell programming language, investigating the performance of the generated parser and the correctness of the generated pretty-printer when considering a corpus of 22191 Haskell files.
Mon 5 NovDisplayed time zone: Guadalajara, Mexico City, Monterrey change
10:30 - 12:00 | |||
10:30 30mTalk | Declarative Specification of Indentation Rules: A Tooling Perspective on Parsing and Pretty-Printing Layout-Sensitive Languages SLE 2018 Luis Eduardo de Souza Amorim Delft University of Technology, Netherlands, Michael J. Steindorfer Delft University of Technology, Sebastian Erdweg TU Delft, Eelco Visser Delft University of Technology Link to publication DOI | ||
11:00 30mTalk | GLL Parsing with Flexible Combinators SLE 2018 L. Thomas van Binsbergen Royal Holloway University of London, Elizabeth Scott Royal Holloway University of London, Adrian Johnstone File Attached | ||
11:30 30mTalk | Morbig: A Static Parser for POSIX Shell SLE 2018 Yann Régis-Gianas IRIF, University Paris Diderot and CNRS, France / INRIA PI.R2, Nicolas Jeannerod IRIF, Université de Paris, Ralf Treinen IRIF |