LL(1) Parsing with Derivatives and Zippers

11/28/2019
by   Romain Edelmann, et al.
0

In this paper, we present an efficient, functional, and formally verified parsing algorithm for LL(1) context-free expressions based on the concept of derivatives of formal languages. Parsing with derivatives is an elegant parsing technique, which, in the general case, suffers from cubic worst-case time complexity and slow performance in practice. We specialise the parsing with derivatives algorithm to LL(1) context-free expressions, where alternatives can be chosen given a single token of lookahead. We formalise the notion of LL(1) expressions and show how to efficiently check the LL(1) property. Next, we present a novel linear-time parsing with derivatives algorithm for LL(1) expressions operating on a zipper-inspired data structure. We prove the algorithm correct in Coq and present an implementation as a parser combinators framework in Scala, with enumeration and pretty printing capabilities.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/31/2018

Recognising and Generating Terms using Derivatives of Parsing Expression Grammars

Grammar-based sentence generation has been thoroughly explored for Conte...
research
04/11/2023

flap: A Deterministic Parser with Fused Lexing

Lexers and parsers are typically defined separately and connected by a t...
research
06/30/2011

IDL-Expressions: A Formalism for Representing and Parsing Finite Languages in Natural Language Processing

We propose a formalism for representation of finite languages, referred ...
research
10/17/2019

Marpa, A practical general parser: the recognizer

The Marpa recognizer is described. Marpa is a practical and fully implem...
research
07/16/2018

LATE Ain'T Earley: A Faster Parallel Earley Parser

We present the LATE algorithm, an asynchronous variant of the Earley alg...
research
03/01/2022

Parsing Randomness: Unifying and Differentiating Parsers and Random Generators

"A generator is a parser of randomness." This perspective on generators ...
research
11/29/2019

Chain Rules for Hessian and Higher Derivatives Made Easy by Tensor Calculus

Computing multivariate derivatives of matrix-like expressions in the com...

Please sign up or login with your details

Forgot password? Click here to reset