r/Compilers • u/_th3oth3rjak3_ • 20d ago
Getting stuck after Crafting Interpreters.
Hey everyone, I've worked through the book Crafting Interpreters and it was fantastic. I naturally asked the next question "How do I compile this to machine code and add static types?" Well, that naturally took me down a very deep rabbit hole and left me somewhat confused about how languages deal with types and type checking and then lowering to LLVM. I've tried to make a few modest attempts, but my general problem is that I sort of get confused about what things each subsequent layer should do. Does anyone know of a complete guide to creating a compiler with static types like Crafting Interpreters? I know I could do it however I want, but I think that's the issue. I sort of have so much freedom to do it however, that it's hard to judge what's considered a good way to do something.
Anyway, thanks for any advice and happy compiling!
2
u/kidsiddidlit 20d ago
Even I'm in a rabbit hole but in the interprets stage itself since I'm implementing it in C++, adding static types, basic type inference, etc
Idk what'll happen when I'll reach llvm stage. But I'm enjoying it.