munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
9.05k stars 1.06k forks source link

Compiling bytecode to assembly #1163

Closed davidoskiii closed 6 months ago

davidoskiii commented 7 months ago

I know that there isn't a direct method to do so, but how would you handle compiling to assembly or any other intermediate language from the bytecode interpreter without starting from scratch. And how do other language compilers treat the different flavours of assembly? Do they have a different compiler for each architecture?

munificent commented 6 months ago

That's a much bigger topic. :) If you want the answer to that, you'll want to dig into a compiler textbook. I really like Cooper and Torczon's "Engineering a Compiler".

davidoskiii commented 6 months ago

Ok, thank you :D