Lune

PLDI2025Top-tier venue

Intrinsic Verification of Parsers and Formal Grammar Theory in Dependent Lambek Calculus

Steven Schaefer, Nathan Varner, Pedro Henrique Azevedo de Amorim, Max S. New

2025Year
1Top-tier citations

Abstract

We present Dependent Lambek Calculus (Lambek D ), a domain-specific dependent type theory for verified parsing and formal grammar theory. In Lambek D , linear types are used as a syntax for formal grammars, and parsers can be written as linear terms. The linear typing restriction provides a form of intrinsic verification that a parser yields only valid parse trees for the input string. We demonstrate the expressivity of this system by showing that the combination of inductive linear types and dependency on non-linear data can be used to encode commonly used grammar formalisms such as regular and context-free grammars as well as traces of various types of automata. Using these encodings, we define parsers for regular expressions using deterministic automata, as well as examples of verified parsers of context-free grammars. We present a denotational semantics of our type theory that interprets the linear types as functions from strings to sets of abstract parse trees and terms as parse transformers. Based on this denotational semantics, we have made a prototype implementation of Lambek D using a shallow embedding in the Agda proof assistant. All of our examples parsers have been implemented in this prototype implementation.

Ask about this paper

Your agent reads all of it.

Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.

Questions to start from

Your agent calls

Luneget_paper_fulltext

Ask in Lune

Free to start. No credit card required.

lune papers fulltext 0f97ac75-6102-499a-a77b-54fe6c38b29a

Cited by top-tier papers1

Ask how each one uses it

Builds on3

Related papers

Dusk over the sea between two cliffs drawn in fine vertical lines