2023/04/30 by Steven T. Piantadosi, Steven Piantadosi, Piantadosi, Steven T. · 1 voice · 1 citation
Computer Science · #Algorithms and Data Compression #cs.CL #semigroups and automata theory
paper · pdf · doi:10.48550/arxiv.2305.00522
openalex publication_date 2023/04/30 · openalex created_date 2025/10/10 · openalex updated_date 2026/07/28
I present a simple algorithm for enumerating the trees generated by a Context Free Grammar (CFG). The algorithm uses a pairing function to form a bijection between CFG derivations and natural numbers, so that trees can be uniquely decoded from counting. This provides a general way to number expressions in natural logical languages, and potentially can be extended to other combinatorial problems. I also show how this algorithm may be generalized to more general forms of derivation, including analogs of Lempel-Ziv coding on trees.