Abstract
Brzozowski derivatives, well known in the context of regular expressions, have recently been rediscovered to give a simplified explanation to parsers of context-free languages. We add derivatives as a novel first-class feature to a standard parser combinator language. First-class derivatives enable an inversion of the control flow, allowing to implement modular parsers for languages that previously required separate pre-processing steps or cross-cutting modifications of the parsers. We show that our framework offers new opportunities for reuse and supports a modular definition of interesting use cases of layout-sensitive parsing.
- M. Adams, C. Hollenbeck, and M. Might. On the complexity and performance of parsing with derivatives. In Proceedings of the Conference of Programming Language Design and Implementation, 2016. Google Scholar
Digital Library
- M. D. Adams. Principled parsing for indentation-sensitive languages: Revisiting Landin’s offside rule. In Proceedings of the Symposium on Principles of Programming Languages, POPL, pages 511–522, New York, NY, USA, 2013. ACM. Google Scholar
Digital Library
- M. D. Adams and Ö. S. A˘gacan. Indentation-sensitive parsing for Parsec. In Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell, Haskell ’14, pages 121–132, New York, NY, USA, Sept. 2014. ACM. Google Scholar
Digital Library
- A. Afroozeh and A. Izmaylova. One parser to rule them all. In 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward!), pages 151–170. ACM, 2015. Google Scholar
Digital Library
- J. A. Brzozowski. Derivatives of regular expressions. Journal of the ACM (JACM), 11(4):481–494, 1964. Google Scholar
Digital Library
- N. A. Danielsson. Total parser combinators. In Proceedings of the International Conference on Functional Programming, ICFP, pages 285–296, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- S. Erdweg, T. Rendel, C. Kästner, and K. Ostermann. Layoutsensitive generalized parsing. In Software Language Engineering, pages 244–263. Springer, 2012.Google Scholar
- P. Hudak. Modular Domain Specific Languages and Tools. In Proceedings of the International Conference on Software Reuse, pages 134–142. IEEE, 1998. Google Scholar
Digital Library
- G. Hutton. Higher-order functions for parsing. Journal of Functional Programming, 2:323–343, 7 1992.Google Scholar
Cross Ref
- G. Hutton and E. Meijer. Monadic parsing in haskell. Journal of functional programming, 8(04):437–444, 1998. Google Scholar
Digital Library
- T. Jim and Y. Mandelbaum. A new method for dependent parsing. In Proceedings of the Programming Languages and Systems: European Symposium on Programming, ESOP, pages 378–397. Springer, 2011. Google Scholar
Digital Library
- T. Jim, Y. Mandelbaum, and D. Walker. Semantics and algorithms for data-dependent grammars. In Proceedings of the Symposium on Principles of Programming Languages, POPL, pages 417–430, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- O. Kiselyov. Iteratees. In Functional and Logic Programming, pages 166–181. Springer, 2012. Google Scholar
Digital Library
- P. J. Landin. The next 700 programming languages. Commun. ACM, 9(3):157–166, Mar. 1966. Google Scholar
Digital Library
- P. Ljunglöf. Pure functional parsing-an advanced tutorial. Licenciate thesis, Göteborg University and Chalmers University of Technology, Gothenburg, Sweden, 2002.Google Scholar
- S. Marlow (editor). Haskell 2010 language report. https:// www.haskell.org/onlinereport/haskell2010/, 2010.Google Scholar
- M. Might, D. Darais, and D. Spiewak. Parsing with derivatives: A functional pearl. In Proceedings of the International Conference on Functional Programming, ICFP, pages 189–195, New York, NY, USA, 2011. ACM. Google Scholar
Digital Library
- A. Moss. Derivatives of parsing expression grammars. CoRR, abs/1405.4841, 2014.Google Scholar
- Python Software Foundation. The Python language reference: Full grammar specification. https://docs.python.org/3. 5/reference/grammar.html. Accessed: 2015-03-24.Google Scholar
- J. J. Rutten. Automata and coinduction (an exercise in coalgebra). Springer, 1998.Google Scholar
Cross Ref
- S. D. Swierstra. Combinator parsing: A short tutorial. In Language Engineering and Rigorous Software Development, pages 252–300. Springer, 2009. Google Scholar
Digital Library
- P. Wadler. How to replace failure by a list of successes. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture, pages 113–128, New York, NY, USA, 1985. Springer-Verlag New York, Inc. Google Scholar
Digital Library
- J. Winter, M. M. Bonsangue, and J. Rutten. Context-free languages, coalgebraically. Springer, 2011.Google Scholar
Cross Ref
Index Terms
Parsing with first-class derivatives
Recommendations
Parsing with first-class derivatives
OOPSLA 2016: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsBrzozowski derivatives, well known in the context of regular expressions, have recently been rediscovered to give a simplified explanation to parsers of context-free languages. We add derivatives as a novel first-class feature to a standard parser ...
Syntax error recovery in parsing expression grammars
SAC '18: Proceedings of the 33rd Annual ACM Symposium on Applied ComputingParsing Expression Grammars (PEGs) are a formalism used to describe top-down parsers with backtracking. As PEGs do not provide a good error recovery mechanism, PEG-based parsers usually do not recover from syntax errors in the input, or recover from ...
The Semantics of Parsing with Semantic Actions
LICS '12: Proceedings of the 2012 27th Annual IEEE/ACM Symposium on Logic in Computer ScienceThe recovery of structure from flat sequences of input data is a problem that almost all programs need to solve. Computer Science has developed a wide array of declarative languages for describing the structure of languages, usually based on the context-...







Comments