| isNonTerminal {xegaBNF} | R Documentation |
Is the numeric identifier a non-terminal symbol?
Description
isNonTerminal() tests if the numeric identifier
is a non-terminal symbol.
Usage
isNonTerminal(Id, ST)
Arguments
Id |
A numeric identifier (integer). |
ST |
A symbol table. |
Details
isNonTerminal() 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(),
isTerminal(),
rules(),
symb2id()
Examples
g<-compileBNF(booleanGrammar())
isNonTerminal(1, g$ST)
isNonTerminal(2, g$ST)
isNonTerminal(5, g$ST)
isNonTerminal(12, g$ST)
isNonTerminal(15, g$ST)
identical(isNonTerminal(15, g$ST), NA)
[Package xegaBNF version 1.0.0.0 Index]