µDewy

Just Enough Language

µDewy is a strict subset of Dewy for bootstrapping. Small enough to be implemented in assembly but large enough to be useful. A well-formed µDewy program behaves the same under both compilers.

curl -fsSL https://dewy-lang.org/udewy/install.sh | bash

The install gives you udewy — or run it in the browser.

hello.udewyruns today ✓
let main = ():>int => {
    let msg:int = "Hello from udewy!\n"
    let len:int = __load__(msg - 8)
    __syscall3__(SYS_WRITE STDOUT msg len)
    return 0
}
Output
Hello from udewy!

µDewy is the trusted computing base while Dewy is the everyday language built on top.

Small on purpose

No types, everything is a 64-bit word, and explicit memory.

targetsimplemented ✓
1$supported_targets = ["x86_64" "wasm32" "riscv" "arm" "c"]
2
3if $target =? "wasm32" {
4    import p"./entry_wasm.udewy"
5}
6if $target =? "x86_64" {
7    import p"./entry_sdl.udewy"
8}
backends

One program, several machines

Linux x86_64, WebAssembly, RISC-V, AArch64, and C share the same source. Target conditionals pick the host surface; the language in the middle stays the same.

memory.udewyimplemented ✓
1let p:int = __alloca__(16)
2__store__(42 p)
3let n:int = __load__(p)
4
5# Width is explicit. Nothing is implied.
6__store_u8__(255 p)
7let byte:int = __load_u8__(p)
intrinsics

Memory you can point at

Loads, stores, syscalls, and host functions are named operations. A backend maps each one to the machine. There is no garbage collector walking later.

bootstrapimplemented ✓
1# The µDewy compiler, written in µDewy
2python -m udewy -c udewy/bootstrap/main.udewy
3
4# Then the binary compiles itself
5./__dewycache__/udewy/bootstrap/main -c udewy/bootstrap/main.udewy
trusted base

The compiler compiles itself

The Python reference implementation is how you start. The bootstrap under udewy/bootstrap/ is the same compiler in µDewy, and it already self-hosts on x86_64 and C.

showcasein the browser ✓
1# Plasma, water, slime volleyball
2# μCrypt, μZero2
3
4python -m udewy \
5    --target wasm32 \
6    udewy/tests/uzero2/uzero2.udewy
in the browser

Games from the same subset

Raycasters, racers, and shaders compile to a single HTML file. Open the showcase and run them here.

1# Dewy → typed HIR → µDewy → machine
2# The spec in udewy/README.md is this book.
next

Where to go next

  • Showcase — compiled demos in the browser
  • Spec — the µDewy language specification
  • Playground — type and run µDewy
  • VS Code — syntax highlighting
  • Dewy — the everyday language