Skip to content

DSL reference

APIPurpose
rule(pattern, skip: false, emit: nil, followed_by: nil)Register a matching rule and action
use(rule_set)Insert rules from a module extended with Flexr::Rules
on_eofDefine end-of-input behavior
emits(*kinds)Declare token kinds for diagnostics and parser integration
state(name)Define a named start condition
all_statesApply a rule to every state
backend(name)Choose longest-match table, direct, or auto, or rule-order firstmatch
token_kind(name)Choose the token return shape
encoding(name)Select the input encoding contract
option(name)Enable an explicit compiler option
accel(name)Configure acceleration where compatible

The default backends use longest-match semantics; firstmatch selects the first matching rule. The repository’s DSL reference includes option defaults and examples.