As a proof of concept, I would like to get a browser to be able to run LLVM IR. The basic idea would be that any language with an LLVM compiler, would be able to work as a first class citizen on the net. (Which is why I don't want to go the LLVM IR -> JS route for anything other than a "fallback")
The LLVM code should be able to all the same functions (e.g. DOM) with the same restrictions. I'm looking for pointers on getting started, where the best place to dive in is (I have C/C++ experience) and what the easiest browser is going to be to extend.
Ideally I'm looking for something very modular, so this is just another "scripting engine" as is the javascript one, as is any other future ones (e.g. direct python one)
Thanks very much
There's a secret in the compiler community. LLVM can compile to web assembly. LLVM is a tool used by languages like Clang and Rust as a universial intermediate representation(IR) that can be compiled down to machine code output. Web assembly is one of those outputs.
WebAssembly is normally compiled from a source language, which means that developers need tools to use it. Because of that, the V8 team works on relevant open-source projects like LLVM, Emscripten, Binaryen, and WABT.
Emscripten is a complete compiler toolchain to WebAssembly, using LLVM, with a special focus on speed, size, and the Web platform. Compile your existing projects written in C or C++ — or any language that uses LLVM — to browsers, Node. js, or wasm runtimes.
There are three Go compiler implementations supported by the Go team. These are gc , the default compiler, gccgo , which uses the GCC back end, and a somewhat less mature gollvm , which uses the LLVM infrastructure.
Emscripten is an LLVM backend targeting asm.js, which may be executed on all major browsers. The project dates back to 2010. This translates the IR into asm.js for you. Ideally you should be able to expand the project to support additional languages as opposed to just C/C++; either that or as a launching pad to put the other components in place prior to writing your bindings for the execution environment against the browser interfaces you desire.
asm.js has been used to run the Unreal engine, along with porting DosBox for Archive.org's game archives.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With