Common, versioned IR
Normalize Yacc, BNF, ANTLR4, Menhir, and PEG grammars at a JSON-Schema-backed boundary.
Common, versioned Grammar IR and deterministic structural features for parser grammars — without executing semantic actions.
value
: object
| array
| STRING
| NUMBER
;
object
: '{' members? '}'
;Gramin separates format-specific parsing from format-independent analysis, so the same contract powers exploration, review, CI, and custom tooling.
Find large rules, recursion, unresolved symbols, unreachable rules, and the diagnostics that deserve attention.
Understand the analysis →Compare before and after features without pretending that every metric is comparable across representations.
Learn about metric classes →Use a baseline, regression policy, and SARIF output to bring structural review into GitHub Actions.
Add it to CI →Use the IR schema and external frontend protocol as a stable boundary for your own grammar tooling.
Connect a frontend →Support is intentionally format-aware. See the matrix for dialects, capabilities, and lossy cases before interpreting a result.
| Format family | Frontend ID | Files | Main strengths | Important boundary |
|---|---|---|---|---|
| Yacc / Bison / Lrama | yacc-family | Single | Precedence, actions, named references | Recovery can be lossy |
| BNF / EBNF | bnf | Single | Grouping, choice, repetition | First file only |
| ANTLR4 | antlr4 | Multi-file | Parser/lexer grammar, EBNF, imports | Target code is lossy |
| Menhir | menhir | Single | Classic rules, inline, parameterized symbols | Some attributes are unsupported |
| Peggy / PEG.js | peggy | Single | Ordered choice, predicates, scannerless | Actions are not retained |
The same JSON language can have different structural measurements when written in Yacc, ANTLR4, or Peggy. Gramin makes that context visible instead of hiding it behind one complexity score.
| Metric | Class | Yacc | ANTLR4 | Peggy |
|---|---|---|---|---|
Rules | A | 7 | 5 | 10 |
Alternatives | A | 17 | 11 | 16 |
Reachable rules | A | 7 | 5 | 8 |
Recursive rules | B | 6 | 4 | 4 |
Nullable rules | B | 0 | 0 | N/A |
Browser sandbox analysis stays local. Semantic actions and target code are never executed or retained as IR. Unsupported or lossy syntax is reported as diagnostics, and not-applicable metrics are not shown as fake zeroes.
No. It analyzes grammar structure; it does not generate a parser or prove language-level correctness.
Yes, with context. Class A metrics are designed for cross-format comparison, while Class B and C metrics require capability or representation context.
No. The browser sandbox runs the parser frontend and analyzer in a Web Worker without sending grammar contents to a server.
The sandbox only creates a bounded, copyable digest. It does not call an LLM service or send your grammar anywhere.