class
Crowbar::GrammarBuilder
- Crowbar::GrammarBuilder
- Reference
- Object
Overview
DSL builder for defining context-free grammars
Defined in:
crowbar/dsl/grammar_builder.crConstructors
Instance Method Summary
-
#choices(name : Symbol, options : Iterable(String), weight : Float64 = 1.0)
Convenience overload for list of terminal string options (shorthand for single-token choices)
- #grammar : GrammarDefinition
- #max_depth(val : Int32)
-
#rule(name : Symbol, tokens : Iterable(String | Symbol), weight : Float64 = 1.0)
Define a production rule with an array of tokens and optional weight
-
#rule(name : Symbol, *tokens : String | Symbol, weight : Float64 = 1.0)
Convenience overload for passing multiple string/symbol arguments
Constructor Detail
Instance Method Detail
def choices(name : Symbol, options : Iterable(String), weight : Float64 = 1.0)
#
Convenience overload for list of terminal string options (shorthand for single-token choices)
def rule(name : Symbol, tokens : Iterable(String | Symbol), weight : Float64 = 1.0)
#
Define a production rule with an array of tokens and optional weight
def rule(name : Symbol, *tokens : String | Symbol, weight : Float64 = 1.0)
#
Convenience overload for passing multiple string/symbol arguments