# NOT RUN {
# Define a simple grammar
# <expr> ::= <var><op><var>
# <op> ::= + | - | *
# <var> ::= A | B
ruleDef <- list(expr = gsrule("<var><op><var>"),
op = gsrule("+", "-", "*"),
var = gsrule("A", "B"))
# Create a grammar object
grammarDef <- CreateGrammar(ruleDef)
# summarize grammar object
summary(grammarDef)
# }
Run the code above in your browser using DataLab