This is a more serious version of compiler-exercises, so it's a toy compiler written in rust.
You can find the language it compiles in the LANGUAGE.md file.
To make this project a bit more readable I've divided the project in three parts:
coldpiler_parser
contains the boilerplate code for the lexer and parsercoldpiler_codegen
provides the procedural macros that generate the code for lexer and parsercoldpiler
the heart of the compiler
My plan is to go to 0-dependencies but if you want to use procedural macros syn
and quote
are almost required,
so I consider them (and proc_macro2
) as part of the standard library.
This is not because of lazyness but because they just provide a good way to remove boilerplate code and they fall out of the scope of this project.
I've tried to comment the strangest parts of the code but I should come back and explain more of what's going on. That said the strongly-typed nature of rust helps understand more than python, so I'd use this project over the python one to comprehend what I've done.
I plan to transform this project into a real compiler for my own language. The plan is not to use any dependency and to write any nontrivial algorithm/data structure myself.