Silver is a statically typed systems programming language with an LLVM backend, automatic resource cleanup, ownership and borrow checks, OS threads, and a freestanding runtime. The Rust stage0 compiler bootstraps the Silver stage1 compiler. Their supported commands and checking coverage differ; see the stage1 checklist and verification record.
import std.io;
struct Point {
f64 x;
f64 y;
}
i64 compute(i64 val) {
return val * 2;
}
i32 main() {
Point p = { .x = 10.0, .y = 20.0 };
@println("Point: ({}, {})", p.x, p.y);
Task<i64> task = launch compute(21);
i64 answer = wait task;
@println("Computed answer: {}", answer);
return 0;
}
- Resource management: Automatic drop cleanup on scope exit via compiler-managed drop flags. Owned values transfer implicitly or with
move; see the ownership rules and cleanup fixture. - Borrowing: References (
&T,&mut T) carry borrow-origin checks. Raw pointers (T*) remain available for manual control and FFI. Borrow fixtures cover selected checks; complete typed control-flow analysis remains open. - Concurrency: OS tasks use
launchand explicitwait, with a Send check on arguments. A dropped task handle does not join the task. See task semantics and task fixtures. - Freestanding runtime: Pure-Silver runtime (
std/rt/) with no required C standard library dependency. - Tooling and diagnostics: Stage0 provides DWARF debug information and allocation leak tracking. Stage1 builds the AGLSP language server; its native option limits are listed in the compiler guide.
The syntax reference documents tuple values and destructuring, slices, selective imports, receiver shorthand, and the Optional/Result APIs, with links to their implementations and runtime fixtures.
Nix provides reproducible builds with LLVM 22, the compiler, and standard library sysroots:
# Install to profile
nix profile install github:CierCier/silver
# Or run directly without installing
nix run github:CierCier/silver -- run path/to/file.ag
# Enter a development shell
nix developDownload prebuilt archives from the Releases page. Extract the archive and add the binary directory to your PATH.
Prebuilt binaries require LLVM 22 runtime libraries (libLLVM-22 or libclang) and a system linker (cc, clang, or ld.lld).
Requirements:
- Rust toolchain supporting edition 2024
- LLVM 22 development headers and libraries (
inkwell/llvm-sys) - System C toolchain and linker (
cc,clang, orld.lld)
git clone https://github.com/CierCier/silver.git
cd silver
# Build compiler in release mode
cargo build --release -p agc
# Or install to ~/.local with
./scripts/install.sh# Compile to an executable
agc path/to/file.ag -o out
# Compile and run, forwarding program arguments after --
agc run path/to/file.ag -- input.txt
# Frontend type checking only
agc check path/to/file.ag
# Stage0: run with allocation leak tracking
agc run path/to/file.ag --leak-check# Emit a precompiled module (.agm)
agc path/to/file.ag --emit=module -o path/to/file.agm
# Stage0: emit a shared packaged module
agc path/to/file.ag --emit=module --shared -o path/to/file.agmThe Silver stage1 compiler builds native programs on x86_64 Linux using LLVM's
default host target. An explicit --target TRIPLE must match that triple
exactly. Unsupported native targets fail before source compilation or output
creation. Source and workspace check commands can use another target's cfg
values; lex, parse, and ast accept --target but dump the unfiltered
source. Neither frontend check nor dump establishes native support for that
target. The Rust stage0 compiler retains its separate cross-compilation paths.
See the compiler target contract for the scope of this restriction.
# Run compiler unit and parser parity tests
cargo test -p agc
# Run integration test suite
python3 tests/run_tests.py --no-tui
# Build stage1 with stage0 and run frontend parity gates
tests/selfhost/run_stage.sh --include-std
# Exercise stage1's Linux native backend and integration corpus
bash tests/selfhost/run_native.sh --no-tui --jobs 4bootstrap/stage0/agc/: Rust bootstrap compiler (stage0): driver, frontend, and LLVM backend, using Elise for parsingbootstrap/stage0/agsm/: Source maps and module artifact generatorbootstrap/stage0/ffi-rust/: Optional Rust implementation behind Silver's versioned C ABIbootstrap/aglsp/: Rust Language Server Protocol serverbin/agc/: Stage1 self-hosting compiler driver in Silver; see the compiler guidebin/aglsp/: Silver language-server binary packagebin/agc/src/agsm.ag: AGSM command integrated into the stage1 compiler driverlibs/agc/: Reusable stage1 compiler frontend library (Silver)silver.toml: Silver workspace manifest for the self-host rootstd/: Standard library (allocators, collections, I/O, networking, runtime)examples/: Sample programstests/: Unit, ownership, and integration test suitesdocs/: Language specifications and standard protocol designs
- Syntax Specification
- Agent Working Guide
- Contributing
- Compiler Architecture Reference
- Maintainer Preferences
- C ABI and FFI
- Standard Library Protocols
MIT