How to enumerate trees from a context-free grammar

04/30/2023
by   Steven T. Piantadosi, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
10/31/2017

A generalized parsing framework for Abstract Grammars

This technical report presents a general framework for parsing a variety...
research
08/30/2021

Learning Highly Recursive Input Grammars

This paper presents Arvada, an algorithm for learning context-free gramm...
research
08/30/2017

LangPro: Natural Language Theorem Prover

LangPro is an automated theorem prover for natural language (https://git...
research
08/28/2019

Eliminating Left Recursion without the Epsilon

The standard algorithm to eliminate indirect left recursion takes a prev...
research
02/22/2019

On Transforming Narrowing Trees into Regular Tree Grammars Generating Ranges of Substitutions

The grammar representation of a narrowing tree for a syntactically deter...
research
12/01/2022

P(Expression|Grammar): Probability of deriving an algebraic expression with a probabilistic context-free grammar

Probabilistic context-free grammars have a long-term record of use as ge...
research
08/23/2023

Saggitarius: A DSL for Specifying Grammatical Domains

Common data types like dates, addresses, phone numbers and tables can ha...

Please sign up or login with your details

Forgot password? Click here to reset