class
Crowbar::GrammarDefinition
- Crowbar::GrammarDefinition
- Reference
- Object
Overview
Context-free generative grammar engine with bounded recursion depth.
Defined in:
crowbar/dsl/grammar_builder.crConstructors
Instance Method Summary
-
#add_production(rule_name : Symbol, tokens : Iterable(String | Symbol), weight : Float64 = 1.0)
Adds a production for a non-terminal rule
-
#generate(start_symbol : Symbol = :start, prng : PRNG = PRNG.new) : String
Generates a string starting from start_symbol
- #max_depth : Int32
- #max_depth=(max_depth : Int32)
- #name : String
- #rules : Hash(Symbol, Array(Production))
Constructor Detail
Instance Method Detail
def add_production(rule_name : Symbol, tokens : Iterable(String | Symbol), weight : Float64 = 1.0)
#
Adds a production for a non-terminal rule
Generates a string starting from start_symbol