← Lab
patternanchor
mixedcertificateC++ · CPUInference & servingJuly 13, 2026
the question
Does llama.cpp's JSON-Schema pattern-to-GBNF converter realize the spec's unanchored ECMA-262 semantics, or does it silently impose whole-string fullmatch?
what came out
Neither. Every unanchored pattern, the spec's normal case, throws 'Pattern must start with ^ and end with $' and emits no grammar, refuting the pre-registered fullmatch prediction. Anchored ^p$ patterns are sound and complete: over 65,532 membership checks the GBNF acceptor matches std::regex_match with zero mismatches.
method & receipts
- Result: mixed
- Pre-registered — the prediction was written down and committed before the run.
- Reproducible — one script re-runs the whole thing from scratch.
- Tested — a correctness/benchmark suite ships alongside the code.
→ read the code and re-run it
github.com/v-code01/patternanchor