Linear algorithm for lexicographic enumeration of CFG parse trees
暂无分享,去创建一个
We study CFG parse tree enumeration in this paper. By dividing the set of all parse trees into infinite hierarchies according to height of parse tree, the hierarchical lexicographic order on the set of parse trees is established. Then grammar-based algorithms for counting and enumerating CFG parse trees in this order are presented. To generate a parse tree of height n, the time complexity is O(n). If τ is a lowest parse tree for its yield, then O(n) =O(∥ gt ∥+ 1), where ∥τ ∥ is the length of the sentence (yield) generated by τ. The sentence can be obtained as a by-product of the parse tree. To compute sentence from its parse tree (needn’t be lowest one), the time complexity is O(node)+O(∥τ ∥ + 1), where node is the number of non-leaf nodes of parse tree τ. To generate both a complete lowest parse tree and its yield at the same time, the time complexity is O(∥τ ∥ + 1).
[1] Huang Wen. Enumerating Sentences of Context Free Language Based on First One in Order , 2004 .
[2] Erkki Mäkinen,et al. On Lexicographic Enumeration of Regular and Context-Free Languages , 1997, Acta Cybern..
[3] Jeffrey D. Ullman,et al. Introduction to Automata Theory, Languages and Computation , 1979 .
[4] Pál Dömösi. Unusual Algorithms for Lexicographical Enumeration , 2000, Acta Cybern..