Repository navigation
Description
core#144 split core into an IR half and a compiler half with a default compiler feature. Without it, comline-core is the IR alone: frozen units, CBOR, the format stamp, annotations and unverified. That build has no tree-sitter and builds for wasm. This issue proposes making that line a crate boundary, with comline-ir beside comline-core.
Why
- The compiler enforces the boundary, not
cfg. The line is 97#[cfg(feature = "compiler")]sites in 20 files today (23 inpackage/build/mod.rs, 14 indiagnostics.rs, 8 infrozen/types.rs). Only their_onlyCI job catches IR code that reaches for the parser. As two crates, that code doesn't compile. - Features unify across a workspace. In generation,
codegendepends on core withdefault-features = false, butconformanceuses the defaults. A workspace build turnscompileron forcodegentoo, socodegenis IR-only only when built alone (-p). A separate crate has no such leak. - A smaller contract for generators. Third-party generators read only the IR. A crate that changes when the IR format changes is a clearer dependency than all of core, especially once crates are published.
When
Updated 2026-11-16. The plan was to do this together with #268's step 1.2, so core's workspace would be rearranged once. Step 1.2 merged on 2026-11-14 (core#280) without the split: the comline-ir-formats crate is core/formats/ (publish = false, a path dependency of comline-core). So the workspace will be rearranged a second time. One consequence: cargo publish -p comline-core fails until that crate is published or the dependency made optional (noted in #280). The reasons for the split are unchanged; do it before crates.io publishing starts (cli#1, runtime#115), when a third-party generator appears, or when the feature unification above breaks a build, and move or keep comline-ir-formats beside comline-ir in the same change.
Shape
comline-ir: the modules the IR-only build has today, with module paths kept where possible.comline-core: the compiler, depending oncomline-irand re-exporting it, so downstream crates (cli, language-server, playground, runtime) keep their imports. Only a crate that wants the IR alone (generation'scodegen) switches its dependency.- The
compilerfeature goes away, or stays as a no-op for a release.
Work
-
from_grammarconstructors: inherent impls on the frozen types can only live in the crate that defines them. They become free functions, or a trait incomline-core. -
diagnostics.rs: separate the IR's diagnostic types from parse-error rendering. - The official encodings' snapshot (
official_units.json,the_snapshot_is_what_freezes) moves with the IR. - The
ir_onlyCI job becomescomline-ir's own build and wasm targets. - generation's
codegendepends oncomline-ir.
Not in scope
Splitting the compiler itself into lexer, parser, HIR and driver crates. A 2024 attempt at that (an unpublished compilers/ workspace on ungrammar and verde) never got past scaffolding and has been retired. The parser is the rust-sitter grammars, and no consumer needs stage boundaries.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
Kinflou commentedon Nov 15, 2026
Audit 2026-11-16: rewrote the 'When' paragraph (original saved in the audit notes). The plan was to split the IR crate together with #268 step 1.2, but core#280 merged on 2026-11-14 with the comline-ir-formats crate in core/formats and no split, so the workspace will be rearranged twice and comline-core can't be published until that crate is. The case for the split is unchanged.