Exp 0.1
Tooling & Backends

CLI, LSP & MCP Toolchain

One pure Odin compiler session powering build, check, sig, diff, fmt, fix, test, explain, lsp, and mcp — plus the complete E0001–E0060 diagnostic catalog.

CLI command reference

Every CLI subcommand, the Language Server (exp lsp), and the Model Context Protocol server (exp mcp) execute on the exact same compiler session and verified Core IR. There is never a second parser or a second typechecker.

Exp CLI bash
# Typecheck with machine-readable JSON diagnostics & auto-fixes
exp check --json src/app.exp

# Apply semantics-preserving fixes (including JS/TS/Effect-TS foreign idioms)
exp fix --write src/app.exp

# Canonical zero-option formatter (idempotent; never rewrites invalid syntax)
exp fmt --write src/app.exp

# Audit public signature, error-set, and capability changes between revisions
exp diff --json old/api.exp new/api.exp

# Inspect deterministic compiler work counters & arena memory
exp stats --incremental src/app.exp

# Run event-driven Language Server or MCP agent tool server over stdio
exp lsp
exp mcp

Human & AI agent workflow (LSP, MCP, exp fix)

  • exp check --json: emits stable, never-reused error codes (E0001–E0060), exact byte and UTF-16 spans, and structured machine-applicable text edits.
  • exp fix: applies safe edits (including rewrites for common foreign JS/TS/Effect-TS idioms like let/const or async fn) and verifies output preservation.
  • exp diff: reports public signature, error constructor, and effect/authority changes between revisions so reviewers can audit new capabilities without reading every function body.
  • exp lsp & exp mcp: event-driven stdio servers with zero polling timers (0.000 wakeups/s idle, 1.007× steady memory after 200 sequential edits — meeting B12 and B13).

Incremental early-cutoff compilation

Exp hashes every declaration's complete external interface — parameter types, return type, effect row, restrictable error constructors, escape modes, linearity qualifiers, sink parameters, and abilities. When a body-only edit leaves the interface hash unchanged, early cutoff stops propagation immediately:

  • Body-only edit p99 on a 50,000-LOC workspace: 1.64 ms (budget ≤ 5 ms, B9).
  • No-op rebuild: 0.70 ms with 0 files re-parsed or re-emitted (B10).
  • Reachability pruning guarantees unused prelude/stdlib declarations are never inferred or emitted.

Core IR, T0 oracle & interchangeable C99 backend

All frontend semantics terminate in one explicitly typed, capability-passed, ownership-elaborated Core IR verified by an internal invariant checker before any backend runs. Three consumers validate every language feature differentially:

  1. T0 reference evaluator: simple, independent CESK oracle over Core IR.
  2. JavaScript backend (--target=js): Tier 0–5 ES2022+ ESM + Source Map v3 + strict .d.ts, verified on pinned V8 (Node 24) and JSC (Bun 1.3).
  3. Standalone C99 backend (--target=c): consumes the unchanged Core IR with zero JS leakage, passing three-way differential parity (values, stdout, errors, LIFO cleanup, defects).

Diagnostic catalog (E0001–E0060)

Every code is stable and never reused. Run exp explain <code> in your terminal or press ⌘K anywhere on this site to search diagnostics instantly.

Code Category Identifier & Summary
E0001 Lexical InvalidCharacter — Unexpected character outside strings or comments.
E0002 Lexical UnterminatedString — Double-quoted string literal reaches end of line or file without closing quote.
E0003 Lexical UnterminatedRawString — Multi-line raw string ('''...''') is missing its closing delimiter.
E0004 Lexical InvalidEscapeSequence — Unknown escape sequence inside a string literal.
E0005 Lexical InvalidUnicodeEscape — Malformed \u{...} scalar escape (must be 1–6 hex digits and a valid Unicode scalar).
E0006 Lexical InvalidNumberLiteral — Invalid digit or underscore placement in a numeric literal.
E0007 Lexical IntegerLiteralOverflow — Decimal integer literal exceeds signed 64-bit Int range.
E0008 Lexical InvalidFloatLiteral — Malformed float literal (.5 and 5. are disallowed so method calls parse unambiguously).
E0009 Lexical InvalidFormatSpec — Invalid compile-time format specifier in string interpolation ({val:spec}).
E0010 Lexical InvalidUtf8Sequence — Source file contains invalid UTF-8 byte sequences.
E0011 Syntax UnexpectedToken — Token does not match the expected grammatical construct.
E0012 Syntax ExpectedExpression — Expected an expression in this position.
E0013 Syntax ExpectedPattern — Expected a valid pattern in match arm, binding, or loop binder.
E0014 Syntax ExpectedType — Expected a type expression after ':' or '->'.
E0015 Syntax ExpectedIdentifier — Expected an identifier name.
E0016 Syntax ExpectedEndKeyword — Block or declaration is missing its closing 'end' keyword.
E0017 Syntax ExpectedClosingDelimiter — Unclosed '(', '[', or '{' delimiter.
E0018 Syntax InvalidAssignmentTarget — Left-hand side of '=' is not a valid local, field, index, or irrefutable pattern.
E0019 Syntax InvalidAttribute — Unknown or malformed declaration attribute (#tail, #inline_blocks, #extern).
E0020 Syntax InvalidImportDeclaration — Malformed static module import directive.
E0021 Syntax InvalidTopLevelItem — Declaration or statement is not allowed at module top level.
E0022 Syntax MissingHandlerTarget — Handler declaration must specify ': EffectName'.
E0023 Limits MaxSourceSizeExceeded — Input source file exceeds the compiler's bounded memory limit.
E0024 Limits MaxTokensExceeded — Token buffer reached configured capacity bound.
E0025 Limits MaxAstNodesExceeded — AST pool reached configured capacity bound.
E0026 Limits MaxNestingDepthExceeded — Expression or type nesting exceeded explicit stack depth limit.
E0027 Limits MaxUnificationStepsExceeded — Type/row unification exceeded deterministic step budget.
E0028 Limits MaxCapacityExceeded — Internal compiler arena or table capacity limit reached.
E0029 Resolution UnresolvedName — Value, function, or module identifier not found in lexical scope.
E0030 Resolution UnresolvedType — Type or ability name is not in scope.
E0031 Resolution UnresolvedEffect — Effect name is not declared or imported.
E0032 Resolution AmbiguousConstructor — Bare constructor matches multiple variant types; qualify as Type.Ctor.
E0033 Resolution DuplicateDefinition — Symbol is already declared in the same scope.
E0034 Resolution VariableShadowing — Local shadowing is forbidden in Exp (assign without re-declaring, or rename).
E0035 Resolution UnusedVariable — Declared local variable is never read (prefix with '_' or assign to '_').
E0036 Resolution ReassignTopLevelBinding — Top-level bindings are pure immutable constants and cannot be reassigned.
E0037 Type RefutableAssignmentPattern — Refutable pattern (e.g., Some(x)) cannot appear on '='; use 'match'.
E0038 Type TypeMismatch — Inferred expression type cannot unify with the expected type.
E0039 Type OccursCheckFailed — Unification would construct an infinite recursive type.
E0040 Type ArityMismatch — Function or constructor called with the wrong number of arguments.
E0041 Type MissingRecordField — Record lacks a field required by the expected structural row type.
E0042 Type DuplicateRecordField — Record literal or type declares the same field name twice.
E0043 Type NonExhaustiveMatch — Maranget exhaustiveness check found unhandled constructor or value cases.
E0044 Type OrPatternBinderMismatch — Branches of an or-pattern (A | B) must bind identical variable names and types.
E0045 Type ConstantOverflow — Compile-time 64-bit integer constant folding overflowed; use wrapping +% / -% / *%.
E0046 Effect & Linearity UnhandledEffect — Effect performed by body is not handled or declared in the function's effect row.
E0047 Effect & Linearity EscapedScopedCapability — Second-class scoped-control capability cannot be captured by an escaping closure.
E0048 Effect & Linearity ClosureAssignsOuterLocal — First-class escaping closure cannot reassign an enclosing local; use Ref<T>.
E0049 Effect & Linearity MultiShotAffineViolation — Multi-shot handler cannot handle an E¹ computation with a live affine resource.
E0050 Effect & Linearity AffineValueUsedTwice — Affine resource value was moved more than once.
E0051 Effect & Linearity HandlerDependencyCycle — Cyclic dependency detected among handlers in 'handle ... with'.
E0052 Effect & Linearity ReturnInLambdaOrBlock — 'return' is disallowed inside lambdas and 'do' blocks; use 'escape' for non-local exit.
E0053 Effect & Linearity BreakOrContinueOutsideLoop — 'break' or 'continue' used outside an enclosing loop or across a closure boundary.
E0054 Effect & Linearity AsyncInDefer — Deferred cleanup cannot suspend with Async.
E0055 Abilities & Proofs InvalidExternDeclaration — Malformed #extern target contract or mismatched async/throws effect row.
E0056 Abilities & Proofs AbilityOrphanInstance — Ability method must be defined in the module defining either the ability or the type.
E0057 Abilities & Proofs AbilityOverlappingInstance — Conflicting coherent ability implementation for the same nominal type.
E0058 Abilities & Proofs MissingAbilityInstance — Type does not satisfy the required ability constraint (e.g., Show, Eq, Ord).
E0059 Abilities & Proofs TailCallProofFailed — #tail function contains a non-tail call (or active defer/affine close breaks tail position).
E0060 Abilities & Proofs InlineBlocksProofFailed — #inline_blocks function contains a combinator call that could allocate a closure.