This is a small compiler, offering a basic C-like language which compiles into WebAssembly.
i32 fact(i32 n) {
if (n == 0) {
return 1;
}
return (n * fact(n - 1));
};
export i32 main(i32 a, i32 b) {
return (fact(a + b));
};
- Scanner: Creates a token array out of the input
- Parser: Eats tokens and generates an AST out of them
- Emitter: Recursively walks the AST (Luke ASTwalker) and clumps together a uint8 array which gets passed over into WebAssembly
- Structs (with import/export bridge to JavaScript)
- Pointers (I always get a strange bug when trying to store something in memory)
- Feel free to send any kind of pull request as long as it's not grandmmar fixxes ⭐