Reference. Verified ALL(*) Parsing with Semantic Actions and Dynamic Input Validation

Follow up to CoStar.

Cite

Cite as @lasserCoStar2023 (helia, typst) · \cite{lasserCoStar2023} (LaTeX)
BibTeX
bibtex · 17 lines
@InProceedings{lasserCoStar2023,
author="Lasser, Sam
and Casinghino, Chris
and Egolf, Derek
and Fisher, Kathleen
and Roux, Cody",
editor="Rozier, Kristin Yvonne
and Chaudhuri, Swarat",
title="Verified ALL(*) Parsing with Semantic Actions and Dynamic Input Validation",
booktitle="NASA Formal Methods",
year="2023",
publisher="Springer Nature Switzerland",
address="Cham",
pages="414--429",
abstract="Formally verified parsers are powerful tools for preventing the kinds of errors that result from ad hoc parsing and validation of program input. However, verified parsers are often based on formalisms that are not expressive enough to capture the full definition of valid input for a given application. Specifications of many real-world data formats include both a syntactic component and one or more non-context-free semantic properties that a well-formed instance of the format must exhibit. A parser for context-free grammars (CFGs) cannot determine on its own whether an input is valid according to such a specification; it must be supplemented with additional validation checks.",
isbn="978-3-031-33170-1"
}
hayagriva YAML (typst)
yaml · 23 lines
lasserCoStar2023:
  type: article
  title: Verified ALL(*) Parsing with Semantic Actions and Dynamic Input Validation
  author:
  - Lasser, Sam
  - Casinghino, Chris
  - Egolf, Derek
  - Fisher, Kathleen
  - Roux, Cody
  date: 2023
  editor:
  - Rozier, Kristin Yvonne
  - Chaudhuri, Swarat
  page-range: 414-429
  serial-number:
    isbn: 978-3-031-33170-1
  abstract: Formally verified parsers are powerful tools for preventing the kinds of errors that result from ad hoc parsing and validation of program input. However, verified parsers are often based on formalisms that are not expressive enough to capture the full definition of valid input for a given application. Specifications of many real-world data formats include both a syntactic component and one or more non-context-free semantic properties that a well-formed instance of the format must exhibit. A parser for context-free grammars (CFGs) cannot determine on its own whether an input is valid according to such a specification; it must be supplemented with additional validation checks.
  parent:
    type: proceedings
    title: NASA Formal Methods
    publisher:
      name: Springer Nature Switzerland
      location: Cham
Cites 16 works (8 here)
With notes (8)

Verbatim++: verified, optimized, and semantically rich lexing with derivatives egolf-2022-verbatim

PDF · DOI · pldb

CoStar: A verified ALL(*) parser lasserCoStarVerifiedALL2021

Parsers are security-critical components of many software systems, and verified parsing therefore has a key role to play in secure software design. However, existing verified parsers for context-free grammars are limited in their expressiveness, termination properties, or performance characteristics. They are only compatible with a restricted class of grammars, they are not guaranteed to terminate on all inputs, or they are not designed to be performant on grammars for real-world programming languages and data formats. In this work, we present CoStar, a verified parser that addresses these limitations. The parser is implemented with the Coq Proof Assistant and is based on the ALL(*) parsing algorithm. CoStar is sound and complete for all non-left-recursive grammars; it produces a correct parse tree for its input whenever such a tree exists, and it correctly detects ambiguous inputs. CoStar also provides strong termination guarantees; it terminates without error on all inputs when applied to a non-left-recursive grammar. Finally, CoStar achieves linear-time performance on a range of unambiguous grammars for commonly used languages and data formats.
PDF · DOI · pldb

Verbatim: A verified lexer generator egolfVerbatim

Lexers and parsers are often used as front ends to connect input from the outside world with the internals of a larger software system. These front ends are natural targets for attackers who wish to compromise the larger system. A formally verified tool that performs mechanized lexical analysis would render attacks on these front ends less effective. In this paper we present Verbatim, an executable lexer that is implemented and verified with the Coq Proof Assistant. We prove that Verbatim is correct with respect to a standard lexer specification. We also analyze its theoretical complexity and give results of an empirical performance evaluation. All correctness proofs have been mechanized in Coq.
DOI

Zippy LL(1) parsing with derivatives EdelmannZippy2020

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 part of Scallion, a parser combinators framework in Scala with enumeration and pretty printing capabilities.
DOI · pldb

A Verified LL(1) Parser Generator lasserLL1_2019

An LL(1) parser is a recursive descent algorithm that uses a single token of lookahead to build a grammatical derivation for an input sequence. We present an LL(1) parser generator that, when applied to grammar G, produces an LL(1) parser for G if such a parser exists. We use the Coq Proof Assistant to verify that the generator and the parsers that it produces are sound and complete, and that they terminate on all inputs without using fuel parameters. As a case study, we extract the tool’s source code and use it to generate a JSON parser. The generated parser runs in linear time; it is two to four times slower than an unverified parser for the same grammar.

Predecessor to CoStar and CoStar++.

DOI

Adaptive LL(*) parsing: the power of dynamic analysis parr-2014-adaptive

PDF · DOI · pldb

Validating LR(1) Parsers jourdanValidatingLRParsers2012

An LR(1) parser is a finite-state automaton, equipped with a stack, which uses a combination of its current state and one lookahead symbol in order to determine which action to perform next. We present a validator which, when applied to a context-free grammar G and an automaton A, checks that A and G agree. Validating the parser provides the correctness guarantees required by verified compilers and other high-assurance software that involves parsing. The validation process is independent of which technique was used to construct A. The validator is implemented and proved correct using the Coq proof assistant. As an application, we build a formally-verified parser for the C99 language.
PDF · DOI · pldb

Total parser combinators danielssonTotalParserCombinators2010

A monadic parser combinator library which guarantees termination of parsing, while still allowing many forms of left recursion, is described. The library’s interface is similar to those of many other parser combinator libraries, with two important differences: one is that the interface clearly specifies which parts of the constructed parsers may be infinite, and which parts have to be finite, using dependent types and a combination of induction and coinduction; and the other is that the parser type is unusually informative.

The library comes with a formal semantics, using which it is proved that the parser combinators are as expressive as possible. The implementation is supported by a machine-checked correctness proof.

PDF · DOI · pldb
External (8)
lasserCoStar2023 reference entries/refs/lasserCoStar2023/lasserCoStar2023.hel