View Source Grammar.RulesChecker (Grammar v0.4.0)
This module exports functions to check the correctness of the grammar rules.
Summary
Functions
Check if all rules exist in the grammar, i.e. a rule referred to in a substitution list is actually defined.
Check if the rules are non-left-recursive.
Check if the rules are not ambiguous, i.e. a given token drives only to one reduction.
Express an error returned by a checker function in a human-readable form.
Types
Functions
Check if all rules exist in the grammar, i.e. a rule referred to in a substitution list is actually defined.
Check if the rules are non-left-recursive.
@spec check_rules_are_not_ambiguous(Grammar.t()) :: :ok | {:error, :ambiguities_found, [String.t()]}
Check if the rules are not ambiguous, i.e. a given token drives only to one reduction.
@spec stringify_error(:missing_rules, [miss()]) :: String.t()
@spec stringify_error(:cycles_found, [path()]) :: String.t()
@spec stringify_error(:ambiguities_found, [ambiguity()]) :: String.t()
Express an error returned by a checker function in a human-readable form.