Re:Writing a C Compiler, Part 1
by pjmlp on Sunday December 03, 2017 @02:31AM
(#15836475)
The approach taken at my compiler course was one that I consider the best one for toy compilers, but it does mean having to deal with Assembly.
Do the generation to some kind of byte code as you are suggesting, but using an instruction format that be used as macro calls in macro assemblers.
Then just write the macros for each bytecode, doesn't matter matter if the register usage is bad, goal is just to have a plain native executable that runs.
Do the generation to some kind of byte code as you are suggesting, but using an instruction format that be used as macro calls in macro assemblers.
Then just write the macros for each bytecode, doesn't matter matter if the register usage is bad, goal is just to have a plain native executable that runs.