compileBNF {xegaBNF}R Documentation

Compile a BNF (Backus-Naur Form) of a context-free grammar.

Description

compileBNF produces a context-free grammar from its specification in Backus-Naur form (BNF). Warning: No error checking is implemented.

Usage

compileBNF(g, verbose = FALSE)

Arguments

g

A character string with a BNF.

verbose

Boolean. TRUE: Show progress. Default: FALSE.

Details

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:

  1. Make the symbol table. See makeSymbolTable.

  2. Make the production table. See makeProductionTable.

  3. Extract the start symbol. See makeStartSymbol.

  4. Compile a short production table. See compileShortPT.

  5. Return the grammar.

Value

A grammar object (list) with the attributes

References

Geyer-Schulz, Andreas (1997): Fuzzy Rule-Based Expert Systems and Genetic Machine Learning, Physica, Heidelberg. (ISBN:978-3-7908-0830-X)

Examples

g<-compileBNF(booleanGrammar())
g$ST
g$PT
g$Start
g$SPT

[Package xegaBNF version 1.0.0.0 Index]