Reference. On the translation of languages from left to right
Cite
Cited by (8)
The categorical contours of the Chomsky-Schützenberger representation theorem mellies-2025-the
Parsing as a lifting problem and the Chomsky-Schützenberger representation theorem mellis_zeilberger_2022
We begin by explaining how any context-free grammar encodes a functor of operads from a freely generated operad into a certain “operad of spliced words”. This motivates a more general notion of CFG over any category , defined as a finite species equipped with a color denoting the start symbol and a functor of operads into the operad of spliced arrows in . We show that many standard properties of CFGs can be formulated within this framework, and that usual closure properties of CF languages generalize to CF languages of arrows. We also discuss a dual fibrational perspective on the functor via the notion of “displayed” operad, corresponding to a lax functor of operads .
We then turn to the Chomsky-Schützenberger Representation Theorem. We describe how a non-deterministic finite state automaton can be seen as a category equipped with a pair of objects denoting initial and accepting states and a functor of categories satisfying the unique lifting of factorizations property and the finite fiber property. Then, we explain how to extend this notion of automaton to functors of operads, which generalize tree automata, allowing us to lift an automaton over a category to an automaton over its operad of spliced arrows. We show that every CFG over a category can be pulled back along a ND finite state automaton over the same category, and hence that CF languages are closed under intersection with regular languages. The last important ingredient is the identification of a left adjoint to the operad of spliced arrows functor, building the “contour category” of an operad. Using this, we generalize the C-S representation theorem, proving that any context-free language of arrows over a category is the functorial image of the intersection of a -chromatic tree contour language and a regular language.
Zippy LL(1) parsing with derivatives EdelmannZippy2020
A typed, algebraic approach to parsing krishnaswami_typed_2019
Validating LR(1) Parsers jourdanValidatingLRParsers2012
Parsing with derivatives: A functional pearl mightParsingDerivativesFunctional2011
We present a functional approach to parsing unrestricted context-free grammars based on Brzozowski’s derivative of regular expressions. If we consider context-free grammars as recursive regular expressions, Brzozowski’s equational theory extends without modification to context-free grammars (and it generalizes to parser combinators). The supporting actors in this story are three concepts familiar to functional programmers - laziness, memoization and fixed points; these allow Brzozowski’s original equations to be transliterated into purely functional code in about 30 lines spread over three functions.
Yet, this almost impossibly brief implementation has a drawback: its performance is sour - in both theory and practice. The culprit? Each derivative can double the size of a grammar, and with it, the cost of the next derivative.
Fortunately, much of the new structure inflicted by the derivative is either dead on arrival, or it dies after the very next derivative. To eliminate it, we once again exploit laziness and memoization to transliterate an equational theory that prunes such debris into working code. Thanks to this compaction, parsing times become reasonable in practice.
We equip the functional programmer with two equational theories that, when combined, make for an abbreviated understanding and implementation of a system for parsing context-free languages.
Properties of deterministic top-down grammars rosenkrantz_properties_1970
An efficient context-free parsing algorithm Earley1970
Cites 12 works (0 here)
External (12)
- Deterministic Context-Free Languages (abstract, Notices AMS) (1965)
- Universality of Tag systems with P = 2 (1964)
- Generation of parsing algorithms for Chomsky type 2 languages (1964)
- Bounded context syntactic analysis (1964)
- “Structural connections” in formal languages (1964)
- Generating Productions from BNF (Earley) (1964)
- New Proofs of Old Theorems in Logic and Formal Linguistics (Floyd) (1964)
- Syntactic analysis and operator precedence (1963)
- Ambiguities in BNF Languages (1963)
- Revised report on the algorithmic language ALGOL 60 (1963)
- A general processor for certain formal languages (1962)
- Recursive unsolvability of a problem of Thue (1947)