LL(1) Parsing with Derivatives and Zippers

Romain Edelmann, Jad Hamza, Viktor Kunčak
11/28/2019
cs.FLcs.DS

Official code: epfl-lara/scallion-proofs (10 stars, Coq, Apache-2.0, last commit 2020-03-27).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

Apache-2.0

Proofs of correctness for Scallion (https://github.com/epfl-lara/scallion)

100Coq, ShellNov 28, 20196 years agoApache-2.0

Similar Papers

Cite this paper

@article{edelmann2019ll,
  title  = {LL(1) Parsing with Derivatives and Zippers},
  author = {Romain Edelmann and Jad Hamza and Viktor Kunčak},
  year   = {2019},
  eprint = {1911.12737},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1911.12737}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1911.12737.svg)](https://codeofpaper.com/paper/1911.12737)

Discussion