View source: R/derivationTrees.R
randomDerivationTree | R Documentation |
randomDerivationTree()
generates a random derivation tree.
randomDerivationTree(sym, G, maxdepth = 5, CompleteDT = TRUE)
sym |
Non-terminal symbol. |
G |
Grammar. |
maxdepth |
Integer. Maximal depth of the derivation tree. |
CompleteDT |
Boolean. Generate a complete derivation tree? Default: TRUE. |
RandomDerivationTree()
recursively expands
non-terminals and builds a depth-bounded derivation tree.
Derivation tree (a nested list).
Other Generate Derivation Tree:
generateCDT()
,
generateDerivationTree()
,
rndsub()
,
rndsubk()
,
substituteSymbol()
g<-compileBNF(booleanGrammar())
a<-randomDerivationTree(g$Start, g)
b<-randomDerivationTree(g$Start, g, maxdepth=10)
c<-randomDerivationTree(g$Start, g, 2, FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.