Dependencies
Policy: ADR 0013. Every runtime
dependency of the published korrin crate is listed here with its justification.
crates/korrin (published library)
ariadne — diagnostic rendering
- Does: turns a
Diagnostic(code, message, labelled spans, notes) into an annotated terminal snippet with carets, line numbers, and colour. - Why not std: aligning carets under multi-byte characters, rendering
multi-line spans, and handling tab expansion are genuinely intricate. A
hand-rolled version would be larger than the rest of the
diagnosticsmodule and worse. - Cost to replace: contained. Only
diagnostics::rendertouches it; the publicDiagnostictype does not expose it. Swapping tocodespan-reportingor a custom renderer is a one-file change. (ADR 0008)
thiserror — error type boilerplate
- Does: derives
std::error::Error/Displayfor internal error enums. - Why not std: hand-written
DisplayandErrorimpls for every internal error enum are pure noise and drift out of sync with their variants. - Cost to replace: mechanical.
thiserrorgenerates code you could write by hand; removing it is find-and-replace with manual impls.
stacker — on-demand native stack growth
- Does:
stacker::maybe_growchecks the remaining Rust stack and allocates a fresh segment before it runs out. - Why not std: the tree-walking interpreter recurses in Rust for every nested
Korrin expression, so a moderately recursive Korrin program can exhaust a
fixed-size stack and abort the process.
stackerturns that into graceful growth (and theRECURSION_LIMITbackstop turns truly unbounded recursion into a cleanE0313). - Why not a big fixed stack thread: Korrin values are
Rc-based and notSend, so the interpreter cannot be moved to a worker thread with a large stack.stackeris the approach rustc itself uses for the same reason. - Cost to replace: contained — one helper (
interpreter::grow_stack) wraps it. Removing it means picking a fixed stack strategy and living with its limits.
unicode-ident — identifier character classification
- Does:
is_xid_start/is_xid_continueper Unicode UAX #31, the standard for programming-language identifiers. - Why not std:
char::is_alphanumericis not the right set and would let Korrin's notion of "identifier" drift from the Unicode standard the spec cites. - Cost to replace: low, but only downward — restricting identifiers to ASCII would remove it at the cost of a spec change.
crates/korrin-cli (binary only — not published, not depended upon)
Per policy, the CLI may use mature crates for CLI concerns.
clap— argument parsing and--helpgeneration forkorrin run/ the REPL. Reimplementing arg parsing well is not a good use of effort.rustyline— line editing, history, and multi-line input for the REPL. A usable REPL needs readline-style editing;rustylineis the standard pure-Rust choice.
Dev-dependencies (do not ship)
insta— snapshot testing for token streams and AST dumps.proptest— property tests (lexer/parser never panic; round-trips).assert_cmd/predicates— black-box tests of thekorrinbinary.