A modular, fromβscratch compiler for a Rustβlike systems programming language, written in Rust.
Implements a complete compilation pipeline: lexing, parsing, name resolution, HIR, MIR, type inference & trait solving, borrow checking, optimizations, and multiple code generation backends (LLVM and a custom bytecode VM). The project is organised as a Cargo workspace with 39 members β 34 compiler/stdlib crates plus 5 tooling crates β designed for clarity, testability, and incremental development.
Note
Glyim is a research-grade compiler under active development. The pipeline is end-to-end functional for a substantial subset of the language, and the test harness verifies every stage from lexing through MIR interpretation. See Project Status for what's wired up today versus what's still on the roadmap.
- Why Glyim
- Features
- Architecture
- Getting Started
- Usage
- Language Tour
- The
glyipBuild Tool - Development
- Testing
- Project Status
- Acknowledgements
Most "toy compiler" projects stop at a parser or a tree-walking interpreter. Glyim is built to be a real compiler: it has a full type system with inference and trait solving, an NLL borrow checker, monomorphization, a MIR optimizer, and a production LLVM backend via inkwell. Every stage is a self-contained crate with a narrow public API, so each phase can be studied and tested in isolation β and replaced without touching the rest.
The design is heavily inspired by rustc's architecture (arena-allocated IRs, interned types, query-style contexts, trait-based dependency injection), but written from scratch with a strong emphasis on readable code and testability.
- Rust-like syntax with
fn,let,struct,enum,match,if/else,while,loop,for, closures,implblocks, and traits. - Generics with type parameters, generic bounds (
T: Trait), and where-clauses. - Traits with default methods, associated types, and static dispatch.
- Pattern matching with literals, ranges, or-patterns, slices, structs, tuples, enums, and
ifguards. async/awaitwith state-machine desugaring (straight-line, multi-await, and loop bodies:.awaitinsidewhile,for i in a..b, and unboundedloopbodies suspends and resumes through a realStart/S0/Donemachine, with depth-0break [v]/continuetranslated to the machine's own transitions).- Closures with capture analysis (
ByValue/ByRef(Mut)/ByRef(Not)). - Macros: declarative
macro_rules!with fragment specifiers (:expr,:ty,:pat,:tt, β¦), plus built-infile!,line!,column!,env!,option_env!,include!,include_str!,include_bytes!,concat!,concat_idents!,stringify!,format!,vec!,matches!,assert!,assert_eq!,assert_ne!,debug_assert!,debug_assert_eq!,debug_assert_ne!,write!,writeln!; the stdlib additionally definesprintln!/print!/eprintln!/eprint!/panic!as declarative macros. - Procedural macros through a C-compatible token-stream ABI (
glyim-proc-macro), with adlopen-based cdylib loader. - Ranges,
Option/Result/Vec/String/Box/PhantomData/UnsafeCellas compiler-known builtins. - GSX view syntax: first-class, typed, host-agnostic view elements (
<button on:click={β¦}>β¦</button>) with a dedicated compiler stage β View IR, flat-u32blueprints, ownership-driven reactivity (mutation-specialized patches, no vdom/signals on the fast path), SSR emitter and a headless test host. Seedocs/design/GSX-in-Glyim.mdanddocs/design/gsx-implementation.md.
- Non-lexical lifetime (NLL) borrow checking with Polonius-style region inference, cross-block liveness analysis, and two-phase borrow support.
- Move analysis with partial-move tracking and drop-flag elaboration.
- Type inference with unification variables (general / integer / float), occurs-check, and bidirectional checking.
- Trait solving via a fulfillment context with obligation queues, HRTB support (
for<'a>), and auto-trait computation (Send/Sync/Unpin). - Monomorphization with polymorphization (unused generic params β canonical placeholder) and codegen-unit partitioning.
- MIR optimizations: constant propagation, dead code elimination, CFG simplification, unreachable block elimination, slice desugaring, and drop elaboration.
- Layout computation with ABI-aware argument passing (
sret,byval,Ignore,Direct,Split). - VTable generation for trait objects.
- MIR interpreter used for
const fnevaluation and test execution. - Incremental compilation via SHA-256 fingerprinting of sources and build configuration.
- LLVM backend (
glyim-codegen-llvm) usinginkwell/LLVM 23 β produces native object files with real ABI lowering, debug info, exception handling (Itanium + SEH), and Link-Time Optimization (fat/thin). - Bytecode backend (
glyim-codegen) β a compact stack-machine bytecode used for testing and embedded execution, verified by theglyim-bytecode-vmcrate; the emitter can assemble whole multi-function modules into the versioned, loadableglyim.module-image/1container (generate_module_image), which the VM validates and runs after a round trip. The VM executes the full emitted surface: IEEE-754 float arithmetic overOP_LOAD_CONST_F64constants, the interpreter's width-aware cast semantics (OP_CASTcarries kind + target primitive), and string constants through the image's string pool (OP_LOAD_CONST_STRcompares by content). Two observability/safety seams complete the picture: an execution-trace hook (glyim_bytecode_vm::traceβ aTraceSinkthe VM hands one step per dispatch to, with a capturing collector, atracing-event sink, and a deterministicrender_tracelisting) and a fuel budget (Vm::with_fuelβ an infinite loop in a loaded artifact stops with the explicitVmError::FuelExhaustedinstead of hanging the host).
glyimCLI β compile with--emit=obj|exec|mir|llvm-ir|asm|cdylib|syntax|stats|run, choose a backend, set opt-level, target triple, LTO strategy, and codegen units; measure compiles with--time-passesand--self-profile[=FILE](Chrome trace), and emit a schema-versioned JSON measurement report with--emit=stats.glyipbuild tool β Cargo-like project manager withnew,build,test, andrun; dependency resolution with SemVer 2.0 matching, path deps, git deps (branch/tag/rev), lockfiles, and a registry client.- Language Server (
glyim-lsp) β diagnostics (pushed; pulled per file, with related documents over the dependency graph; and pulled per workspace on demand), goto definition, goto type definition, goto declaration, goto implementation, hover, completion, find references, folding, formatting, range formatting (textDocument/rangeFormattingre-indents the whole lines a selection claims at the depth the unselected prefix leaves, through the same formatter core the full request reads), on-type formatting (a just-typed closing bracket dedents to its matching opener's indentation), rename (withprepareRename), workspace symbols, document symbols, document highlight, selection ranges, semantic tokens, call hierarchy (incoming/outgoing calls), type hierarchy (prepare a trait/struct/enum item and walk the traits implemented for it or the impls that implement it, over the recorded impl facts), signature help, inlay hints, code actions (add missing match arms, generate impl, remove unused imports), auto-import, code lenses (item-level definitions enumeratetextDocument/codeLens, resolved with the live reference count, executable throughworkspace/executeCommand), document links (include-macro literals link to the files they name), linked editing ranges (same-scope occurrences edit together), monikers (textDocument/monikeranswers the recorded identity of the cursor's symbol β the spelled use-path it sits on, the qualified module path of the definition it sits on, or the name-only resolution of a bare usage), inline values (textDocument/inlineValueanswers the recordedletbindings of a requested range as variable lookups, for a debug adapter's inline rendering), save-time format edits (textDocument/willSaveWaitUntilanswers the edits that bring the stored text to the shared formatter core's saved form β one edit over the changed region, never churn on an already-formatted document β so format-on-save composes with the same formatter the other shapes read), watched files (workspace/didChangeWatchedFilesrefreshes what no editor ever opened: a non-open file's change on disk re-analyses from the file's content and the driver's dependent refresh follows, a deletion is forgotten), file operations (workspace/didCreateFilesindexes a created file no editor owns from disk,workspace/didDeleteFilesforgets a deleted one β the watched-files ownership rules over the client's declared operations), file renames (workspace/didRenameFilesre-points the session's path-keyed state β an editor-owned document re-keys in place so every fact keyed by its file id survives, a watched load follows the watched-files honest refresh from the new path, and the dependency graph's edges move with the file), workspace folders (workspace.workspaceFoldersis served: the client's initialize folder set β the deprecatedrootUrias the fallback β seeds the session's folder store,workspace/didChangeWorkspaceFoldersre-derives it, and the folder queries answer which recorded folders contain a path; a folder whose URI does not resolve to a file path is skipped, never invented), document color (textDocument/documentColoranswers every string literal that spells a hex color payload β#RGB,#RGBA,#RRGGBB,#RRGGBBAAβ as the swatch site an editor renders inline, andtextDocument/colorPresentationanswers the picker's recolor echo with the canonical lowercase hex spelling over the reported extent; one notation, one presentation), and an optional--log-filethat tees the server's tracing events to a JSON-lines file. - Test harness (
glyim-test) β compile-pass / compile-fail / UI / run-pass / run-fail modes with inline annotations (//~ ERROR,//~| β¦), snapshot testing (CST, def-map, MIR), mocking utilities for every compiler phase, and property-based type generation.
The compiler is split into small, single-responsibility crates. Each phase consumes the previous phase's IR and exposes a minimal trait-based interface so tests can substitute mocks.
| Crate | Description |
|---|---|
glyim-core |
Foundation types: index vectors, definition IDs, interner, paths, ABI constants. |
glyim-span |
Source locations (file, byte index, span), hygiene contexts, multispan diagnostics. |
glyim-diag |
Diagnostic types, error codes, DiagSink, miette integration. |
glyim-vfs |
Virtual file system with in-memory file content tracking. |
glyim-syntax |
CST definition (Rowan-based), SyntaxKind enum, AST node helpers. |
glyim-frontend |
Lexer + parser (merged), produces SyntaxNode. |
glyim-gsx |
GSX view syntax: parser, View IR (VIR), flat-u32 blueprints, ownership-driven reactivity analysis, SSR emitter, headless test host. |
glyim-def-map |
Module graph, item scopes, name resolution. |
glyim-meta |
Macro expansion: macro_rules! declarative macros and built-in macros. |
glyim-proc-macro |
C-compatible proc-macro ABI, registry, and dlopen loader. |
glyim-hir |
High-level IR (untyped), lowering from CST. |
glyim-type |
Type interning (TyCtx), type kinds, substitutions, regions, predicates, auto-traits, object safety, layout hints, printing. |
glyim-solve |
InferenceTable, unification, trait solver, fulfillment context, HRTB. |
glyim-typeck |
Type checker: HIR β THIR with inference and trait resolution. |
glyim-const-eval |
Constant expression evaluator over HIR. |
glyim-mir |
Mid-level IR (CFG), place types, statement/terminator kinds. |
glyim-lower |
THIR β MIR lowering + monomorphization + CGU partitioning + polymorphization. |
glyim-borrowck |
Borrow checker (NLL, two-phase borrows, move analysis). |
glyim-opt |
MIR optimisation passes. |
glyim-mir-interp |
Interpreter for MIR (used in tests and const-eval). |
glyim-layout |
Type layout computation (size, alignment, ABI, vtables). |
glyim-codegen |
Abstract code generation backend trait + bytecode backend. |
glyim-codegen-llvm |
LLVM backend (via inkwell) with full ABI handling and LTO. |
glyim-bytecode-vm |
Switch-dispatch VM executing the bytecode backend's output (IEEE-754 floats, width-aware casts, pooled string constants), plus the module-image container (encode_module/decode_module) that ships it across process boundaries, its disassembler (render_module/render_function: the deterministic, total instruction listing for a decoded artifact β unknown bytes list as unknown(0xNN), truncated payloads as <truncated>), the execution-trace seam (TraceSink/TraceCollector/render_trace: one step per dispatch over the executed path), and the fuel budget (Vm::with_fuel β VmError::FuelExhausted). |
glyim-runtime |
Runtime FFI: alloc, dealloc, drop glue, panic, fs/net/thread/time/process. |
glyim-db |
Compilation database: interners, VFS, type context, trait context. |
glyim-pipeline |
End-to-end compilation driver (lex β parse β def-map β HIR β typeck β lower β borrowck β opt β codegen). |
glyim-cli |
Command-line interface (clap) and linker driver. |
glyim-lsp |
Language Server Protocol implementation. |
glyim-test |
Testing framework: discovery, execution, snapshots, mocks, property testing. |
glyim-lang-core |
Core library source (.g files): Option, Result, iter, slice, str, cell, mem, ptr, ops, cmp, marker, panic, hint, convert, default, future, parse. |
glyim-lang-alloc |
Alloc library source: Box, Vec, String, Rc, RawVec, plus the shared alloc module. |
glyim-lang-std |
Standard library source: io, fs, net, thread, sync, env, time, process, task, plus integer/string formatting (int_str). |
glyip |
Package manager / build tool. |
tools/glyim-metrics |
Repo-health metrics (code lines, tests, doc coverage, inline-allow count) behind the CI metrics ratchet. |
tools/glyim-pilot |
Agent orchestrator with gate bundles (clippy, fmt, contracts, coverage, mutation, ledger). |
tools/ledger-schema |
deny_unknown_fields schemas shared by the readiness ledger and inventory extractors. |
tools/glyim-ledger |
Readiness-ledger CLI: check, gaps, gaps audit, gaps unwitness, gaps open, gaps witness, gaps retire, next, explain, compute, status, diff, gates, verify, render-gaps, evidence record, evidence check, evidence audit, evidence retract, waivers, waivers grant, waivers revoke, waivers extend, waivers prune, handoff, release-check, inventory, inventory ignore, inventory unignore, schema β registry consistency gates run in CI; next renders the plan Β§3.9 deterministic work queue (glyim.ledger-next/1 JSON) for agent consumers and explain resolves one registry ID against it; compute runs the plan M1.8 level engine β a pure function of the registry, glyim.evidence/1 records, and ledger/policy.toml (glyim.ledger-compute/1 JSON with --format json; --snapshot PATH persists the glyim.ledger-snapshot/1 document); status renders the computed status as the marker-delimited Markdown block or the glyim.status/1 JSON contract β --out PATH writes the rendered document (default STATUS.md / STATUS.json by face) and --check byte-compares the committed document against the computed status, the plan M1.10 "STATUS is up to date" gate; diff is the plan M1.10 readiness-regression gate between two snapshots β regressions block unless an unexpired ledger/waivers.toml waiver covers them (constitution C9); gates is the plan M1.12 release-gate report β every RG-NN gate declared in ledger/gates.toml with the pass/fail/unmeasured verdict the current evidence supports (unmeasured is displayed, never silently passed; glyim.ledger-gates/1 JSON with --format json); verify is the plan M1.13 determinism self-check (first slice) β every ledger pipeline runs twice from independent load passes and any rendered-byte drift fails the command (glyim.ledger-verify/1 JSON with --format json); gaps open is the opening stage of the lifecycle β it files a NEW gap entry into the registry: the engine enforces the canonical GAP-NNNN ID shape (the face mints IDs), a usable one-line --title/--opened-in, every --affects feature present in the registry, and a free ID (an open gap is never silently shadowed), renders the canonical [[gap]] block in the committed registry style with the explicit status = "unwitnessed" line (the serde default for a missing status key is witnessed, so an omitted line would mint silent debt), and appends it after one blank separator β minting the next numbered ledger/gaps/known/NNNN-gaps-open.toml by default or extending the existing registry file named by --file, through the GapOpener seam (glyim.ledger-gaps-open/1 JSON with --format json); gaps witness is the gap-lifecycle write face β it attaches the witness fixture that reproduces one unwitnessed gap (--id GAP-NNNN --witness PATH), validates the path against the registry and the tree (relative, no .. escape, fixture must exist), edits exactly the matched [[gap]] block through the GapWitnessRewriter seam (the status value flips, the aligned witness line is appended, the curated header prose survives byte-for-byte β the surgical counterpart of the waiver faces' canonical rewrite), never silently re-witnesses an already-witnessed gap, and the dispatch refreshes the generated KNOWN_GAPS.md in the same run (glyim.ledger-gaps-witness/1 JSON with --format json); gaps retire is the closure half of the lifecycle β it removes one gap's [[gap]] block from its registry file entirely through the GapRetirer seam (the rendered document says closed entries retire to the git history of the file and of the registry; until this face the removal had no sanctioned command), refusing a registry that does not load cleanly and never leaving a partial write behind (glyim.ledger-gaps-retire/1 JSON with --format json); gaps audit is the trust-loop closure over the gap-lifecycle write faces β it resolves every registered gap's witness fixture against the tree, one row per gap sorted by ID (witnessed = the fixture exists, debt = honest unwitnessed debt displayed never failed, missing = the registry claims a witness the tree no longer carries β silent debt surfaced, unreadable = the witness path is not a readable regular file), and any missing or unreadable row (or error-severity load diagnostic) fails the exit code after every finding is printed β the same finding gate evidence audit runs over the evidence store, applied to the witness paths the write faces record (glyim.ledger-gaps-audit/1 JSON with --format json); gaps unwitness is the remedy half of that trust loop β it detaches one witnessed gap's witness (--id GAP-NNNN), flipping the matched block's status back to unwitnessed and removing the aligned witness line through the GapWitnessDetacher seam (the curated header prose survives byte-for-byte; the sanctioned counterpart of the witness face's "an already-witnessed gap is never silently re-witnessed" rejection β a stale or wrong witness path is detached and re-witnessed at its new spelling instead of hand-edited), refusing a registry that does not load cleanly and never leaving a partial write behind; the dispatch refreshes the generated KNOWN_GAPS.md in the same run (glyim.ledger-gaps-unwitness/1 JSON with --format json); evidence record is the plan Β§3.4 store-curation face β it validates harness-emitted JSONL against the registry and merges it into the committed ledger/evidence/ store (glyim.ledger-evidence-record/1 JSON with --format json; whole-record dedupe, canonical order, idempotent re-record), and evidence check validates that committed store and reports its coverage (glyim.ledger-evidence-check/1; error diagnostics fail the exit code); waivers is the constitution-C9 waiver-health report β every ledger/waivers.toml entry with its expiry verdict (glyim.ledger-waivers/1 JSON with --format json); expired waivers and load diagnostics fail the exit code, so an expired exception fails CI even when no regression needs covering β and waivers grant is the curated write face: it validates the request against the registry and the 14-day C9 horizon, composes the deterministic WVR-<date>-<slug> ID, and appends the canonical [[waiver]] block (never a silent overwrite); evidence retract [ROOT] --fixture <PATH> is the curation removal face β it removes every committed record whose fixture_sha256 matches the recomputed digest of one fixture through the same FixtureFingerprint seam the audit face compares with (glyim.ledger-evidence-retract/1 JSON with --format json): the audit face's Drift verdict is the finding, this face is the remedy β refusing a store that does not load cleanly (a corrupt line would be silently destroyed by the canonical rewrite), rejecting a fixture with nothing committed instead of silently no-oping, and rewriting the store canonically so the surviving records stay byte-deterministic; evidence audit recomputes every record's fixture_sha256 against the tree and fails on missing, drifted, or unreadable fixtures (the FixtureFingerprint seam); waivers revoke is the retirement write face β it validates the exact --id, refuses to rewrite a document that does not load cleanly, and removes exactly the one matching block through the WaiverRewriter seam, rewriting the remaining entries canonically (never a silent partial write); waivers extend is the re-pin write face β it moves exactly the one matching block's expiry to today + --days (default 7, horizon 14) through the WaiverExtender seam, keeping the identity (never a silent partial write); waivers prune is the batch-retirement write face β it removes every expired [[waiver]] block through the WaiverPruner seam, rewriting the remaining entries canonically (a document that does not load cleanly is refused; a document with no expired waiver is never rewritten); handoff is the plan Β§3.7 session-handoff generator β it composes the compute, next, and waivers face outcomes into one short document (the readiness histogram, the top-N work queue with --items N (default 5, max 20), waiver health with the next expiring waiver, and witness debt; glyim.ledger-handoff/1 JSON with --format json) β --out PATH writes the rendered document (default HANDOFF.md / HANDOFF.json by face) and --check byte-compares the committed document against the composed state, and an expired waiver or an error diagnostic fails the exit code exactly as the composed faces do; release-check <VERSION> is the plan Β§10 final release gate β it composes the M1.12 gate report, the M1.13 determinism self-check, and the C9 waiver health into one verdict for the named release: every declared gate green (unmeasured blocks β displayed, never silently passed), evidence reproducible, no waiver active or expired, and no error diagnostic across the composed faces, never greener than the faces it composes (glyim.ledger-release-check/1 JSON with --format json; the ReleaseCheckSource seam runs FileReleaseCheckSource over the registry or an in-process state); inventory ignore [ROOT] --item <KEY> --reason <TEXT> is the Β§3.5 exemption write face β it files one [[ignore]] block into ledger/inventory-ignore.toml through the IgnoreSink seam, the sanctioned answer to a failing LEDGER-INVENTORY-UNMAPPED check: the key must be produced by an extractor right now (exact keys, never globs β a pre-registered phantom exemption would silently swallow future drift), must not be claimed by a feature (claimed-and-ignored is the LEDGER-INVENTORY-CONFLICT failure), and must not already be ignored (a re-file is a duplicate, never a silent overwrite); nothing is written on a rejected request (glyim.ledger-inventory-ignore/1 JSON with --format json); inventory unignore [ROOT] --item <KEY> is the retirement half β it removes exactly the one matching block through the IgnoreRewriter seam and rewrites the remaining entries canonically (the item is unmapped again the moment the rewrite lands; the Β§3.5 gate is the loud follow-up that forces a feature claim before ledger check passes) (glyim.ledger-inventory-unignore/1 JSON with --format json). |
tools/glyim-bench |
M2.2 measurement harness: perf stat/callgrind instruction counts, wall time, child RSS, a counting allocator, the CoV stability gate, and the M2.3 deterministic corpus generators (glyim.corpus/1 manifest); run measures one glyim.bench/1 report over an arbitrary child command (--iterations N), gate is the per-metric CoV stability gate over a committed report (an unstable metric fails the exit code), and diff is the M2.5 perf-history gate between two glyim.bench/1 reports, scale (M2.4) measures a {size}-parameterized command across input sizes and gates the fitted log-log scaling exponent, budget (M2.6) enforces the committed absolute glyim.bench-budgets/1 budgets per benchmark β an exceeded mean, an unmeasured instruction bound, or an unbudgeted program fails the gate β and history record/show/diff/trend append runs to the append-only glyim.bench-history/1 JSONL perf history (plan Β§6 M2.5), diff a current report against the latest recorded baseline, and measure the total drift across the last N recorded runs of a program (glyim.bench-trend/1 β the accumulated-ratchet class no per-run diff sees); matrix (M2.5 remainder) diffs a whole benchmark set against the latest recorded baseline of each program and gates the per-benchmark deltas and their geo-mean (glyim.bench-matrix/1, plan Β§325: fail >2% per benchmark or >0.5% geo-mean β the aggregate clause that catches a uniform sub-budget drift no single row trips); corpus write/check (M2.3 remainder) materialize the committed corpora directory β one <family>-<seed>-<size>.g file per program plus the glyim.corpus/1 corpus.json manifest through the CorpusSink seam β and re-hash every committed byte against the manifest on every check. |
source.g
β
βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Lexer ββββΆβ Parser ββββΆβ CST β (glyim-frontend, glyim-syntax)
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β
βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Macro βββββ Def-Map βββββ HIR β (glyim-meta, glyim-def-map, glyim-hir)
β Expansion β β (name res.) β β (untyped) β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β
βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Trait βββββ Typeck ββββΆβ THIR β (glyim-solve, glyim-typeck)
β Solving β β (inference) β β (typed) β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β
βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Borrowck βββββ Lowering ββββΆβ MIR β (glyim-lower, glyim-borrowck, glyim-mir)
β (NLL) β β (monomorph.) β β (CFG) β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β
βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β LLVM IR βββββ Optimizer ββββΆβ Bytecode β (glyim-opt, glyim-codegen-llvm, glyim-codegen)
β β .o / exe β β (MIR passes)β β β .gbc β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β
βΌ
ββββββββββββββββ
β Interpreter β (glyim-mir-interp)
ββββββββββββββββ
- Rust β latest stable, 2024 edition (Rust 1.95+ recommended; the MSRV is pinned in
Cargo.tomland enforced by themsrvCI job). - LLVM 23 β a hard workspace dependency (there is no feature flag). Set
LLVM_SYS_231_PREFIXto your LLVM installation prefix before building. watchexecβ optional, for thejustfilerecipes.
Important
The LLVM backend is a hard dependency of the pipeline β there is no
feature flag to build without it. Install LLVM 23 and set
LLVM_SYS_231_PREFIX (Homebrew: $(brew --prefix llvm@23),
Debian/Ubuntu: /usr/lib/llvm-23).
git clone https://github.com/elcoosp/glyim
cd glyim
cargo build --releaseThe compiler driver is then available at target/release/glyim-cli (invoke it as glyim-cli; rename or symlink to glyim if you prefer).
# Create a new project
cargo run -p glyip -- new hello
cd hello
# Build it
cargo run -p glyip -- build
# Run it
cargo run -p glyip -- run# Compile a source file to an object file using the LLVM backend (default)
glyim input.g -o output.o
# Emit LLVM IR instead of an object file
glyim input.g --emit llvm-ir
# Emit MIR (useful for debugging lowering)
glyim input.g --emit mir
# Emit assembly
glyim input.g --emit asm
# Use the bytecode backend
glyim input.g --backend bytecode --emit obj
# Compile to a runnable executable
glyim input.g --emit exec -o hello
# Compile to a cdylib (used for proc-macro crates)
glyim proc_macro_dep.g --emit cdylib
# Optimise at level 2 with thin LTO (fat LTO requires multi-CGU support,
# which is not yet implemented; --lto fat errors cleanly)
glyim input.g -O2 --lto thin
# Cross-compile to AArch64 Linux
glyim input.g --target aarch64-unknown-linux-gnu
# Emit diagnostics as JSON (for editors / LSP)
glyim input.g --error-format json| Flag | Description |
|---|---|
--emit <KIND> |
obj (default), exec, mir, llvm-ir, asm, cdylib, syntax, stats, run |
--backend <NAME> |
llvm (default), bytecode, or interp (run mode only: executes through the in-process MIR interpreter) |
-O, --opt-level <N> |
Optimisation level 0β3 |
--target <TRIPLE> |
Target triple (default: the host triple, derived from std::env::consts) |
--linker <PATH> |
Override the system linker |
--link-flags <FLAGS> |
Extra flags passed to the linker |
--lto <KIND> |
off (default), fat, thin |
--codegen-units <N> |
Number of CGUs (default: available parallelism, capped at 16) |
--proc-macro-deps <LIST> |
Comma-separated proc-macro dependency source files |
--error-format <FMT> |
human (default) or json |
--with-stdlib |
Prepend the assembled standard library (+ prelude) so println, Vec, Option, β¦ resolve without use statements |
-A/--allow, -W/--warn, -D/--deny <LINT> |
Lint level control (repeatable; -W help lists the lints) |
--time-passes |
Print the per-phase wall-clock table to stderr after a successful compile |
--self-profile[=FILE] |
Write the per-phase profile as a Chrome Trace JSON event list (default ./trace.json; value is =-bound) |
Important
--lto=thin requires the LLVM backend and the llvm-lto2 tool from the same LLVM distribution glyim-codegen-llvm was built against. Requesting thin with --backend bytecode is an explicit error rather than a silent no-op.
Tip
--emit=run executes the program in-process through the MIR interpreter (the interpreter run contract, M2.1 era) β no LLVM toolchain, no system linker, no glyim-runtime staticlib. The program's exit code (masked to 0xff; panics exit 101) becomes the driver's exit code, so it is scriptable exactly like a linked --emit=exec binary:
glyim input.g --emit=run --with-stdlib # runs without a linker
glyim input.g --emit=run --backend=interp --time-passesglyip is Cargo's counterpart for Glyim projects. It reads a Glyip.toml manifest, resolves dependencies (path, registry, and git), maintains a Glyip.lock lockfile, and drives the compiler.
glyip new my_project # Scaffold a new binary project
glyip new my_lib --lib # Scaffold a new library project
glyip build # Build the project (incremental)
glyip build --release --opt-level 2 # Release build with optimisations
glyip build --backend llvm # Force the LLVM backend
glyip test # Run all tests
glyip test --filter parser # Run only tests matching "parser"
glyip test --compiled # Compile each test to a native exe and run it
glyip run -- --flag value # Build and run with program arguments[package]
name = "my_project"
version = "0.1.0"
edition = "2024"
[dependencies]
serde = "1.0"
local_util = { path = "../local_util" }
my_crate = { git = "https://github.com/example/my_crate", tag = "v0.3.0" }
[dev-dependencies]
test_helpers = { path = "../test_helpers" }Tip
The resolver performs real SemVer 2.0 matching (caret, tilde, wildcard, and comparison operators), detects dependency cycles, and reports version conflicts with the full set of requesters that disagree.
glyip's resolver is deliberately simpler than Cargo's. Knowing the
differences up front saves debugging a resolution failure that is not a
bug:
Greedy breadth-first, no backtracking. The resolver walks the
dependency graph breadth-first from the root manifest. When it encounters
foo = "1.0", it picks the highest version of foo that satisfies that
requirement at that moment, records it, and moves on. If a later
transitive dependency needs an incompatible version of foo, the resolver
does not go back and try a lower version of the first requirement β
it reports a conflict. Cargo's backtracking resolver would try
alternatives; glyip's does not.
One version per crate name. Although Glyip.lock keys entries by
name-version (so the data structure could hold foo-1.0.0 and
foo-2.0.0 simultaneously, as Cargo's lockfile does), the conflict check
that runs at the end of resolution looks up the first entry matching a
crate name and verifies every requirement seen in the graph against it.
In practice this enforces a single resolved version per name: two
incompatible requirements for the same crate are a hard
DependencyConflict error, not a multimapping.
That error names the crate, every distinct requirement gathered, and
every (requester, requirement) edge β so a diamond dependency where two
crates disagree is diagnosable without re-running with extra logging.
Deterministic version selection. "Highest matching version" is
computed by parsing every candidate and sorting by SemVer precedence, not
by trusting the registry index's JSON listing order. An unparseable or
unsatisfiable requirement surfaces as DependencyNotFound rather than
silently falling back to "latest" β a typo in a version string is an
error, not a surprise upgrade.
Cycle detection. The visited set is keyed by
name@path(path) for path dependencies and name-version(git) for
registry and git dependencies. A cycle (crate A path-depends on B, B
path-depends on A) is caught by the visited check before infinite
recursion. Two path dependencies with the same declared [package] name
but different directories are correctly treated as distinct crates β
they resolve independently rather than colliding on the name alone.
What this means in practice. For the common shapes β a flat
dependency list, or a diamond where everyone agrees on a major version β
glyip resolves the same graph Cargo would. The divergence is when two
dependents require mutually-incompatible versions: Cargo would compile
both copies; glyip stops with an error naming both requesters. That is
a deliberate scope limit, not an oversight.
// Structs, enums, generics, traits.
struct Point<T> {
x: T,
y: T,
}
enum Shape {
Circle(f64),
Rectangle(f64, f64),
Point,
}
trait Area {
fn area(&self) -> f64;
}
impl Area for Shape {
fn area(&self) -> f64 {
match self {
Shape::Circle(r) => 3.14159 * r * r,
Shape::Rectangle(w, h) => w * h,
Shape::Point => 0.0,
}
}
}
// Pattern matching, ranges, guards.
fn classify(n: i32) -> &str {
match n {
0 => "zero",
1 | 2 => "small",
x if x < 0 => "negative",
_ => "large",
}
}
// Closures and iterators.
fn sum_of_squares(values: &[i32]) -> i32 {
values.iter().map(|x| *x * *x).sum()
}
// Async / await.
async fn fetch_twice() -> i32 {
let a = fetch_one().await;
let b = fetch_one().await;
a + b
}
Note
The full grammar and standard library are still evolving. The glyim-lang-core, glyim-lang-alloc, and glyim-lang-std crates contain the current standard library source (written in Glyim) and serve as the compiler's own bootstrapping corpus.
Compiler crates live under crates/; the five tooling crates live under tools/. The workspace root Cargo.toml defines shared dependencies and members. The standard library lives under glyim-lang-core/lib/, glyim-lang-alloc/lib/, and glyim-lang-std/lib/ as .g source files.
- Create the directory under
crates/<name>. - Add a
Cargo.tomlwith[package]and[dependencies]. - Register the crate in the workspace
memberslist. - If its public API is used by other crates, add its path to
[workspace.dependencies].
- Context traits β every phase defines a narrow trait (
LowerCtx,BorrowckCtx,TypeLookup,TraitSolver) that the pipeline implements. This decouples core logic from the database and lets unit tests substitute mocks. - Testing mocks β
glyim-testprovidesMockLowerCtx,MockBorrowckCtx,MockSolver,MockCodegen, andTestDbBuilder. - Arena-allocated IRs β
IndexVec<I, T>gives every IR node a typed, cheaply-copyable ID. Interning (TyCtx) makes type handles stable across phases. - Diagnostics β every phase returns
Vec<GlyimDiagnostic>, which the driver renders withmiette(human) or serialises to JSON.
# Run the whole suite
cargo test
# Run only the glyim-test harness
cargo test -p glyim-test
# Filter tests by path substring
cargo test -p glyim-test -- --filter parser
# Verbose output
GLYIM_TEST_SHOW_OUTPUT=1 cargo test -p glyim-testCI runs the same suite through cargo-nextest (the test jobs in .github/workflows/ci.yml); plain cargo test works everywhere else.
The examples/ directories show how to consume the compiler crates as
libraries rather than through the CLI:
# Drive the pipeline in-process: write a .g program, lower it to MIR.
cargo run -p glyim-pipeline --example hello_pipeline
# Execute in-process via the interpreter run contract.
cargo run -p glyim-pipeline --example run_interp
# Walk the solver's bootstrap surface (the builtin-trait registry).
cargo run -p glyim-pipeline --example builtin_trait_registry
# Read the M2.1 per-phase profile the driver's --time-passes prints.
cargo run -p glyim-pipeline --example phase_profile
# Walk the async desugar's loop-await shapes: what `loop`/`for`/`while`
# bodies desugar to (and which shapes stay diagnosed, GAP-0006).
cargo run -p glyim-hir --example async_loop_desugar
# The `for`-over-a-range variant of the same desugar walkthrough.
cargo run -p glyim-hir --example async_for_loop_desugar
# Round-trip the readiness ledger's evidence JSONL (M1.5 seam).
cargo run -p glyim-test --example evidence_report
# File a strict-xfail witness fixture against a registered gap (M1.6).
cargo run -p glyim-test --example known_gap_witness
# Drive the language server's request engines in-process β one
# walkthrough per seam (declaration, implementation, pull diagnostics,
# workspace diagnostics, related diagnostics,
# inlay hints, call hierarchy, signature help, semantic tokens, selection
# ranges, document highlight, document links, linked editing, type
# definition, code lenses, on-type formatting, range formatting, type
# hierarchy, execute command, monikers, inline values, save-time format
# edits, watched files, file operations, file renames, workspace folders,
# document color, and the --log-file sink):
cargo run -p glyim-lsp --example goto_declaration_walkthrough
cargo run -p glyim-lsp --example implementation_walkthrough
cargo run -p glyim-lsp --example pull_diagnostics_walkthrough
cargo run -p glyim-lsp --example workspace_diagnostics_walkthrough
cargo run -p glyim-lsp --example related_diagnostics_walkthrough
cargo run -p glyim-lsp --example inlay_hint_walkthrough
cargo run -p glyim-lsp --example call_hierarchy_walkthrough
cargo run -p glyim-lsp --example signature_help_walkthrough
cargo run -p glyim-lsp --example semantic_tokens_walkthrough
cargo run -p glyim-lsp --example selection_range_walkthrough
cargo run -p glyim-lsp --example document_highlight_walkthrough
cargo run -p glyim-lsp --example document_links_walkthrough
cargo run -p glyim-lsp --example linked_editing_walkthrough
cargo run -p glyim-lsp --example type_definition_walkthrough
cargo run -p glyim-lsp --example code_lens_walkthrough
cargo run -p glyim-lsp --example on_type_formatting_walkthrough
cargo run -p glyim-lsp --example range_formatting_walkthrough
cargo run -p glyim-lsp --example type_hierarchy_walkthrough
cargo run -p glyim-lsp --example execute_command_walkthrough
cargo run -p glyim-lsp --example moniker_walkthrough
cargo run -p glyim-lsp --example inline_value_walkthrough
cargo run -p glyim-lsp --example will_save_walkthrough
cargo run -p glyim-lsp --example watched_files_walkthrough
cargo run -p glyim-lsp --example file_operations_walkthrough
cargo run -p glyim-lsp --example file_rename_walkthrough
cargo run -p glyim-lsp --example workspace_folders_walkthrough
cargo run -p glyim-lsp --example document_color_walkthrough
cargo run -p glyim-lsp --example server_log_walkthrough
# Measure a workload in-process: counting allocator + CoV gate (M2.2).
cargo run -p glyim-bench --example measure_alloc
# Render the gap registry's witness-debt report (M1.7 seam).
cargo run -p glyim-ledger --example gap_report
# Rank the plan Β§3.9 work queue over open gaps + the requires DAG.
cargo run -p glyim-ledger --example next_queue
# Explain one registry ID: why it is queued, what evidence moves it.
cargo run -p glyim-ledger --example explain_entry -- GAP-0002
# Compute per-feature readiness levels from evidence + policy (M1.8 seam).
cargo run -p glyim-ledger --example compute_levels
# Render the computed status block + JSON contract (M1.9 first slice).
cargo run -p glyim-ledger --example status_report
# Run the readiness-regression gate: unwaived regression fails, waiver passes (M1.10).
cargo run -p glyim-ledger --example readiness_diff
# Print all 24 RG release-gate verdicts from ledger/gates.toml (M1.12).
cargo run -p glyim-ledger --example release_gates
# Self-check determinism: every ledger pipeline twice, byte-identical or fail (M1.13).
cargo run -p glyim-ledger --example verify_determinism
# Generate KNOWN_GAPS.md from the gap registry; verify the committed copy (M1.9 remainder).
cargo run -p glyim-ledger --example render_known_gaps
# Curate a harness run into the evidence store, then validate the store (Β§3.4 face).
cargo run -p glyim-ledger --example evidence_store
# Compose the session handoff from the ledger state (plan Β§3.7 face).
cargo run -p glyim-ledger --example handoff_report
# Compose the final release verdict from the ledger state (plan Β§10 face).
cargo run -p glyim-ledger --example release_check
# Retire every expired C9 waiver in one call (waivers prune face).
cargo run -p glyim-ledger --example waivers_prune
# Re-pin one C9 waiver's expiry by exact ID (waivers extend face).
cargo run -p glyim-ledger --example waivers_extend
# Audit the committed evidence store against the tree (evidence audit face).
cargo run -p glyim-ledger --example evidence_audit
# Audit every gap's witness fixture against the tree (gaps audit face).
cargo run -p glyim-ledger --example gaps_audit
# Detach one witnessed gap's witness (gaps unwitness remedy face).
cargo run -p glyim-ledger --example gaps_unwitness
# Grant, then retire C9 waivers by exact ID (waivers grant/revoke faces).
cargo run -p glyim-ledger --example waivers_revoke
# Re-pin one C9 waiver's expiry by exact ID (waivers extend face).
cargo run -p glyim-ledger --example waivers_extend
# Grant one C9 waiver through the curated write face (waivers grant face).
cargo run -p glyim-ledger --example waivers_grant
# The constitution-C9 waiver-health report (expired waivers fail).
cargo run -p glyim-ledger --example waiver_health
# Open a NEW gap entry into the registry (the gap lifecycle's first stage).
cargo run -p glyim-ledger --example gaps_open
# Attach a witness fixture to one unwitnessed gap (the write face).
cargo run -p glyim-ledger --example gaps_witness
# Remove one gap's block from its registry (the closure face).
cargo run -p glyim-ledger --example gaps_retire
# Retract every committed record of one fixture by its digest.
cargo run -p glyim-ledger --example evidence_retract
# File one Β§3.5 inventory exemption, then unignore it.
cargo run -p glyim-ledger --example inventory_ignore_lifecycle
# Build + verify a corpus manifest over the 7 generator families (M2.3).
cargo run -p glyim-bench --example corpus_walk
# Commit a corpus directory + manifest, then catch a hand-edited program (M2.3 remainder).
cargo run -p glyim-bench --example corpus_commit
# Fit a stored report history + a live run into a scaling exponent (M2.4).
cargo run -p glyim-bench --example scaling_fit
# Enforce committed absolute budgets over written reports (M2.6).
cargo run -p glyim-bench --example budget_check
# Append runs to the perf history; diff against the latest baseline (M2.5).
cargo run -p glyim-bench --example history_baseline
# Gate a benchmark matrix against the history; catch uniform sub-budget drift with the geo-mean budget (M2.5 remainder).
cargo run -p glyim-bench --example matrix_gate
# Measure total drift across a program's committed history window (M2.5 complement).
cargo run -p glyim-bench --example history_trend
# Disassemble a decoded module image: the deterministic instruction
# listing (unknown bytes list as unknown(0xNN), truncation as <truncated>).
cargo run -p glyim-bytecode-vm --example module_disasm_walkthrough
# Round-trip the loadable module image: encode, decode, run (v2 format).
cargo run -p glyim-bytecode-vm --example module_image_walkthrough
# Float arithmetic and width-aware casts in the VM (the interpreter's
# MIR-14 cast semantics).
cargo run -p glyim-bytecode-vm --example float_casts_walkthrough
# Trace what a decoded module actually executed: per-dispatch steps,
# frame-depth transitions, bounded capture, and the fuel budget that
# stops an infinite loop with an explicit error.
cargo run -p glyim-bytecode-vm --example execution_trace_walkthrough
# Emit MIR bodies into a loadable module image (the assembler seam).
cargo run -p glyim-codegen --example module_assembly_walkthrough
# Construct diagnostics and render them (human / JSON faces).
cargo run -p glyim-diag --example render_diagnostics
# Drive the lexer and parser over a small program.
cargo run -p glyim-frontend --example lex_parse
# Dump the assembled core / alloc / std library sources the compiler
# consumes as its bootstrapping corpus.
cargo run -p glyim-lang-core --example core_modules_walkthrough
cargo run -p glyim-lang-alloc --example alloc_modules_walkthrough
cargo run -p glyim-lang-std --example dump_assembled
# The opt-level pass plan (which MIR passes run at which level).
cargo run -p glyim-opt --example pass_plans
# Check the repo-health metrics ratchet against its baseline (M0.6).
cargo run -p glyim-metrics --example baseline_check
# Persist two bench reports and diff them (the M2.5 gate over files).
cargo run -p glyim-bench --example diff_reports
# Walk the virtual filesystem seam every driver sits on.
cargo run -p glyim-vfs --example vfs_walkthrough
# Walk the content-addressed compile cache and the session-state bundle.
cargo run -p glyim-db --example compile_cache_walkthroughGlyim's test harness (glyim-test) is a first-class part of the project. It discovers .g files under tests/ and runs them in one of five modes, selected by an inline header or the containing directory name:
| Mode | Meaning |
|---|---|
compile-pass |
The source must compile without errors. |
compile-fail |
The source must produce specific errors, checked against inline annotations. |
ui |
The full compiler output (CST, def-map, typeck, diagnostics) must match an .expected snapshot. |
run-pass |
The compiled program must exit successfully and match its expected stdout/stderr. |
run-fail |
The compiled program must fail with a specific exit code and output. |
fn main() {
let x: i32 = "hello";
//~^ ERROR mismatched types
//~| expected i32, found str
}
//~ ERROR <pattern>β the annotated line must produce an error whose message contains<pattern>.//~| ERROR <pattern>β a continuation of the previous annotation (used for multi-line diagnostic blocks).//~^,//~^^, β¦ β point at earlier lines.//~~β fuzzy matching (allow the diagnostic to land within Β±1 line).//~? ERROR β¦β the diagnostic is optional; the test still passes if it is absent.
Every .g fixture carries a machine-readable //@ header (plan M1.4). The harness rejects fixtures with no //@ annotations, and run fixtures must pin an explicit outcome:
//@ mode: run-pass
//@ expect-exit: 42
//@ feature: LANG-SYN-OPERATORS, TOOL-TEST-RUN-PASS
//@ backends: gam, llvm
fn main() -> i32 { 42 }
//@ mode:β explicit test mode (run-pass,compile-fail, β¦).//@ expect-exit:///@ expect-stdout:///@ expect-stderr:β the outcome a run fixture must produce.//@ expect-error:β a diagnostic substring acompile-failfixture must produce (in addition to inline//~annotations).//@ feature:β readiness-ledger registry IDs the fixture exercises (joined againstledger/features/**byledger compute).//@ backends:β which backends the fixture is verified on (gam,llvm,cranelift,bytecode).//@ needs-llvm,//@ ignore,//@ only-target:,//@ compile-flags:,//@ aux-file:,//@ timeout:,//@ min-version:β harness gates.
The legacy // key: value spelling is still parsed, but a fixture must not mix the two forms, and re-tagging is mechanical: cargo run -p glyim-test --bin glyim-tag-fixtures -- --write.
Snapshot tests for the CST, def-map, and MIR are written with insta:
snapshot_cst("my_syntax_case", source);
snapshot_mir("my_mir_case", &ctx, &body);Update snapshots with:
GLYIM_BLESS=1 cargo test -p glyim-test
# or, for interactive review
cargo insta reviewglyim-test's property module generates random types (with and without inference variables) and checks invariants such as "unification of a type with itself succeeds" and "unification of two distinct types fails".
- Lexing, parsing, CST, error recovery.
- Module graph, name resolution,
useimports, visibility checks. - Declarative and built-in macro expansion.
- HIR lowering, including
async fn/.awaitdesugaring. - Type inference, unification, auto-trait computation, trait solving with HRTB.
- THIR β MIR lowering, monomorphization, polymorphization.
- NLL borrow checking with two-phase borrows and move analysis.
- MIR optimisation passes (const prop, DCE, CFG simplify, unreachable elimination, slice desugar, drop elaboration).
- LLVM codegen for scalar and aggregate types, with real ABI lowering.
- Bytecode codegen and the bytecode VM, including multi-function module-image assembly (
generate_module_imageβdecode_moduleβ run) verified against the MIR interpreter by the differential suite, over the MIR call-frame ABI (local 0 return place, args atlocals[1..=arg_count]); the differential also pins float arithmetic/casts and pooled string equality bit-for-bit against the interpreter. The VM additionally carries the execution-trace seam (per-dispatchTraceSinksteps with a deterministicrender_tracelisting) and the fuel budget (Vm::with_fuel,VmError::FuelExhausted), so a traced, budgeted run over a decoded image is scriptable end to end. - MIR interpreter used for
const fnevaluation andrun-*tests. - LSP with pushed, per-file-pull (with related documents), and workspace-pull diagnostics, hover, completion, goto-definition, goto-type-definition, goto-declaration, goto-implementation, references, document highlight, selection ranges, semantic tokens, call hierarchy (incoming/outgoing calls), type hierarchy (prepare a trait/struct/enum item and walk the recorded impl facts), signature help, inlay hints, inline values, rename (with
prepareRename), folding, formatting, range formatting, on-type formatting, code actions (add missing match arms, generate impl, remove unused imports), auto-import, code lenses (with a live-count resolve, executable throughworkspace/executeCommand), document links, linked editing ranges, monikers, workspace/document symbols, save-time format edits (willSaveWaitUntil), watched files, file operations (didCreateFiles/didDeleteFiles), file renames (didRenameFiles), workspace folders (workspaceFoldersserved with change notifications), document color (documentColorswatch sites over hex string literals,colorPresentationrecolor echo), and an optional JSON-lines server log (--log-file). glyipbuild tool: project scaffolding, incremental builds, dependency resolution (path / registry / git), lockfiles, and compiled test execution.
The compiler's development is tracked against an internal de-stubbing plan.
Status is a property of the readiness ledger, not of prose: the open gaps
live in ledger/gaps/known/*.toml (GAP-0002β¦GAP-0006), are validated by CI's
ledger check job, and carry strict-xfail witness fixtures under
crates/glyim-test/tests/ where one is reproducible. Render the coverage
report with cargo run -p glyim-ledger -- gaps. Notable open items include:
.awaitinside a loop body works forwhile,for-over-range, and unboundedloopbodies (a real suspend/resume machine; GAP-0001 closed, and the GAP-0006loopshape closed). The remaining loop shapes βforover a non-range iterable and destructuring loop patterns β stay a deliberate, diagnosed hard error ([T0060], GAP-0006, witnessed) until the rest of the async state-machine v2 lands.panic!does not unwind:glyim_panicwrites the message to stderr and exits 101 without running destructors (GAP-0003, intentional and documented).- A partial move out of a
Drop-implementing type suppresses the parent destructor entirely β sound (over-retains, never double-frees) but it leaks the still-initialized siblings (GAP-0004, witnessed by a run-pass fixture that will fail loudly when fine-grained guards land). - Windows SEH cleanup edges are implemented but structurally unreachable
until a lowering site populates
cleanup:(GAP-0002, Windows-only, so explicit witness debt). - Some builtin methods on
Vec/String/Result/Optionlower to syntheticFnDefIds whose bodies the LLVM backend must intrinsic-lower; unimplemented ones produce an explicit compiler error rather than wrong code. --lto=thinrequiresllvm-lto2from the matching LLVM distribution.- Procedural macros are supported via the C-ABI bridge, but the two-stage
host compile is wired into the default
glyim-cliflow through--proc-macro-deps.
See KNOWN_GAPS.md for the full per-entry audit (verification recipes,
closed-entry history) and docs/archive/session-log-s16-s18.md for the raw
session log.
Warning
Glyim is not yet self-hosting. The standard library is written in Glyim and consumed by the compiler as a test corpus, but the compiler itself is Rust.
docs/roadmaps/β the milestone plans; the current one isglyim-master-plan.md. The workstream state: M0 (rails + metrics) is landed, the M1 readiness-ledger slices (M1.1 registry β M1.6 strict-xfail witnesses) are landed, the M1.7 gap-registry migration is landed for theKNOWN_GAPS.mdΒ§Β§1β8 sources (ledger/gaps/known/*.tomlplus theglyim-ledger gapswitness-debt report), and the M2.1 phase instrumentation (tracingspans,--time-passes,--self-profile,--emit=stats) is landed together with the M2.2 measurement harness (tools/glyim-bench: instruction counts, wall, child RSS, counting allocator, CoV stability gate), and the M2.3 slice 1 corpus substrate is landed (tools/glyim-benchcorpusmodule: the seven deterministic generator families, theglyim.corpus/1manifest, and the identity-verify contract behind "corpora committed with hashes"), the M1.8 level-computation engine and M1.9 status renderers are landed (tools/glyim-ledgercompute/status), the M2.5 perf-history diff gate is landed (tools/glyim-benchdiff), and the M1.10 readiness-regression gate (first slice:glyim-ledger diffoverglyim.ledger-snapshot/1documents withledger/waivers.tomlwaivers inside the 14-day C9 horizon) plus the M2.4 scaling analyzer (first slice:glyim-bench scalewith the log-log fit) are landed, and the M2.6 absolute budget gate (first slice:glyim-bench budgetover a committedglyim.bench-budgets/1TOML file through theBudgetStoreseam) is landed, and the M2.5 perf-history store (first slice:glyim-bench history record/show/diffover append-onlyglyim.bench-history/1JSONL files with the latest-record baseline selection) is landed, and the M2.5 remainder β the matrix gate (glyim-bench matrixover aglyim.bench-matrix/1outcome, theBaselineSourceseam over the history, and the plan Β§325 "fail >2% per benchmark or >0.5% geo-mean" aggregate budget) plus its complement, the windowed trend analyzer (glyim-bench history trendover aglyim.bench-trend/1report, the accumulated-drift ratchet no per-run diff sees) β are landed, and the M1.12 release-gate report (glyim-ledger gatesoverledger/gates.toml, all 24RG-NNgates withunmeasureddisplayed, never silently passed) and the M1.13 determinism self-check (glyim-ledger verify) are landed, and the M1.9 renderers remainder is landed for the generatedKNOWN_GAPS.md(glyim-ledger render-gaps: the document is a pure function ofledger/gaps/known/*.tomlthrough theKnownGapsRendererseam, with the--checkbyte-comparison drift gate and theglyim.known-gaps/1JSON face for the readiness page), and the M2.3 remainder is landed for the committed corpora directory (glyim-bench corpus write/checkthrough theCorpusSinkseam: one<family>-<seed>-<size>.gfile per program plus theglyim.corpus/1corpus.jsonmanifest, re-hashed on every check). The next plan items are the M1.9 Astro readiness page (theglyim.known-gaps/1face's consumer), the nightly full-evidence job (the M1.10 "STATUS is up to date" CI check, the nightly full-evidence job), and the evidence wiring that fills the harness's reservedinstructions/rss_kbcolumns.docs/archive/β historical session documents (HANDOFF.md,FIXES.md) kept for provenance; the root stays navigation-focused.metrics/baseline.jsonβ the M0.6 repo-health baseline (file/line/test counts, doc coverage, inline-allow count pinned at 0). CI'smetrics-ratchetjob fails on regression and allows improvement; bump it deliberately withcargo run -p glyim-metrics -- . --write metrics/baseline.json..github/workflows/ci.ymlβ the enforced gates: fmt + pedantic clippy (-D warnings, zero inline allows), the test matrix, supply-chain, MSRV, and the metrics ratchet.
Glyim stands on the shoulders of excellent open-source projects:
- Rowan β lossless syntax trees.
- Inkwell β safe LLVM bindings.
- Miette β beautiful diagnostics.
- Insta β snapshot testing.
- Lasso β string interning.
- The Rust compiler team, whose architecture and documentation were a constant source of design inspiration.
Glyim is a work in progress. Contributions, bug reports, and design discussions are welcome.