Skip to content

Commit 48556a3

Browse files
committed
README: update conformance to 97.8% bidirectional (3585/3664)
Reflects this session's over-accept work (FP 120->79 across 8 classes): bidirectional 96.7%->97.8%, grammar 537->628 lines. Also frame the remaining gap honestly — most of it is code TypeScript parses cleanly and only rejects with a *semantic* error, which a context-free grammar isn't meant to catch (the practical grammar-only ceiling).
1 parent 37fc78f commit 48556a3

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A TextMate grammar is a pile of regexes guessing at a language's structure. It's
1010

1111
Monogram inverts the dependency:
1212

13-
1. **Write the grammar, then prove it.** The grammar is executable. Monogram runs it as a recursive-descent + Pratt parser over the TypeScript conformance suite and measures conformance *bidirectionally* — it must accept what `tsc` accepts **and** reject what `tsc` rejects. Today it parses **100% of valid single-file cases** (3376 / 3376 — zero valid-code gaps) and agrees with `tsc` **bidirectionally on 96.7%** (3544 / 3664); the remaining gap is *over-acceptance* (the grammar is still too permissive on some invalid inputs), and the goal is 100% both ways — a *verified, complete model* of the language's syntax, not an approximation.
13+
1. **Write the grammar, then prove it.** The grammar is executable. Monogram runs it as a recursive-descent + Pratt parser over the TypeScript conformance suite and measures conformance *bidirectionally* — it must accept what `tsc` accepts **and** reject what `tsc` rejects. Today it parses **100% of valid single-file cases** (3376 / 3376 — zero valid-code gaps) and agrees with `tsc` **bidirectionally on 97.8%** (3585 / 3664); the remaining gap is *over-acceptance* (the grammar is still too permissive on some invalid inputs — and most of what's left is code TypeScript itself parses cleanly and only rejects later with a *semantic* error, which a context-free grammar is not meant to catch), and the goal is to push as close to 100% both ways as a pure grammar can — a *verified, complete model* of the language's syntax, not an approximation.
1414

1515
2. **Derive the highlighter from the proven grammar.** The TextMate grammar is generated from that same parser-validated grammar — never hand-written. Its correctness is underwritten by the parser conformance run, not by regex tuning.
1616

@@ -34,11 +34,11 @@ And — from the same grammar — first-pass generators for the rest of the edit
3434

3535
## Results
3636

37-
Validated on TypeScript (grammar: [`examples/typescript.ts`](examples/typescript.ts), 537 lines):
37+
Validated on TypeScript (grammar: [`examples/typescript.ts`](examples/typescript.ts), 628 lines):
3838

3939
```
4040
Valid-code coverage 100% 3376 / 3376 valid single-file conformance cases parse (zero gaps)
41-
Bidirectional 96.7% 3544 / 3664 — also rejects what tsc rejects (goal: 100%, gap = over-acceptance)
41+
Bidirectional 97.8% 3585 / 3664 — also rejects what tsc rejects (gap = over-acceptance; most is TS semantic-only rejection)
4242
Highlighter 99.3% 589 / 593 tokens match VS Code's official grammar
4343
Generated grammar 42 KB vs the official hand-written 226 KB
4444
Engine language-agnostic — no TypeScript-specific code
@@ -185,4 +185,4 @@ Every highlighter target (TextMate, tree-sitter queries, Lezer styleTags, Monarc
185185
| ANTLR | yes |||
186186
| Langium | yes | Monarch (separate) ||
187187
| ungrammar | AST types |||
188-
| **Monogram** | **CST (100% valid / 96.7% bidir)** | **auto-derived (99.3%)** | **yes** |
188+
| **Monogram** | **CST (100% valid / 97.8% bidir)** | **auto-derived (99.3%)** | **yes** |

0 commit comments

Comments
 (0)