News for hackers. Stuff that matters.
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course by weird_user on Monday March 13, 2023 @05:08AM (#35133036)
Compiling to machine code is not that hard once you get to the IR or bytecode phase, check out this toy compiler:

https://github.com/byo-books/pretty_laughable_lang/

Re:CS 6120: Advanced Compilers: The Self-Guided Online Course by celeritascelery on Monday March 13, 2023 @11:15AM (#35136846)
Is that really true? I would expect that going from IR to native code would be the hardest part because you have to worry about architecture and supporting different ISA’s. IR can be simple because it is abstract and hides lots of the dirty details of the hardware.
Re:CS 6120: Advanced Compilers: The Self-Guided Online Course by t-3 on Monday March 13, 2023 @11:46AM (#35137354)
Generating code is not all that hard. Generating fast code is a challenge. Decoding instructions on some architectures is hard. If you have a nice general IR naively generating native code can be just a table lookup with a register tracking/allocation routine.