generate_code | R Documentation |
Generate code from a BNF specification
generate_code( bnf_spec, bnf_rule = bnf_spec[[1]], lambda0p = 1, lambda1p = 1, zero_prob = 0.5, state = list(depth = 1L) )
bnf_spec |
A full BNF grammar specification |
bnf_rule |
A single rule from the bnf_spec to be used as the starting
node for code generation. By default this is the first element in the
|
lambda0p |
When an item is to be repeated "zero or more" times, the actual
number of repetitions is drawn from a poisson distribution with
mean = |
lambda1p |
When an item is to be repeated "one or more" times, the actual
number of repetitions is drawn from a poisson distribution with
mean = |
zero_prob |
When an item is to be repeated "zero or one" times, the actual number of repetitions is randomly selected. This value sets the probability of 0 repetitions. Default: 0.5 |
state |
a list of state information. Should not be set by user (unless they really want to) |
Code generated from the given BNF
## Not run: generate_code(bnf_spec = bnf_spec) generate_code(bnf_spec = bnf_spec, bnf_rule = bnf_spec[[1]]) generate_code(bnf_spec = bnf_spec, bnf_fule = 'Expr') ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.