| treeInsert {xegaDerivationTrees} | R Documentation |
Inserts a subtree into a derivation tree at a node.
Description
treeInsert() inserts a subtree into
a tree at a node.
Usage
treeInsert(tree, subtree, node)
Arguments
tree |
Derivation tree. |
subtree |
Subtree. |
node |
Attributed node. |
Details
An attributed node is a list
whose element node$Index contains
an access function to the node.
The access function is represented as a string
which contains an executable R index expression.
All what remains to be done, is
to complete the assignment statement and
to parse and evaluate the string.
Value
A derivation tree.
See Also
Other Tree Operations:
compatibleSubtrees(),
treeExtract()
Examples
g<-compileBNF(booleanGrammar())
t1<-randomDerivationTree(g$Start, g)
t2<-randomDerivationTree(g$Start, g)
t1anl<-treeANL(t1, g$ST)
n1<-chooseNode(t1anl$ANL)
t2<-randomDerivationTree(n1$ID, g)
tI1<-treeInsert(t1, t2, n1)
decodeCDT(tI1, g$ST)
[Package xegaDerivationTrees version 1.0.0.0 Index]