Abstract
In layout-sensitive languages, the indentation of an expression or statement can influence how a program is parsed. While some of these languages (e.g., Haskell and Python) have been widely adopted, there is little support for software language engineers in building tools for layout-sensitive languages. As a result, parsers, pretty-printers, program anal-yses, and refactoring tools often need to be handwritten, which decreases the maintainability and extensibility of these tools. Even state-of-the-art language workbenches have little support for layout-sensitive languages, restricting the development and prototyping of such languages. In this paper, we introduce a novel approach to declarative specification of layout-sensitive languages using layout declarations. Layout declarations are high-level specifications of indentation rules that abstract from low-level technicalities. We show how to derive an efficient layout-sensitive generalized parser and a corresponding pretty-printer automatically 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 against 22191 Haskell files.
Original language | English |
---|---|
Title of host publication | SLE 2018 - Proceedings of the 11th ACM SIGPLAN International Conference on Soft ware Language Engineering |
Editors | D. Pearce , S. Friedrich, T. Mayerhofer |
Place of Publication | New York, NY |
Publisher | Association for Computing Machinery (ACM) |
Pages | 3-15 |
Number of pages | 13 |
ISBN (Electronic) | 978-1-4503-6029-6 |
DOIs | |
Publication status | Published - 2018 |
Event | SLE 2018: 11th ACM SIGPLAN International Conference on Software Language Engineering - Boston, United States Duration: 5 Nov 2018 → 6 Nov 2018 Conference number: 11 |
Conference
Conference | SLE 2018 |
---|---|
Country/Territory | United States |
City | Boston |
Period | 5/11/18 → 6/11/18 |
Other | Part of SPLASH 2018 |