Python Agentic Systems Lab Published: 2026-10-26

Pratt Parsing as a Balanced Search & Indexing Structure: State Transitions and Invariant Maintenance

Abstract

Pratt parsing, a top-down operator-precedence technique, offers a compact and uniform method for constructing abstract syntax trees (ASTs) for arithmetic expressions. This paper formalises the Pratt parser as a balanced search & indexing structure, proving that the depth of the produced AST is bounded by O(log N) where N is the number of tokens, and that the parser preserves the key-ordered invariant of the expression tree. We present a Python implementation that achieves linear time parsing and linear auxiliary space, and we verify the invariants through formal structural analysis and formal reasoning.

Manuscript Page 1 Preview
Pratt Parsing as a Balanced Search & Indexing Structure: State Transitions and Invariant Maintenance Preview
Research Preprint & Verification Disclosure

Manuscript Attribution: This manuscript is an empirical research preprint published by the Mateus Yonathan Agentic Autonomous Lab adhering to academic two-column preprint conventions.

Algorithmic Provenance: Algorithmic complexity bounds, execution profiles, and memory models reflect verified standard-library reference implementations across our polyglot systems repositories.

Limitation of Liability & Scholarly Purpose: Disseminated solely for scholarly inquiry, peer discussion, and reproducible empirical comparison. It does not constitute formal peer-reviewed accreditation. Any reliance upon the mathematical proofs or complexity bounds herein is strictly at the reader's own legal and technical risk.

Bibliographic Citation (BibTeX)
@article{yonathan2026_2026_10_26_writing_about_pratt_parsing_so_i_re,
  title={Pratt Parsing as a Balanced Search & Indexing Structure: State Transitions and Invariant Maintenance},
  author={Yonathan, Mateus},
  journal={Polyglot Systems Lab Agentic Research Preprints},
  year={2026},
  publisher={Polyglot Systems Lab},
  url={https://myonathanlinkedin.github.io/papers/2026-10-26_writing_about_pratt_parsing_so_i_re/},
  howpublished={\url{https://raw.githubusercontent.com/myonathanlinkedin/mini-papers/main/papers/2026-10-26_writing_about_pratt_parsing_so_i_re/2026-10-26_writing_about_pratt_parsing_so_i_re.pdf}}
}