Syntactic Analysis and Operator Precedence
Journal of the ACM (JACM)
Derivatives of Regular Expressions
Journal of the ACM (JACM)
An efficient context-free parsing algorithm
Communications of the ACM
POPL '73 Proceedings of the 1st annual ACM SIGACT-SIGPLAN symposium on Principles of programming languages
Selected writings on computing: a personal perspective
Selected writings on computing: a personal perspective
Packrat parsing:: simple, powerful, lazy, linear time, functional pearl
Proceedings of the seventh ACM SIGPLAN international conference on Functional programming
Parsing as abstract interpretation of grammar semantics
Theoretical Computer Science
PRACTICAL TRANSLATORS FOR LR(K) LANGUAGES
PRACTICAL TRANSLATORS FOR LR(K) LANGUAGES
LR parsers for natural languages
ACL '84 Proceedings of the 10th International Conference on Computational Linguistics and 22nd annual meeting on Association for Computational Linguistics
Packrat parsers can support left recursion
PEPM '08 Proceedings of the 2008 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
Regular-expression derivatives re-examined
Journal of Functional Programming
Combinator Parsing: A Short Tutorial
Language Engineering and Rigorous Software Development
Grammar analysis and parsing by abstract interpretation
Program analysis and compilation, theory and practice
Proceedings of the 15th ACM SIGPLAN international conference on Functional programming
RockSalt: better, faster, stronger SFI for the x86
Proceedings of the 33rd ACM SIGPLAN conference on Programming Language Design and Implementation
Functional programming with structured graphs
Proceedings of the 17th ACM SIGPLAN international conference on Functional programming
Abstract syntax graphs for domain specific languages
PEPM '13 Proceedings of the ACM SIGPLAN 2013 workshop on Partial evaluation and program manipulation
Fixing idioms: a recursion primitive for applicative DSLs
PEPM '13 Proceedings of the ACM SIGPLAN 2013 workshop on Partial evaluation and program manipulation
FliPpr: a prettier invertible printing system
ESOP'13 Proceedings of the 22nd European conference on Programming Languages and Systems
Verified decision procedures for MSO on words based on derivatives of regular expressions
Proceedings of the 18th ACM SIGPLAN international conference on Functional programming
Two-Pass greedy regular expression parsing
CIAA'13 Proceedings of the 18th international conference on Implementation and Application of Automata
Hi-index | 0.00 |
We present a functional approach to parsing unrestricted context-free grammars based on Brzozowski's derivative of regular expressions. If we consider context-free grammars as recursive regular expressions, Brzozowski's equational theory extends without modification to context-free grammars (and it generalizes to parser combinators). The supporting actors in this story are three concepts familiar to functional programmers - laziness, memoization and fixed points; these allow Brzozowski's original equations to be transliterated into purely functional code in about 30 lines spread over three functions. Yet, this almost impossibly brief implementation has a drawback: its performance is sour - in both theory and practice. The culprit? Each derivative can double the size of a grammar, and with it, the cost of the next derivative. Fortunately, much of the new structure inflicted by the derivative is either dead on arrival, or it dies after the very next derivative. To eliminate it, we once again exploit laziness and memoization to transliterate an equational theory that prunes such debris into working code. Thanks to this compaction, parsing times become reasonable in practice. We equip the functional programmer with two equational theories that, when combined, make for an abbreviated understanding and implementation of a system for parsing context-free languages.