View source: R/derivationTrees.R
treeExtract | R Documentation |
pos
in a derivation tree.treeExtract()
returns
the subtree at position pos
in a derivation tree.
treeExtract(tree, node)
tree |
Derivation tree. |
node |
Attributed node. |
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
with an executable R index expression.
All what remains to be done, is
to complete the access statement and
to return the result of parsing and evaluating the string.
Derivation tree.
Other Tree Operations:
compatibleSubtrees()
,
treeInsert()
g<-compileBNF(booleanGrammar())
t1<-randomDerivationTree(g$Start, g)
t1anl<-treeANL(t1, g$ST)
n1<-chooseNode(t1anl$ANL)
st1<-treeExtract(t1, n1)
decodeCDT(st1, g$ST)
st2<-treeExtract(t1, chooseNode(t1anl$ANLa))
decodeCDT(st2, g$ST)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.