expandRules {xegaBNF} | R Documentation |
Replaces rules with fNTs and terminals by a new set of rules with terminals.
Description
Replaces rules with fNTs and terminals by a new set of rules with terminals.
Usage
expandRules(rPT, SPT, G)
Arguments
rPT |
Rules fNTs and terminals. |
SPT |
Current short production table (SPT). |
G |
The grammar. |
Value
The extended short production table.
See Also
Other Compilation of short production table:
allTerminal()
,
cL()
,
directRecursion()
,
expandGrid()
,
findNextRuleForExpansion()
,
finiteRulesOfG()
,
nonTerminalsOfG()
,
smallestRules()
Examples
g<-compileBNF(booleanGrammar())
finiteRules<-finiteRulesOfG(g)
SPT<-newPT(LHS=g$PT$LHS[finiteRules], RHS=g$PT$RHS[finiteRules])
rest<-!(finiteRulesOfG(g) | directRecursion(g))
restPT<-newPT(LHS=g$PT$LHS[rest], RHS=g$PT$RHS[rest])
nSPT<-expandRules(rPT=restPT, SPT=SPT, g)
printPT(nSPT, g)
[Package xegaBNF version 1.0.0.5 Index]