+This isn't hypothetical: **JavaScript is the second language on the same engine**, and it shares a core with TypeScript rather than duplicating it. JavaScript is the syntactic *subset* of the ECMAScript family (TypeScript = JavaScript + a type layer), so [`examples/javascript.ts`](examples/javascript.ts) is the standalone base that **owns and exports** the shared vocabulary — the token set, the operator-precedence ladder, the base scope map, and the reserved-word guards — and [`examples/typescript.ts`](examples/typescript.ts) *imports* that vocabulary and extends it with the type layer (type rules + the extra type scopes). The dependency runs subset → superset only; the JS grammar has no type knowledge and depends on nothing but the engine's combinator API. (The rules themselves are copied-and-stripped rather than shared, because combinator rules bind their references at definition time; only the vocabulary layer is imported.) JavaScript parses real-world JS — [`test/js-conformance.ts`](test/js-conformance.ts) accepts 61/61 curated valid-JS snippets and rejects TypeScript-only syntax (type annotations, `enum`, `!`, `<T>` casts), with ground truth being `tsc`'s own parser in JS mode. It does not yet have TypeScript's conformance- and coverage-level validation, but it already proves the claim below that a second language is *one grammar file on an unchanged engine*.
0 commit comments