Type-Safe Modular Parsing
Title | Type-Safe Modular Parsing |
Publication Type | Conference Paper |
Year of Publication | 2017 |
Authors | Zhang, Haoyuan, Li, Huang, Oliveira, Bruno C. d. S. |
Conference Name | Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering |
Publisher | ACM |
Conference Location | New York, NY, USA |
ISBN Number | 978-1-4503-5525-4 |
Keywords | Collaboration, human factors, Metrics, modular parsing, Object Algebras, policy-based governance, Policy-Governed Secure Collaboration, pubcrawl, resilience, Resiliency, Safe Coding, semantic modularity |
Abstract | Over the years a lot of effort has been put on solving extensibility problems, while retaining important software engineering properties such as modular type-safety and separate compilation. Most previous work focused on operations that traverse and process extensible Abstract Syntax Tree (AST) structures. However, there is almost no work on operations that build such extensible ASTs, including parsing. This paper investigates solutions for the problem of modular parsing. We focus on semantic modularity and not just syntactic modularity. That is, the solutions should not only allow complete parsers to be built out of modular parsing components, but also enable the parsing components to be modularly type-checked and separately compiled. We present a technique based on parser combinators that enables modular parsing. Interestingly, the modularity requirements for modular parsing rule out several existing parser combinator approaches, which rely on some non-modular techniques. We show that Packrat parsing techniques, provide solutions for such modularity problems, and enable reasonable performance in a modular setting. Extensibility is achieved using multiple inheritance and Object Algebras. To evaluate the approach we conduct a case study based on the aTypes and Programming Languagesa interpreters. The case study shows the effectiveness at reusing parsing code from existing interpreters, and the total parsing code is 69% shorter than an existing code base using a non-modular parsing approach. |
URL | https://dl.acm.org/citation.cfm?doid=3136014.3136016 |
DOI | 10.1145/3136014.3136016 |
Citation Key | zhang_type-safe_2017 |