randomDerivationTree {xegaDerivationTrees}R Documentation

Generates a random derivation tree.

Description

randomDerivationTree() generates a random derivation tree.

Usage

randomDerivationTree(sym, G, maxdepth = 5, CompleteDT = TRUE)

Arguments

sym

Non-terminal symbol.

G

Grammar.

maxdepth

Integer. Maximal depth of the derivation tree.

CompleteDT

Boolean. Generate a complete derivation tree? Default: TRUE.

Details

RandomDerivationTree() recursively expands non-terminals and builds a depth-bounded derivation tree.

Value

Derivation tree (a nested list).

See Also

Other Generate Derivation Tree: generateDerivationTree(), rndsubk(), rndsub(), substituteSymbol()

Examples

g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
b<-randomDerivationTree(g$Start, g, maxdepth=10)
c<-randomDerivationTree(g$Start, g, 2, FALSE)


[Package xegaDerivationTrees version 1.0.0.0 Index]