2 ms·
I would look at the LLVM tutorials, and maybe the insides of your favourite languages compiler (other than clang) When it comes to both parsing and emitting IR
by mhh__ 6y ago
I would look at the LLVM tutorials, and maybe the insides of your favourite languages compiler (other than clang)
When it comes to both parsing and emitting IR, keep it simple (stupid!) - the difficult bit (on a day to day basis) with the compiler is almost always the language semantics, the backend is more theory-dense but to just implement a language you can use LLVM as a black-box.
If you minimise mutable state and utilise lowering (you can implement foreach by lowering the AST to a for loop, for example) your compiler will be much easier to debug.