2024-01-17
Reasons for implementing wasm backend for clojure compiler:
To make a WASM backend to the clojurescript compiler we need to replace emit functions in the compiler ⬀ for example using wasm.cljc ⬀.
To make the compiler development interactive in the clojure repl we could run the resulting wasm modules with wasmer-java ⬀ or wasmtime-java ⬀. Wasmer and Wasmtime are still lacking GC though. V8 has wasm GC, but it's not clear wether it's Java bindings Javet ⬀ or J2V8 ⬀support running wasm. Calling J8 directly using the Java's new Foreign Function & Memory API ⬀ could work also.
We need to implement low level functionalities such as the big integers and string manipulation which are inherited from java and javascript in clojure and clurescript. We could use c or rust libraries for those.
Developing a lower level language with the Clojure syntax interactively in Clojure repl could be a nice experience also.
This site is generated with zetgen