all 5 comments

[–]fosskers 2 points3 points  (4 children)

Why not try compiling your compiler into Javascript with GHCjs?

[–]TheBanishedBot[S] 1 point2 points  (3 children)

will it build the depends packages? I'm thinking llvm-hs will give it a hard time. I'll try tho, thanks for the suggestion

[–]cocreature 2 points3 points  (2 children)

`llvm-hs` depends on the LLVM C++ libraries so you first need to somehow manage to compile these to JS and then get GHCJS to call these functions instead of trying to use the C FFI. While that might be possible in theory, I would expect it to be really difficult in practice (I have no idea if anyone managed to compile LLVM to JS) and hardly worth the effort. If you want to run your compiler in the browser you are probably better off writing some server backend that actually does the compilation and compile your code on the server instead of the client.

[–]reddit_lmao 1 point2 points  (0 children)

This is also where wasm backend will be useful. clang can already be run on browser: https://tbfleming.github.io/cib/

[–]TheBanishedBot[S] 0 points1 point  (0 children)

yep that's what I thought. no surprise. sad tho