Minute Compiler
A compiler for a subset of C that emits x86-64 AT&T assembly, with a differential test harness that checks every program against gcc.
- programs diff-tested against gcc
- 52
Try it
Your C goes through the real compiler, built to WebAssembly from minute-compiler@40b9116. The assembly it emits then runs in a small x86-64 interpreter, all inside your browser.
The supported language is int only: arithmetic, comparisons, locals, if/else, while, for, and functions with up to six arguments. There's no printf, so main's return value is the output. Runs stop after 20 million instructions or 1 MiB of stack.
Pipeline
A lexer, a recursive-descent parser with operator precedence, and a symbol-table pass that assigns rbp-relative stack slots to locals before codegen.
Calling convention
System V AMD64, with arguments in rdi, rsi, rdx, rcx, r8 and r9, a frame per function, 16-byte stack alignment at call sites, and self and mutual recursion.
