4 ms·
This might interest you: Writing a C Compiler by Nora Sandler (No Starch Press). You create a working C compiler that outputs x64 assembly language in the first
by drivers99 2y ago
This might interest you: Writing a C Compiler by Nora Sandler (No Starch Press). You create a working C compiler that outputs x64 assembly language in the first chapter (as long as the program only returns an integer from main) and then you keep adding features one by one for the rest of the book. You can write the compiler in any language you like (I’m using Python) and you only write the compiler while using your system’s precompiler (the step that handles #include and #define etc and removes comments), linker, and assembler. You just read preprocessed C as text and output assembly as text.
The thing that makes it relevant for learning assembly is that’s what you’re outputting so you’ll be learning that as well as what’s going on with the stack when calling and returning from functions and using local variables and basically everything that corresponds to C. (I’m only on chapter 2.)
Some other reasons it might work out for you is that you are getting into C as well already, and you have a familiar language you could use for the compiler if you wanted: java (assuming it doesn’t take too long to compile and run a java program repeatedly)
- fuzztester 2y ago>precompiler s/precompiler/preprocessor/g , i guess.
- drivers99 2y agoOops. Yes, you're correct.