Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 diagnostics module and worse.
  • Cost to replace: contained. Only diagnostics::render touches it; the public Diagnostic type does not expose it. Swapping to codespan-reporting or a custom renderer is a one-file change. (ADR 0008)

thiserror — error type boilerplate

  • Does: derives std::error::Error / Display for internal error enums.
  • Why not std: hand-written Display and Error impls for every internal error enum are pure noise and drift out of sync with their variants.
  • Cost to replace: mechanical. thiserror generates code you could write by hand; removing it is find-and-replace with manual impls.

stacker — on-demand native stack growth

  • Does: stacker::maybe_grow checks 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. stacker turns that into graceful growth (and the RECURSION_LIMIT backstop turns truly unbounded recursion into a clean E0313).
  • Why not a big fixed stack thread: Korrin values are Rc-based and not Send, so the interpreter cannot be moved to a worker thread with a large stack. stacker is 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_continue per Unicode UAX #31, the standard for programming-language identifiers.
  • Why not std: char::is_alphanumeric is 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 --help generation for korrin 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; rustyline is 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 the korrin binary.