TinyCompiler: A compiler in a week-end
Published on: 2025-07-12 14:02:59
TinyCompiler: a compiler in a week-end
Introduction
Have you ever wondered how a compiler works, but you never found courage to find out? Then this series of articles is for you. I have never had the chance to look under the hood either, but one week-end I have decided to to write a translator from the esoteric programming language wend (short for week-end), which I just invented myself, into regular GNU assembly. The goal is to keep the code as tiny as possible, 500-ish lines of python sounds great. The main repository lives on github (don't forget to check out other tiny* repositories in my profile).
Spoiler alert: I am currently working on a tinyoptimizer, a minimalist optimizing compiler.
So behold, here is a program that uses virtually all concepts in wend:
Fixed-point square root 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 main () { // square root of a fixed-point number // stored in a 32 bit integer variable, shift is t
... Read full article.