Database Systems

PL/pegSQL: Writing a PEG Parser for PL/pgSQL from scratch

Modern languages and systems like Python and DuckDB are changing their parsing strategy from legacy parsing systems to the more modern PEG (Parsing Expression Grammar) approach. While parsers like those generated with Yacc/Bison grammars are notoriously rigid and difficult to modify and extend, PEG offers easy adaptation for new language features and research extensions while not relying on established parsing frameworks.

This research project explores the design and implementation of a PEG-based parser for PL/pgSQL—PostgreSQL’s procedural language extension for SQL.