isTerminal {xegaBNF} | R Documentation |
isTerminal()
tests if the numeric identifier
is a terminal symbol.
isTerminal(Id, ST)
Id |
A numeric identifier (integer). |
ST |
A symbol table. |
isTerminal()
is one of the most frequently used
functions of a grammar-based genetic programming algorithm.
Careful coding pays off!
Do not index the symbol table as a matrix
(e.g. ST[2,2]
), because this is really slow!
TRUE
if the numeric identifier is a terminal symbol.
FALSE
if the numeric identifier is a non-terminal symbol.
NA
if the symbol does not exist.
Other Utility Functions:
derive()
,
id2symb()
,
isNonTerminal()
,
rules()
,
symb2id()
g<-compileBNF(booleanGrammar())
isTerminal(1, g$ST)
isTerminal(2, g$ST)
isTerminal(5, g$ST)
isTerminal(12, g$ST)
isTerminal(15, g$ST)
identical(isTerminal(15, g$ST), NA)