preBNF {xegaBNF}R Documentation

BNF preprocessing.

Description

The BNF preprocessor executes macros (R-code embedded in a BNF grammar definition) and replaces the macros by the output they produce.

Usage

preBNF(BNFfn, genv = NULL)

Arguments

BNFfn

A constant function which returns a BNF.

genv

The list of bindings needed by the macros in the R-code.

Details

The embedded R-code starts with " //R//" and ends with "" //R//". The preprocessor accepts a binding list which binds R objects their values. The macros are evaluated in an environment with these bindings. The output of each macro is inserted into the grammar file. It is expected that after preprocessing, the grammar file is in the BNF-notation. For example, generic grammar files can be provided for which the number of symbols of a certain type (e.g. variables) can be specified by the bindings.

Value

A list with elements filename and BNF

See Also

Other Grammar Preprocessor: evenMacro(), existsMacro(), pastePart()

Examples

a<-preBNF(booleanGrammar)
b<-preBNF(booleanGrammarK, list(k=5))


[Package xegaBNF version 1.0.0.5 Index]