class

Crowbar::GrammarDefinition

Inherits Reference < Object

Context-free generative grammar engine with bounded recursion depth.

Constructors

new(name : String, max_depth : Int32 = 8)
Source

Instance methods

add_production(rule_name : Symbol, tokens : Iterable(String | Symbol), weight : Float64 = 1.0)

Adds a production for a non-terminal rule

Source
generate(start_symbol : Symbol = :start, prng : PRNG = PRNG.new) : String

Generates a string starting from start_symbol

Source
max_depth
Source
max_depth=(max_depth : Int32)
Source
name
Source
rules
Source

Nested types