treeLeaves {xegaDerivationTrees}R Documentation

Measures the number of leaves of a complete derivation tree.

Description

treeLeaves() returns the number of terminal symbols in a complete derivation tree.

Usage

treeLeaves(tree, ST)

Arguments

tree

Derivation tree.

ST

Symbol table.

Value

Integer. Number of terminal symbols in a complete derivation tree.

See Also

Other Measures of Tree Attributes: treeListDepth(), treeNodes(), treeSize()

Examples

g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
treeLeaves(a, g$ST) 
((treeLeaves(a, g$ST)+treeNodes(a, g$ST)) == treeSize(a))


[Package xegaDerivationTrees version 1.0.0.0 Index]