Open EdHeller opened 5 months ago
There are lots of more things to do to run the compiled executable in browser. We are now using Emscripten for compiling llvm but those C++ code will be compiled to wasm32-wasi. So we also needs a browser-based WASI implementation. As a result, we will ship clangd/clang/lld in Emscripten-packaged environment (and filesystems), and also a WASI environment (and filesystem). This is too complicate (in my opinion).
There might be a solution to this, that is, just use WASI to compile and run everything, including LLVM and user-compiled programs. But I'd tried that LLVM on WASI cannot run inside browser (may be due to memory size limit?). And also, clangd -- a multi-threaded program -- is not available under wasi-preview2.
That's why I decided to use Compiler Explorer API for compiling stuff. If you have a better solution, you are welcomed to give a PR 😄
Wouldn't it be better to compile to a wasm target and run that output in the browser? Similar to binji/wasm-clang just with nice syntax highlighting for Monaco.