A programming language designed for AI agents to write kernel code
If an AI can read a file and fully understand it in one pass, the language is doing its job. Foundation removes everything that exists to help humans manage complexity that AI doesn't struggle with.
// memory.f — this file IS the memory object
page_size: u64 = 4096
free_pages: []ptr = []
fn allocate(size: u64) -> (ptr, err):
// ...
return (address, OK)
fn free(address: ptr) -> err:
// ...
return OK
export allocate, free
Properties are state. Functions operate on them. Import to use as singleton, new to instantiate. The consumer decides.
u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 ptr bool byte err — types exist because the CPU needs them.
loop: with break and continue. No for, no while. One way to loop.
new gives defaults. Set properties directly. Call functions. Dead simple.
import for compile-time linking. load is specified for future runtime hot-swap modules.
The bootstrap compiler currently runs 13 regression tests. Formal .f.test module support is specified but not implemented yet.
| Feature | Why Not |
|---|---|
| Classes / inheritance | The file is the object |
| Generics | AI can duplicate code trivially |
| Async / await | Concurrency is the scheduler's job |
| Exceptions | Return errors explicitly |
| Macros | What you see is what runs |
| Garbage collector | Manual memory, tests catch mistakes |
| Package manager | Files import files — the project IS the package |
The bootstrap compiler is written in C and passes 13 regression tests. The self-hosting compiler is written in Foundation itself and has been proven across three generations: compiler builds itself, that binary builds itself again, and the third generation passes its test suite.
Some language features are still specified ahead of implementation: float codegen, array/map/tuple literals, field access, match codegen, dynamic load, new instance dispatch, and tuple unpacking.
Concise LLM view: llms.txt
Full language specification: foundation.md