Compile a Backus-Naur Form Specification into an R Grammar Object

Translates a BNF (Backus-Naur Form) specification of a context-free language into an R grammar object which consists of the start symbol, the symbol table, the production table, and a short production table. The short production table is non-recursive. The grammar object contains the file name from which it was generated (without a path). In addition, it provides functions to determine the type of a symbol (isTerminal() and isNonterminal()) and functions to access the production table (rules() and derives()). For the BNF specification, see Backus, John et al. (1962) "Revised Report on the Algorithmic Language ALGOL 60". (ALGOL60 standards page < http://www.algol60.org/2standards.htm>, html-edition < https://www.masswerk.at/algol60/report.htm>) A preprocessor for macros which expand to standard BNF is included. The grammar compiler is an extension of the APL2 implementation in Geyer-Schulz, Andreas (1997, ISBN:978-3-7908-0830-X).


# The R script xegaBNF.R

The directory xegaBNF contains the implementation 
of the grammar compiler which translates a file 
with the BNF of a grammar into the internal
representation of the grammar.

The easiest installation is by using install.packages from R.

1. Linux:
Start R in the directory where you have stored xegaBNF_0.0.0.1.tar.gz

> install.packages("xegaBNF_0.0.0.1.tar.gz")

1. Windows:
Start R in the directory where you have stored xegaBNF_0.0.0.1.zip



The R script xegaBNF.R generates

1. the man pages of the package.
2. the pdf documentation of the package.
3. the compilation and installation of the package.
   (You  must adapt the variables path and pName
    in the script xegaBNF.R:

    path<-"~/dev/iaa/genetic/xega/"
    pName<-"xegaBNF"

    to the directory where you copy the package.

You need to install the R-package devtools for this R script.

There are two ways to use the code:

1. Change into the R directory which contains the code, start R and load all code files:

source("xegaBNF.R")

Note that the package xegaBNF provides the functions
of the grammar compiler needed 
for the option "sgp" of the algorithm sga of the family sgX.

Use the pdf-Manual! 

2. Adapt the path in xegaBNF.R and install the library xegaBNF:

Rscript xegaBNF.R

Restart R and

library(xegaBNF)

You get all elements of the package by

xegaBNF::

and pressing the tabulator.

You get the man page by e.g 

?booleanGrammar()

or 

help(booleanGrammar)

All examples given on a man page can be executed by

example(booleanGrammar)

Note that man pages and examples are only available, if you install 
the package as a library.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("xegaBNF")

1.0.0.5 by Andreas Geyer-Schulz, 2 years ago


https://github.com/ageyerschulz/xegaBNF


Browse source code at https://github.com/cran/xegaBNF


Authors: Andreas Geyer-Schulz [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Suggests testthat


Imported by xega, xegaDerivationTrees, xegaGeGene, xegaGpGene.


See at CRAN