r/Compilers • u/matthieum • Jul 28 '26
Inside Zig's Incremental Compilation | mlugg
https://mlugg.co.uk/posts/incremental-compilation-internals/
47
Upvotes
r/Compilers • u/matthieum • Jul 28 '26
View all comments
Show parent comment
2
u/matthieum Jul 29 '26
Thanks for the link, though it did not quite answer my question.
Agreed, though there's always a potential cost trade-off too, so the benefits must be worth the cost.
At the moment, it's just not clear to me what the benefits are. I see some checks occur as part of AstGen, but those checks could just as easily be executed on the AST itself without generating anything as far as I can tell.
For now, the one potential reason I could is that there's a desugaring/normalization step which occurs, which requires mutating/rewriting the AST anyway, and at that point targeting AST or a different format as an output is more or less the same processing cost. If on top some desugaring/normalization cannot easily be represented in the AST for any reason, then a different model becomes more attractive.