Grammar.Native.GLR (Ichor v0.2.0)

Copy Markdown View Source

The compile-time codegen backend for @engine glr grammars: builds the SLR(1) table via Grammar.LRTable once, at Elixir-compile-time (conflicts are expected here, never rejected -- that's Grammar.Native.LR's job), and compiles the action/goto lookup into per-state generated function clauses instead of the interpreted Grammar.GLR's Map.gets.

The graph-structured stack itself (Grammar.GLR.GSS: node merging, multi-path reduce enumeration) is inherently a runtime, input-driven data structure -- it can't compile away no matter which engine drives it, so Grammar.GLR.Runtime.run/6 (already shared with the interpreted Grammar.GLR) is reused here completely unchanged, just handed &glr_action/2/&glr_goto/2 -- compiled function references -- in place of the closures-over-maps the interpreted path builds.

Summary

Functions

Generates the full quoted body (lexer + compiled GLR action/goto lookup + parse/1,2 + run/1,2) for grammar, dispatching to actions_module.

Functions

generate(grammar, actions_module)

@spec generate(Aether.Grammar.t(), module()) :: Macro.t()

Generates the full quoted body (lexer + compiled GLR action/goto lookup + parse/1,2 + run/1,2) for grammar, dispatching to actions_module.