Get the latest tech news
Baby's second WASM compiler
(This is part of a series on the design of a language. See the list of posts here.) The zest compiler today is ~4500 loc with no dependencies except the zig standard library.
desugar resolves names converts closures into regular functions that take an extra argument desugars destructuring into imperative code replaces mutable variables with ref values creates wrappers for each function that can be called dynamically inserts staging annotations on struct keys inserts asserts to prevent mutable references from escaping produces dir (dynamic intermediate representation) In the long run I want to take advantage of the fact that mutable value semantics gives me very cheap alias analysis to detect when a copy is actually needed. I think the solution here is first move constant propagation into the infer pass, then take option 1 above and use the indirect trick in tir so that I can insert a load between the first and second arguments after looking at their walues.
Or read this on Hacker News