ion7-grammar

Grammar engine for LuaJIT - GBNF, ABNF, EBNF, JSON Schema, regex

$ luarocks install ion7-grammar

Compile regex, ABNF (RFC 5234), W3C-style EBNF, JSON Schema, or Lua type annotations to GBNF, then constrain LLMs to valid output by construction.

Includes a stateful GrammarContext, a per-seq KV-rollback Backtrack runtime (IterGen / CRANE), DCCD (Draft-Conditioned Constrained Decoding, arXiv:2603.03305), a pure-Lua fuzzer, and grammar diff / inspect / tree helpers.

Multi-tenant safe : Backtrack and DCCD operate on a single seq id so they drop into ion7-llm's Pool without disturbing other sessions.

Versions

0.2.0beta1-217 days ago4 downloads
0.2.0beta1-117 days ago7 downloads

Dependencies

ion7-core >= 0.1.0beta4
LPeg >= 1.0
lua >= 5.1

Labels

Manifests