Nanopass Framework: Clean Compiler Creation Language
112 points - last Wednesday at 11:38 AM
SourceComments
verdagon yesterday at 3:37 PM
I'm often skeptical of the desire to create a lot of passes. In the early Vale compiler, and in the Mojo compiler, we were paying a lot of interest on tech debt because features were put in the wrong pass. We often incurred more complexity trying to make a concept work across passes than we would have had in fewer, larger passes. I imagine this also has analogies to microservices in some way. Maybe other compiler people can weigh in here on the correct number/kind of passes.
s20n yesterday at 4:13 PM
I agree with the notion that having multiple passes makes compilers easier to understand and maintain but finding the right number of passes is the real challenge here.
The optimal number of passes/IRs depends heavily on what language is being compiled. Some languages naturally warrant this kind of an architecture that would involve a lot of passes.
Compiling Scheme for instance would naturally entail several passes. It could look something like the following:
Lexer -> Parser -> Macro Expander -> Alpha Renaming -> Core AST (Lowering) -> CPS Transform -> Beta / Eta Reduction -> Closure Conversion -> Codegen
Mathnerd314 yesterday at 2:17 PM
website is not up to date, https://www.youtube.com/watch?v=lqVN1fGNpZw is not on there
presz yesterday at 5:16 PM
We really need to get more designers interested in Scheme, because that logo is awful
vmsp yesterday at 4:42 PM
Wouldn't this kind of architecture yield a slower compiler, regardless of output quality? Conceptually, trying to implement the least-amount of passes with each doing as much work as possible would make more sense to me.
ape4 yesterday at 7:05 PM
Can it only make compilers for Lisp-like languages
deleted yesterday at 2:05 PM