Repository navigation
1 1 getting started and build system
Source: https://deepwiki.com/PonvasanthPon/TransCompilator/1-1-getting-started-and-build-system
Relevant source files
The following files were used as context for generating this wiki page:
This page documents the build system, Cargo workspace topology, offline/zero-dependency constraints, build scripts (build.rs), Makefile development targets, and continuous integration (CI) workflow for the tc_r1 compiler workspace. The build system enforces strict invariants: zero network access during compilation/testing, absence of machine-learning (ML) model dependencies or runtime web services, and reproducible static binary generation.
The repository is structured as a Cargo workspace managed by Cargo.toml Cargo.toml:1-13 and pinned via Cargo.lock Cargo.lock:1-81. The workspace contains exactly nine local packages (tc-*), with no external registry crates or remote dependency resolutions permitted during normal builds.
graph TD
subgraph "Workspace Root Cargo.toml"
Workspace["Workspace [workspace]"]
end
subgraph "CLI & Editors"
tc_cli["crates/tc-cli"]
tc_editor["crates/tc-editor"]
tc_lsp["crates/tc-lsp"]
end
subgraph "Compactor Pipeline & Frontend"
tc_syntax["crates/tc-syntax"]
tc_semantics["crates/tc-semantics"]
tc_typeck["crates/tc-typeck"]
tc_lexicon["crates/tc-lexicon"]
end
subgraph "Backend & IR"
tc_ir["crates/tc-ir"]
tc_codegen["crates/tc-codegen-x86"]
end
Workspace --> tc_cli
Workspace --> tc_editor
Workspace --> tc_lsp
Workspace --> tc_syntax
Workspace --> tc_semantics
Workspace --> tc_typeck
Workspace --> tc_lexicon
Workspace --> tc_ir
Workspace --> tc_codegen
tc_cli --> tc_codegen
tc_cli --> tc_editor
tc_cli --> tc_ir
tc_cli --> tc_lexicon
tc_cli --> tc_semantics
tc_cli --> tc_syntax
tc_cli --> tc_typeck
click tc_cli "crates/tc-cli" "Command-line driver"
click tc_ir "crates/tc-ir" "Core-7 IR"
click tc_lexicon "crates/tc-lexicon" "Lexical tables"
Figure 1.1.1: Workspace topology showing local intra-workspace dependencies among tc-* crates.
Sources: Cargo.toml:[1-13](), Cargo.lock:[1-82]()
Development tasks are standardized through the root Makefile Makefile:1-67. The Makefile exposes targets for compilation, linting, formatting verification, test execution, editor/LSP launchers, and the strict --audit security/determinism scanner.
| Target | Command | Description |
|---|---|---|
build |
$(CARGO) build --workspace |
Compiles all workspace crates in debug mode. |
release |
$(CARGO) build --workspace --release |
Compiles optimized release binaries. |
test |
$(CARGO) test --workspace |
Executes unit, integration, and parity test suites. |
lint |
$(CARGO) clippy --workspace ... |
Runs Clippy with strict workspace lints (-D warnings). |
fmt-check |
$(CARGO) fmt --all -- --check |
Validates code formatting against rustfmt. |
selftest |
./target/debug/tc --selftest |
Invokes the built-in compiler self-test suite. |
audit |
Custom checks | Runs the static determinism, dependency, and ML-free audit. |
clean |
$(CARGO) clean |
Removes build artifacts from target/. |
Sources: Makefile:[1-67]()
To preserve determinism and eliminate supply-chain attack vectors, the build system enforces strict offline and zero-dependency constraints, verified automatically by make audit Makefile:35-64 and CI workflows .github/workflows/ci.yml:17.
-
Local-Only Dependencies: All dependencies in
Cargo.tomluse explicitpath = ...specifiers Cargo.toml:1-13.Cargo.lockcontains zero registry sources, checksums, or external git repositories Makefile:51-57. -
No Machine Learning Assets: The audit script scans the directory tree (excluding
.gitandtarget) for forbidden file extensions such as.onnx,.pt,.binlm,.mem,.hmm,.gguf, and.safetensorsMakefile:37-39. -
No External Runtime Services: Network scanners check that workspace sources contain no references to HTTP servers, HTML rendering engines, or external socket listeners (
TcpListener,frontend.html,xdg-open, etc.) Makefile:58-60.
graph TD
subgraph "Audit Pipeline Makefile audit"
AuditStart["make audit"] --> CheckML["Check ML Models .onnx .pt .safetensors"]
CheckML --> CheckPaths["Check Cargo.toml path = ... only"]
CheckPaths --> CheckExt["Check Cargo.lock local tc-* packages only"]
CheckExt --> CheckWeb["Check crates/*/src for TcpListener or http/https"]
CheckWeb --> AuditPass["Audit PASS"]
end
click AuditStart "Makefile" "Audit target definition"
Figure 1.1.2: Audit verification workflow ensuring zero-ML, local-only path constraints.
Sources: Makefile:[35-64](), Cargo.toml:[1-13]()
The compiler front-end integrates with the vendored CMU Link Grammar parser (vendor/link-grammar/) THIRD_PARTY_NOTICES.md:7-15 via FFI. Because Link Grammar requires native shared libraries (liblink-grammar.so), companion build.rs scripts in crates/tc-cli crates/tc-cli/build.rs:1-19 and crates/tc-semantics crates/tc-semantics/build.rs:1-23 configure dynamic linker run-paths (-Wl,-rpath).
The build scripts emit cargo:rustc-link-arg directives ensuring binaries locate the vendored library relative to $ORIGIN across nested output directories:
for depth in 2..=6 {
let origin = "../".repeat(depth);
println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN/{origin}vendor/link-grammar/lib");
}crates/tc-cli/build.rs:11-14, crates/tc-semantics/build.rs:15-18
Sources: crates/tc-cli/build.rs:[1-20](), crates/tc-semantics/build.rs:[1-24], THIRD_PARTY_NOTICES.md:[7-15]()
The GitHub Actions workflow .github/workflows/ci.yml executes on every push and pull request to main .github/workflows/ci.yml:1-7. Operating with CARGO_NET_OFFLINE: "true" .github/workflows/ci.yml:17, the CI pipeline runs:
graph TD
subgraph "CI Workflow ci.yml"
Checkout["actions/checkout@v4"] --> Toolchain["dtolnay/rust-toolchain@stable"]
Toolchain --> Format["make fmt-check"]
Format --> Lint["make lint"]
Lint --> Build["make build (offline)"]
Build --> Test["make test"]
Audit --> CompilerAudit["tc --audit"]
Build --> Audit["make audit"]
Test --> Selftest["tc --selftest"]
CompilerAudit --> Repro["Reproducible ELF64 Build Check"]
Selftest --> Repro
end
click Checkout ".github/workflows/ci.yml" "CI workflow definition"
Figure 1.1.3: Continuous integration job sequence enforcing format, lint, offline build, audit, and binary reproducibility.
Sources: .github/workflows/ci.yml:[1-53]()
The repository .gitignore rules prevent build products, intermediate assembly files, interpreter logs, and editor-specific build artifacts from entering version control .gitignore:1-16. Excluded patterns include the workspace target directory (/target/), object files (*.o, *.s, *.elf), Python caches (__pycache__/), and Zed extension compilation directories (editors/zed/tc-eng-extension/target/) .gitignore:1-16.
Sources: .gitignore:[1-17]()
The TransCompilator Project