Another refactor: split the AST into pre-AST (the one where all statements are linearized and independent, and only know their indentation) and the actual hierarchical AST. Removing stupid code feels good, should've done that long time ago!
@lisyarus That's a tension I met when creating language projects as well. Making more IR formats/passes feels wasteful (and also takes a lot of effort), but it simplifies so many problems down the road
@lisyarus Also, static typing kind of becomes a hindrance for this kind of frequent data transformation (no wonder "nanopass compilers" are more popularized in Scheme). Having 2 IR that look almost identical but have some small differences? With dynamic typing, one can just YOLO it. With static typing, it boils down to either duplicating a lot of types or using some generic sorcery.
@lesley@lisyarus i really like the approach llvm’s new “multi-level ir” took to solve this, basically instead of 1-2 IRs they have 20ish IRs called “dialects” and they’re each focused on a different aspect like math ops or loops. U then lower just a little bit at a time and u can write passes at any stage to take advantage of the different info/guarantees.