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 for runtime hot-swap modules.
Every .f file has a .f.test. The build refuses to compile if tests don't pass.
| 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. The self-hosting compiler is written in Foundation itself — it passes 6/6 tests and supports multi-file builds with import resolution.
Full language specification: foundation.md