4 ms·
Are there any architectural similarities or crossover with Hoot (Guile Scheme -> Wasm) or are you taking a completely different approach?
by michaelsbradley 9mo ago
Are there any architectural similarities or crossover with Hoot (Guile Scheme -> Wasm) or are you taking a completely different approach?
- soegaard 9mo agoI am using a similar representation of immediates as Hoot and wasm_of_ocaml. The representation is explained here: https://github.com/soegaard/webracket/blob/main/compiler.rkt#L3763 https://github.com/soegaard/webracket/blob/main/compiler.rkt... Internally the compiler uses a series of passes implemented using Nanopass. (generate-code (flatten-begin (closure-conversion (anormalize (categorize-applications (assignment-conversion (α-rename (explicit-case-lambda (explicit-begin (convert-quotations (infer-names (flatten-topbegin (parse (unexpand (topexpand stx))))))))))))))) 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.