JIT compilation is a combination of Ahead-Of-Time (AOT) compilation and interpretation. As we saw previously, our
Calc interpreter evaluates AST to values (actual integer
i32 values) but a JIT compiler differs from an interpreter in what it outputs. Intuitively, JIT outputs are like AOT outputs but generated at runtime when traversing the AST.
LLVM which stands for Low-Level-Virtual-Machine, is a mature compiler backend (code generator) infrastructure powering many languages such as Clang, Rust, Swift, etc. It has its own IR and Virtual Machine Bytecode abstracting away the underlying platform-specific differences.
We will use inkwell which provides a safe Rust wrapper around LLVM. Remember to use the branch according to your installed