on master help sign in
Rename executable from knotc to knot
commit0d3cef4632c5635c0cc9de0f2af8680283091c62 authoriko <mail@iko.soy> dateMon 11 May 2026, 15:58 (5 months ago) parente2836d9
8 files changed+21−23
.github/workflows/release-binaries.yml+6−8 CLAUDE.md+3−3 README.md+1−1 crates/knot-compiler/Cargo.toml+1−1 crates/knot-compiler/src/main.rs+7−7 crates/knot-lsp/src/formatting.rs+1−1 crates/knot/src/format.rs+1−1 examples/showcase.knot+1−1
.github/workflows/release-binaries.yml+6−8
@@ -61,15 +61,15 @@ jobs:
6161 with:
6262 key: ${{ matrix.target }}
6363
64− - name: Build knotc, knot-lsp, and runtime
64+ - name: Build knot, knot-lsp, and runtime
6565 run: cargo build --release --target ${{ matrix.target }} -p knot-compiler -p knot-lsp -p knot-runtime
6666
67− - name: Package knotc
67+ - name: Package knot
6868 shell: bash
6969 run: |
70− STAGE="knotc-${{ needs.version.outputs.tag }}-${{ matrix.name }}"
70+ STAGE="knot-${{ needs.version.outputs.tag }}-${{ matrix.name }}"
7171 mkdir -p "$STAGE"
72− cp "target/${{ matrix.target }}/release/knotc" "$STAGE/"
72+ cp "target/${{ matrix.target }}/release/knot" "$STAGE/"
7373 cp "target/${{ matrix.target }}/release/libknot_runtime.a" "$STAGE/"
7474 tar -czf "$STAGE.tar.gz" "$STAGE"
7575 shasum -a 256 "$STAGE.tar.gz" > "$STAGE.tar.gz.sha256"
@@ -89,8 +89,6 @@ jobs:
8989 tag_name: ${{ needs.version.outputs.tag }}
9090 name: Knot ${{ needs.version.outputs.tag }}
9191 files: |
92− knotc-*.tar.gz
93− knotc-*.tar.gz.sha256
94− knot-lsp-*.tar.gz
95− knot-lsp-*.tar.gz.sha256
92+ knot-*.tar.gz
93+ knot-*.tar.gz.sha256
9694 make_latest: true
CLAUDE.md+3−3
@@ -12,7 +12,7 @@ Cargo workspace with three crates:
1212crates/
1313 knot/ Frontend library (lexer, parser, AST, diagnostics)
1414 knot-runtime/ Rust staticlib linked into compiled programs (value representation, SQLite persistence)
15− knot-compiler/ Cranelift-based compiler producing native executables (CLI binary: knotc)
15+ knot-compiler/ Cranelift-based compiler producing native executables (CLI binary: knot)
1616examples/ Example .knot programs
1717```
1818
@@ -31,7 +31,7 @@ cargo run -p knot-compiler -- build examples/hello.knot
3131./examples/hello
3232```
3333
34−The compiler (`knotc`) looks for `libknot_runtime.a` next to its own executable. In a cargo workspace, both end up in `target/<profile>/`, so this works automatically. Override with `KNOT_RUNTIME_LIB=/path/to/libknot_runtime.a`.
34+The compiler (`knot`) looks for `libknot_runtime.a` next to its own executable. In a cargo workspace, both end up in `target/<profile>/`, so this works automatically. Override with `KNOT_RUNTIME_LIB=/path/to/libknot_runtime.a`.
3535
3636Compiled binaries create a `knot.db` SQLite database in the current directory for persistence.
3737
@@ -83,7 +83,7 @@ Compiled as a `staticlib` (with `rlib` for workspace dependency resolution). All
8383- **Type resolution** (`types.rs`): Resolves aliases (including multi-variant ADTs to `ResolvedType::Adt`), computes SQLite schemas from Knot type annotations, collects subset constraints; refined type aliases separated during collection — predicates stored in `refined_types: HashMap<String, Expr>`, base types stored in `aliases` for schema resolution; `TypeKind::Refined` transparent for schema — `resolve_type` and `apply_type_subst` recurse into base; `source_refinements: HashMap<String, Vec<(Option<String>, String, Expr)>>` maps source names to their field-level and whole-element refinement predicates (collected by `collect_source_refinements` walking source type ASTs)
8484- **Codegen** (`codegen.rs`): Cranelift IR generation — the `build_function` pattern moves `ctx`/`builder_ctx` out of `self` to avoid borrow conflicts while allowing `self.method()` calls during IR building
8585- **Linker** (`linker.rs`): Invokes `cc` with platform-appropriate flags
86−- **CLI** (`main.rs`): `knotc build <file.knot>` entry point
86+- **CLI** (`main.rs`): `knot build <file.knot>` entry point
8787
8888Key codegen patterns:
8989- All values are pointer-typed (`ptr_type`) in Cranelift IR — uniform representation
README.md+1−1
@@ -28,7 +28,7 @@ cargo run -p knot-compiler -- build examples/hello.knot
2828crates/
2929 knot/ Frontend (lexer, parser, AST, diagnostics)
3030 knot-runtime/ Runtime library (value representation, SQLite persistence)
31− knot-compiler/ Cranelift-based compiler (CLI: knotc)
31+ knot-compiler/ Cranelift-based compiler (CLI: knot)
3232examples/ Example .knot programs
3333```
3434
crates/knot-compiler/Cargo.toml+1−1
@@ -8,7 +8,7 @@ name = "knot_compiler"
88path = "src/lib.rs"
99
1010[[bin]]
11−name = "knotc"
11+name = "knot"
1212path = "src/main.rs"
1313
1414[dependencies]
crates/knot-compiler/src/main.rs+7−7
@@ -1,6 +1,6 @@
11//! Knot compiler CLI.
22//!
3−//! Usage: knotc build <file.knot>
3+//! Usage: knot build <file.knot>
44
55use knot_compiler::{base, codegen, desugar, effects, infer, linker, lockfile, modules, stratify, types, unused};
66
@@ -20,7 +20,7 @@ fn main() {
2020 "build" => {
2121 if args.len() < 3 {
2222 eprintln!("Error: missing source file");
23− eprintln!("Usage: knotc build <file.knot> [-o <path>] [--name=value ...]");
23+ eprintln!("Usage: knot build <file.knot> [-o <path>] [--name=value ...]");
2424 process::exit(1);
2525 }
2626 // Parse -o/--output and compile-time overrides from remaining args
@@ -86,9 +86,9 @@ fn print_usage() {
8686 eprintln!("Knot compiler");
8787 eprintln!();
8888 eprintln!("Usage:");
89− eprintln!(" knotc build <file.knot> [-o <path>] [--name=value ...] Compile with optional output path and constant overrides");
90− eprintln!(" knotc fmt [--check] [--stdout] <file.knot> Format a source file in place");
91− eprintln!(" knotc help Show this help message");
89+ eprintln!(" knot build <file.knot> [-o <path>] [--name=value ...] Compile with optional output path and constant overrides");
90+ eprintln!(" knot fmt [--check] [--stdout] <file.knot> Format a source file in place");
91+ eprintln!(" knot help Show this help message");
9292}
9393
9494fn cmd_fmt(args: &[String]) {
@@ -101,7 +101,7 @@ fn cmd_fmt(args: &[String]) {
101101 "--stdout" | "-" => to_stdout = true,
102102 other if other.starts_with("--") => {
103103 eprintln!("Error: unknown fmt flag '{}'", other);
104− eprintln!("Usage: knotc fmt [--check] [--stdout] <file.knot>...");
104+ eprintln!("Usage: knot fmt [--check] [--stdout] <file.knot>...");
105105 process::exit(2);
106106 }
107107 other => paths.push(other),
@@ -109,7 +109,7 @@ fn cmd_fmt(args: &[String]) {
109109 }
110110 if paths.is_empty() {
111111 eprintln!("Error: missing source file");
112− eprintln!("Usage: knotc fmt [--check] [--stdout] <file.knot>...");
112+ eprintln!("Usage: knot fmt [--check] [--stdout] <file.knot>...");
113113 process::exit(2);
114114 }
115115
crates/knot-lsp/src/formatting.rs+1−1
@@ -2,7 +2,7 @@
22//! `textDocument/onTypeFormatting` handlers.
33//!
44//! Document formatting delegates to [`knot::format::format_module`] — the
5−//! same AST-based pretty printer that powers `knotc fmt`. Range formatting
5+//! same AST-based pretty printer that powers `knot fmt`. Range formatting
66//! still does the heuristic line-level cleanup (trim trailing whitespace,
77//! collapse consecutive blanks) since rendering an arbitrary subrange would
88//! need expression-level slicing the printer can't currently provide.
crates/knot/src/format.rs+1−1
@@ -1,6 +1,6 @@
11//! AST-based pretty printer for Knot source.
22//!
3−//! [`format_module`] is the single public entry point used by both `knotc fmt`
3+//! [`format_module`] is the single public entry point used by both `knot fmt`
44//! and the language server's formatting handler. It walks the parsed
55//! [`Module`] in source order, emits each declaration with consistent
66//! indentation and layout, and re-inserts standalone comments that the lexer
examples/showcase.knot+1−1
@@ -1,5 +1,5 @@
11-- Showcase: exercises many data types, ADTs, nested relations, and bulk data
2−-- Run: knotc build examples/showcase.knot && ./examples/showcase
2+-- Run: knot build examples/showcase.knot && ./examples/showcase
33-- Then: ./examples/showcase db
44
55-- ── Types ────────────────────────────────────────────────────────