Derivatives of Parsing Expression Grammars
Aaron Moss (Cheriton School of Computer Science, University of, Waterloo)

TL;DR
This paper presents a derivative parsing algorithm for parsing expression grammars that improves worst-case time bounds to polynomial and achieves linear time and constant space on practical input classes, validated empirically.
Contribution
It introduces a derivative parsing algorithm with polynomial worst-case time and linear-time, constant-space performance on practical inputs, outperforming recursive descent and packrat parsers.
Findings
Derivative parsing has polynomial worst-case time bound.
On practical inputs, derivative and recursive descent parsing run in linear time.
Derivative parsing uses constant space on a common class of inputs.
Abstract
This paper introduces a new derivative parsing algorithm for recognition of parsing expression grammars. Derivative parsing is shown to have a polynomial worst-case time bound, an improvement on the exponential bound of the recursive descent algorithm. This work also introduces asymptotic analysis based on inputs with a constant bound on both grammar nesting depth and number of backtracking choices; derivative and recursive descent parsing are shown to run in linear time and constant space on this useful class of inputs, with both the theoretical bounds and the reasonability of the input class validated empirically. This common-case constant memory usage of derivative parsing is an improvement on the linear space required by the packrat algorithm.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
