Buddy Code
Create account ↗
All tools
Free to use · No sign-up

ABNF grammar test bench

Run reusable pass/fail sample suites against an ABNF grammar, with failure offsets and successful rule spans.

Test whole strings against ABNF with core rules, groups, repetition, incremental alternatives and RFC 7405 case-sensitive literals. Recursive and left-recursive grammars are recognized within a bounded search. Prose values need explicit replacement rules.

Use JSON escapes for CRLF, tabs or empty strings. Up to 50 samples, 2,048 code points each and 20,000 characters total. A budget error means no verdict, not a failed match.

What it does

Run reusable pass/fail sample suites against an ABNF grammar, with failure offsets and successful rule spans.

How to use it

  1. Paste ABNF, choose a start rule and supply a JSON array of input strings and expected match booleans.
  2. Run the suite, inspect diagnostics and export the results or a reloadable fixture bundle. Core rules and RFC 7405 strings are supported.
  3. Processing stays in a bounded local worker. No generated code, external grammar resolution or upload.

Example

The command grammar accepts "GET /docs/start\r\n" and rejects lowercase "get" because the method uses a case-sensitive %s literal.

Methodology

ABNF is compiled into a bounded context-free grammar and recognized with an Earley chart, supporting recursion, alternatives, repetition and nullable rules. Core rules follow RFC 5234; %s/%i follow RFC 7405. Diagnostics show farthest reachable code-point offset and expected terminals; a match includes one derivation, not every ambiguous parse.

Limitations

50,000 grammar characters, 500 definitions, nesting 30, explicit repeat bounds 256, 5,000 productions. Up to 50 samples / 2,048 code points each / 20,000 characters total; 100,000 states per sample, five million operations per batch and 30 seconds. Prose values need explicit replacement rules. Input is Unicode code points, not encoded bytes. LF/CRLF and indented definitions are accepted. No protocol conformance certification or remote grammar loading.

Automation

This tool runs in your browser. No upload API or MCP endpoint is available.

View capabilities and documentation

Reference updated

Join the conversation

Helpful tips, questions, and ideas for making this tool better.

Loading discussion…