Forge is a systems programming language compiled by forgec from .dev source files.
forgec is self-contained: it parses .dev source and writes native
executables directly, without calling LLVM, clang, NASM, ld, or any other
external toolchain. One binary, straight to machine code.
Mascot — Say hello to Spark! The forge's flame — small but intense, turning raw code into native metal. You'll find Spark throughout the docs and examples, reminding you that Forge compiles directly to machine code, no intermediate layers.
- Native codegen, no toolchain — emits machine code and object format (ELF64, ELF32, or flat binary) directly from Rust
- Five target configurations — x86_64 and x86_32 Linux executables, a flat 512-byte x86 real-mode boot sector, plus raw flat-binary kernels for x86_32 and x86_64 (boot-to-32-bit and boot-to-64-bit chains)
- Python-like syntax — indentation-based:
def,let/var,if/elif/else,for/while/loop,match/case,struct,ascasts - Generics & tuples — generic functions and structs monomorphized per instantiation, tuple literals/types/destructuring, and block expressions end-to-end
- Low-level control — raw pointers,
unsafeblocks,externdeclarations, width-correct volatile access - Module system —
std.*imports resolve tocore/<name>.dev(or the stdlib embedded in the binary when nocore/is present); user modules resolve to local.devfiles - Memory management — first-fit heap allocator with optional conservative mark-and-sweep GC (x86_64)
- Bare metal — the bootloader example is written entirely in Forge, no inline assembly required
cargo build --release
./target/release/forgec examples/hello.dev -o hello --target x86_64-unknown-linux-gnu
./hello
# Hello, Forge!Prebuilt binaries are published as nightly releases.
The compiled forgec binary is fully self-contained — the standard library is
embedded, so no core/ checkout is needed. Arch Linux users can install it
from the AUR as forgec-git
(paru -S forgec-git).
The full documentation lives in the mdbook and is deployed to GitHub Pages:
examples/— sample Forge programs, including a hosted hello world, stdlib exercises, and a bare-metal bootloadercore/— standard library modules imported asstd.*(e.g.core/io.devisstd.io)src/lexer/,src/parser/,src/ast/— Python-like frontendsrc/sema/,src/lower/— type checking and AST → IR loweringsrc/backend/— x86-64, x86-32, and 16-bit assemblers and code generatorssrc/obj/— ELF64/ELF32 executable and flat binary writerstests/— Rust-based unit and integration tests
| Module | Highlights |
|---|---|
std.io |
puts, putchar, getchar, rand, exit, plus syscalls (open, read, write, socket, fork, waitpid, …) |
std.runtime |
abort, exit |
std.mem |
copy_bytes, set_bytes, zero_bytes, compare_bytes |
std.string |
strlen, strcmp, strncmp, strstr, strchr, strcat, strncpy |
std.math |
abs_i32, min_i32, max_i32, clamp_i32 |
std.fmt |
format_i32, format_f64 |
std.volatile |
width-correct loads/stores and memory barriers |
std.hal |
freestanding hardware primitives: port I/O (outb/inb/outw/inw), inline INT nn, sti/cli/iret/halt, PIC 8259A init + EOI |
std.alloc |
alloc/free over a first-fit heap; auto-GC on exhaustion (x86_64) |
std.gc |
collect, leak_check, heap stats (x86_64 only) |
| Target triple | Description | Status |
|---|---|---|
x86_64-unknown-linux-gnu |
64-bit Linux (ELF64) | Supported |
x86_32-unknown-linux-gnu |
32-bit Linux (ELF32, i686) | Supported |
x86_16-boot |
16-bit x86 real-mode boot sector | Supported |
x86_32 raw (.fld) |
Freestanding flat kernel, boot-to-32-bit chain (examples/os32) |
Supported |
x86_64 raw (.fld) |
Freestanding flat kernel, boot-to-64-bit chain (examples/os64) |
Supported |
x86_64-apple-darwin |
64-bit macOS (Mach-O) | Planned |
x86_64-pc-windows-gnu |
64-bit Windows (COFF) | Planned |
riscv64-unknown-elf |
64-bit RISC-V bare metal (ELF) | Planned |
Forge's roadmap lives in ROADMAP.md, a living document of
features and improvements organized by theme. These ideas are preliminary and
may fluctuate and change over time as Forge matures — they are a starting
point for discussion, not a fixed contract. Feedback, corrections, and new
proposals are welcome.
To propose a new item, open a pull request amending ROADMAP.md (or GitHub
issues for broader discussion).
See CONTRIBUTING.md for guidelines on:
- Development workflow
- Code style and testing requirements
- Pull request process
- Commit message format
Forge is licensed under the MIT License — see LICENSE for details.
