| isTerminal {xegaBNF} | R Documentation |
Is the numeric identifier a terminal symbol?
Description
isTerminal() tests if the numeric identifier
is a terminal symbol.
Usage
isTerminal(Id, ST)
Arguments
Id |
A numeric identifier (integer). |
ST |
A symbol table. |
Details
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!
Value
-
TRUEif the numeric identifier is a terminal symbol. -
FALSEif the numeric identifier is a non-terminal symbol. -
NAif the symbol does not exist.
See Also
Other Utility Functions:
derive(),
id2symb(),
isNonTerminal(),
rules(),
symb2id()
Examples
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)
[Package xegaBNF version 1.0.0.0 Index]