[Roadmap] Core port to Rust after spec freeze #338

Open
opened 2026-12-01 17:23:07 +01:00 by abiwab · 0 comments
Owner

A question that comes up fairly often is why Gram is written in TypeScript instead of Rust or Go.

For now, staying in TypeScript is a deliberate choice. The language syntax and compiled output are still settling, so keeping a single implementation avoids having to maintain every change twice. It also lets the full compiler run directly in the browser playground (~30 KB gzipped with Ohm.js, which is smaller than a WASM build).

That said, I do plan to port the core pipeline (parser, kitchen, analyzer, i18n) to Rust for v2.0, once the spec and JSON output have been stable for a few months without breaking changes.

A couple of pieces are already in place so that the port won't be a rewrite from scratch:

  • The conformance test suite (conformance/), which checks expected JSON outputs independently of the implementation language.
  • tree-sitter-gram for editor highlighting outside of Ohm.js.
  • The upcoming v1.7 work on cleaner JSON token types and a JSON Schema, which will act as the reference contract for the Rust types.

When the switch happens, the goal is to keep the npm packages and JSON outputs compatible for anyone building on top of Gram. Feel free to drop thoughts or questions here.

A question that comes up fairly often is why Gram is written in TypeScript instead of Rust or Go. For now, staying in TypeScript is a deliberate choice. The language syntax and compiled output are still settling, so keeping a single implementation avoids having to maintain every change twice. It also lets the full compiler run directly in the browser playground (~30 KB gzipped with Ohm.js, which is smaller than a WASM build). That said, I do plan to port the core pipeline (`parser`, `kitchen`, `analyzer`, `i18n`) to Rust for v2.0, once the spec and JSON output have been stable for a few months without breaking changes. A couple of pieces are already in place so that the port won't be a rewrite from scratch: - The conformance test suite (`conformance/`), which checks expected JSON outputs independently of the implementation language. - `tree-sitter-gram` for editor highlighting outside of Ohm.js. - The upcoming `v1.7` work on cleaner JSON token types and a JSON Schema, which will act as the reference contract for the Rust types. When the switch happens, the goal is to keep the npm packages and JSON outputs compatible for anyone building on top of Gram. Feel free to drop thoughts or questions here.
abiwab added this to the v2.0 milestone 2026-12-01 17:23:07 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gram-lang/gram#338
No description provided.