The very basic C compiler for fun and education written in C++. It's just a starting point.
It's mostly based on Nora Sandler's "Writing a C Compiler" and Robert Nystrom's "Crafting Interpreters".
For now can compile just a simple main function with return statement.
- Tokenizes source code with regexps.
- Recursive descent parser builds an AST for C.
- Then we build an AST for Assembly representation.
- Finally we walk through Assembly AST and generate Assembly instructions compatible with MASM.
To build exe from output assembly file run masm_build.bat.
Note
You have to have Visual Studio installed so x64 Native Tools Command Prompt is available.
You can either to run x64 Native Tools Command Prompt and then locate and run masm_build.bat
or you can just locate ml64.exe and add it's directory to Path so you can run masm_build.bat from anywhere.
