munificent / craftinginterpreters

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

Compiling bytecode to assembly #1163

Closed davidoskiii closed 4 months ago

davidoskiii commented 5 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 4 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 4 months ago

Ok, thank you :D