The code generator is inspired by "Destination-driven Code Generation"
by Dybvig, Hieb and Butler. There are some differences however. The code
generator in the paper generates "flat" code (assembler) whereas I
generate nested Web Assembly instructions.
This approach generates reasonable code without having to implement
a register allocator. Also, I believe I saw a Wasm to Wasm compiler
that improved register allocation (maybe it was a switch for wasm-tools?).
If (when?) WebRacket becomes a success, we can always switch out individual passes.
The representation is explained here:
https://github.com/soegaard/webracket/blob/main/compiler.rkt...
Internally the compiler uses a series of passes implemented using Nanopass.
The code generator is inspired by "Destination-driven Code Generation" by Dybvig, Hieb and Butler. There are some differences however. The code generator in the paper generates "flat" code (assembler) whereas I generate nested Web Assembly instructions.This approach generates reasonable code without having to implement a register allocator. Also, I believe I saw a Wasm to Wasm compiler that improved register allocation (maybe it was a switch for wasm-tools?).
If (when?) WebRacket becomes a success, we can always switch out individual passes.