compileBNF {xegaBNF} | R Documentation |
compileBNF
produces a context-free grammar
from its specification in Backus-Naur form (BNF).
Warning: No error checking is implemented.
compileBNF(g, verbose = FALSE)
g |
A character string with a BNF. |
verbose |
Boolean. TRUE: Show progress. Default: FALSE. |
A grammar consists of the symbol table ST
, the production
table PT
, the start symbol Start
,
and the short production
table SPT
.
The function performs the following steps:
Make the symbol table. See makeSymbolTable
.
Make the production table. See makeProductionTable
.
Extract the start symbol. See makeStartSymbol
.
Compile a short production table. See compileShortPT
.
Return the grammar.
A grammar object (list) with the attributes
name
(the filename of the grammar),
ST
(symbol table),
PT
(production table),
Start
(the start symbol of the grammar), and
SPT
(the short production table).
Geyer-Schulz, Andreas (1997): Fuzzy Rule-Based Expert Systems and Genetic Machine Learning, Physica, Heidelberg. (ISBN:978-3-7908-0830-X)
g<-compileBNF(booleanGrammar())
g$ST
g$PT
g$Start
g$SPT