DeepAI AI Chat
Log In Sign Up

A Verified Packrat Parser Interpreter for Parsing Expression Grammars

by   Clement Blaudeau, et al.
Ecole Polytechnique
SRI International

Parsing expression grammars (PEGs) offer a natural opportunity for building verified parser interpreters based on higher-order parsing combinators. PEGs are expressive, unambiguous, and efficient to parse in a top-down recursive descent style. We use the rich type system of the PVS specification language and verification system to formalize the metatheory of PEGs and define a reference implementation of a recursive parser interpreter for PEGs. In order to ensure termination of parsing, we define a notion of a well-formed grammar. Rather than relying on an inductive definition of parsing, we use abstract syntax trees that represent the computational trace of the parser to provide an effective proof certificate for correct parsing and ensure that parsing properties including soundness and completeness are maintained. The correctness properties are embedded in the types of the operations so that the proofs can be easily constructed from local proof obligations. Building on the reference parser interpreter, we define a packrat parser interpreter as well as an extension that is capable of semantic interpretation. Both these parser interpreters are proved equivalent to the reference one. All of the parsers are executable. The proofs are formalized in mathematical terms so that similar parser interpreters can be defined in any specification language with a type system similar to PVS.


page 5

page 9

page 10

page 11

page 12

page 13

page 14


Chart Parsing Multimodal Grammars

The short note describes the chart parser for multimodal type-logical gr...

Morpheus: Automated Safety Verification of Data-dependent Parser Combinator Programs

Parser combinators are a well-known mechanism used for the compositional...

Idris TyRE: a dependently typed regex parser

Regular expressions – regexes – are widely used not only for validating,...

Interval Parsing Grammars for File Format Parsing

File formats specify how data is encoded for persistent storage. They ca...

CPEG: A Typed Tree Construction from Parsing Expression Grammars with Regex-Like Captures

CPEG is an extended parsing expression grammar with regex-like capture a...

A Derivative-based Parser Generator for Visibly Pushdown Grammars

In this paper, we present a derivative-based, functional recognizer and ...

Type-Driven Incremental Semantic Parsing with Polymorphism

Semantic parsing has made significant progress, but most current semanti...