Built a programming language from scratch in C. Wanted to understand how languages actually work under the hood.
It has a lexer, parser, AST, bytecode compiler, and a stack-based VM. Also supports arrays, dicts, classes, try/catch, and a stdlib.
class Animal {
fn init(name, sound) {
self.name = name
self.sound = sound
}
fn speak() {
print self.name + " says " + self.sound
}
}
let dog = Animal("Rex", "woof")
dog.speak()
Learned more from this than from anything I’ve read. Compilers are not magic.
Source: github.com/aaka3h/lang