_ __ ______ ____ _ _ _
/ \ \ \ / / _ \ / ___|___ _ __ ___ _ __ (_) | ___ _ __
/ _ \ \ \ / /| |_) || | / _ \| '_ ` _ \| '_ \| | |/ _ \ '__|
/ ___ \ \ V / | __/ | |__| (_) | | | | | | |_) | | | __/ |
/_/ \_\ \_/ |_| \____\___/|_| |_| |_| .__/|_|_|\___|_|
|_|
"When Turing's Proofs Meet von Neumann's Performance"
⚠️ Alpha Software: Palladium is in active development (v0.1.1). APIs and language features are subject to change.
Palladium is a systems programming language that combines Turing's correctness with von Neumann's performance.
-
Memory Safety: Ownership and borrow checking at compile time
-
Type Safety: Strong static typing
-
Performance: Compiles to C, then to native code
-
Simplicity: Clean, readable syntax
-
Self-Hosting: achieved as a fixed point (see below)
bootstrap/pdc.pd is a Palladium compiler written in Palladium. It is verified as a fixed
point, not a demo — the C emitted by the stage-1 compiler and by the stage-2 compiler are
byte-identical:
$ make selfhost
== stage0: Rust pdc compiles bootstrap/pdc.pd ==
== stage1: pdc1 compiles bootstrap/pdc.pd == -> c1.c (993 lines) -> pdc2
== stage2: pdc2 compiles bootstrap/pdc.pd == -> c2.c (993 lines)
✅ SELF-HOSTING ACHIEVED — fixed point reached.
e8bd8cdac5460a250fe40bb80e1f9e9f3be20453 c1.c
e8bd8cdac5460a250fe40bb80e1f9e9f3be20453 c2.c
Earlier versions of this README claimed "100% bootstrap" while no Palladium-written compiler
had ever compiled itself; that claim was false and the compilers it pointed at could not have
worked. The language subset the bootstrap compiler is written in — and implements — is
specified in docs/specification/bootstrap-subset.md.
cargo install alan-von-palladiumgit clone https://github.com/labforadvancedstudy/palladium-a.git
cd palladium-a
cargo build --release
# Add to PATH
export PATH="$PATH:$(pwd)/target/release"Create hello.pd:
fn main() {
print("Hello, World!");
}
Compile and run:
pdc compile hello.pd -o hello
./build_output/helloOutput:
Hello, World!
fn main() {
// Immutable by default
let x = 42;
let y: i64 = 100;
// Mutable variables
let mut count = 0;
count = count + 1;
// Strings
let message = "Hello, Palladium!";
print(message);
}
fn add(a: i64, b: i64) -> i64 {
return a + b; // Explicit return required
}
fn greet(name: String) {
print("Hello, ");
print(name);
print("!");
}
fn main() {
let sum = add(10, 20);
print_int(sum); // Output: 30
greet("Palladium");
}
fn main() {
// if-else
let x = 10;
if x > 5 {
print("x is greater than 5");
} else {
print("x is 5 or less");
}
// for loops
for i in 0..5 {
print_int(i);
}
// while loops
let mut count = 5;
while count > 0 {
print_int(count);
count = count - 1;
}
}
struct Point {
x: i64,
y: i64,
}
enum Result {
Ok(i64),
Err(String),
}
fn divide(a: i64, b: i64) -> Result {
if b == 0 {
return Result::Err("Division by zero");
}
return Result::Ok(a / b);
}
fn main() {
let p = Point { x: 10, y: 20 };
print_int(p.x);
let result = divide(10, 2);
match result {
Result::Ok(value) => {
print_int(value);
}
Result::Err(msg) => {
print(msg);
}
}
}
fn main() {
// Fixed-size arrays
let numbers = [1, 2, 3, 4, 5];
let zeros = [0; 10]; // Array of 10 zeros
// Array access
let first = numbers[0];
print_int(first);
// Iteration
for i in 0..5 {
print_int(numbers[i]);
}
}
fn main() {
let x: i64 = 42;
let y: &i64 = &x; // immutable borrow — annotate it
print_int(*y);
let mut z: i64 = 10;
let w: &mut i64 = &mut z;
*w = 20;
print_int(z); // 20
}
# Compile a file
pdc compile program.pd -o program
# Compile with optimization
pdc compile program.pd -o program -O
# Show help
pdc --helpThere is one working backend: the default, which compiles to C. The --llvm
flag exists and refuses — the LLVM text backend is a skeleton kept for
development, not something you can build with. See
the specification §1.
When you compile, you'll see detailed progress:
🔨 Compiling program.pd...
📖 Lexing...
🌳 Parsing...
🔍 Type checking...
🔒 Borrow checking...
🌊 Analyzing effects...
⚠️ Checking unsafe operations...
🔧 Optimizing...
⚡ Generating C code...
✅ Compilation successful!
🔗 Linking...
- Functions,
let/assignment,if/else,while,for-over-range i32/i64/u32/u64,bool,String, fixed-size arrays- Structs; enums with unit/tuple/struct variants;
matchon enums - Top-level
constandstaticitems, withstatic mutfor writable storage - Ownership and borrow checking
- C code generation and linking
?operator — emits C referencing astruct Resultlayout codegen never definesasync/.await— emits a call to apollmember that is never generated- Generic types in a struct field, and tuples in a struct field or an enum payload — refused by name
- Generics — generic arguments that are all-uppercase are misparsed as const generics
forover an array parameter — usessizeofon a decayed pointer
This list is older than the compiler in places. The pattern and tuple entries were corrected when issue #41 landed; the entries marked (stale) were falsified by earlier branches and are left standing rather than quietly deleted, because correcting them is that branch's receipt to write, not this one's.
docs/specification/language-spec.md's A-sections are the measured status.
- Traits (parse, then emit nothing — no dispatch mechanism exists)
- Closures
- (stale) method call syntax
obj.method(),else if,loop— all implemented byfeat/m2-expressions - (stale) floats, bitwise operators, compound assignment (
+=),ascasts — same branch - Chars as a distinct TYPE (
'a'lexes and carries its scalar; its type isi64) - Slice patterns,
ref/mutbindings, field shorthand in a struct-variant pattern, destructuringlet - String interpolation
- Macro hygiene — expansion is textual and a macro body reads the CALL SITE's names. The macro
system itself works for a token template with
$namesubstitution (macro double!(x) { $x * 2 }). What a macro BODY or ARGUMENT may contain is a closed set and everything outside it is refused by name — non-integer literals, two-character operators, a bare parameter name, an unknown$name, a nested invocation. The three unusable builtins are NOT in that set:println!,assert!anddbg!fail with ordinary parse errors from their own expansions, whichA4.6of the specification lists shape by shape
- A
matchon any type other than an enum or aboolneeds a_or binding arm: no set of literal or range arms is complete, and coverage by ranges is not checked - A chained tuple index needs parentheses —
(p.0).1, because.0.1lexes as one float literal - A one-element tuple
(e,)is not a form this language has;(e)is grouping printandprint_intoutput on separate linespdcmust be run from the repository root: it linksruntime/palladium_runtime.cby relative path
Feature-by-feature status with evidence: docs/specification/language-spec.md.
Run scripts/conformance.sh to reproduce the current numbers.
# Clone repository
git clone https://github.com/labforadvancedstudy/palladium-a.git
cd palladium-a
# Build in release mode
cargo build --release
# Run tests
cargo test
# Install locally
cargo install --path .- Getting Started Guide
- Language Specification — what the compiler actually implements
- Bootstrap Subset (PBS-1) — the self-hosting target
- User Guide
- Examples
Check out the examples/ directory:
examples/tutorial/- Step-by-step tutorialsexamples/practical/- Real-world examples
# Run an example
pdc compile examples/tutorial/01_variables.pd -o vars
./build_output/varsWe welcome contributions! Areas where help is needed:
- Standard library implementation
- Documentation improvements
- Bug fixes
- Test coverage
- LLVM backend improvements
Please see our Contributing Guide for details.
Performance comparisons coming soon. Goal: within 10% of C performance.
Palladium aims to be:
- Safe: Memory and type safety by default
- Fast: Zero-cost abstractions, optimal performance
- Simple: Clear syntax, minimal complexity
- Practical: Designed for real systems programming
Palladium is released under the MIT License — see LICENSE.
(Earlier revisions of this section advertised a dual MIT/Apache-2.0 licence and linked to
LICENSE-MIT and LICENSE-APACHE. Neither file has ever existed in this repository, and
Cargo.toml declares MIT.)
Special thanks to:
- All contributors to the compiler and standard library
- The Rust community for inspiration
- Alan Turing and John von Neumann for their legendary contributions to computing
Project Status: Alpha (v0.1.1) | Self-hosting: not achieved — see docs/specification/bootstrap-subset.md
"Combining Turing's correctness with von Neumann's performance"