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 Nov Times are displayed in time zone: Guadalajara, Mexico City, Monterrey change
10:30 - 12:00
|Declarative Specification of Indentation Rules: A Tooling Perspective on Parsing and Pretty-Printing Layout-Sensitive Languages|
Luis Eduardo de Souza AmorimDelft University of Technology, Netherlands, Michael J. SteindorferDelft University of Technology, Sebastian ErdwegTU Delft, Eelco VisserDelft University of TechnologyLink to publication DOI
|GLL Parsing with Flexible Combinators|
L. Thomas van BinsbergenRoyal Holloway University of London, Elizabeth ScottRoyal Holloway University of London, Adrian JohnstoneFile Attached
|Morbig: A Static Parser for POSIX Shell |