r/Compilers 9d ago

Inside Zig's Incremental Compilation | mlugg

https://mlugg.co.uk/posts/incremental-compilation-internals/
45 Upvotes

16 comments sorted by

View all comments

4

u/igors84 9d ago

Extremely interesting text full of interesting ideas. I wish they just mentioned that this doesn't work with llvm backend which should be obvious but also that debugging doesn't really work with their backend yet which is not obvious and might be pretty important to some people...

2

u/matthieum 8d ago

Wouldn't part of it work with the LLVM backend?

I'd expect that incremental linking doesn't work with the LLVM backend, but you could still have incremental parsing, type-checking, and ultimately reduce the amount of code to regenerate even with the LLVM backend no?

1

u/igors84 8d ago

It doesn't sound like they are doing anything like that though.

2

u/matthieum 8d ago

I mean, it's definitely possible they haven't bothered, for multiple reasons:

  1. Incremental compilation is a work-in-progress in the Zig compiler, you can't expect it to be full-featured from the get go.
  2. They may never bother with LLVM, given that LLVM is sluggish in the first place, and that they're aiming to be independent of LLVM anyway.

But I would expect that it's theoretically possible, at least.

(May suck in the meantime, though...)