class

Crowbar::GrammarBuilder

Inherits Reference < Object

DSL builder for defining context-free grammars

Constructors

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

Instance methods

choices(name : Symbol, options : Iterable(String), weight : Float64 = 1.0)

Convenience overload for list of terminal string options (shorthand for single-token choices)

Source
grammar
Source
max_depth(val : Int32)
Source
rule(name : Symbol, tokens : Iterable(String | Symbol), weight : Float64 = 1.0)

Define a production rule with an array of tokens and optional weight

Source
rule(name : Symbol, *tokens : String | Symbol, weight : Float64 = 1.0)

Convenience overload for passing multiple string/symbol arguments

Source