Questions about Fortran software tools

If you (and/or anyone else) is interested in this, please let me know!

There are two parts: Getting LFortran to compile Fortran to WebAssembly (WASM), we have a prototype working: Draft: Initial support for WebAssembly (!1385) · Merge requests · lfortran / lfortran · GitLab.

And then getting LFortran itself to run in WASM. Just yesterday I got it working! Here is a demo:

Emscripten-Generated Code

This runs LFortran fully in the browser in WebAssembly (WASM). You have to click the “Run LFortran” button. It parses the code, and prints AST and ASR. The full LFortran C++ compiler runs (it’s quite amazing). And it’s immediate. Try modifying the code and rerun. You can try compiler errors too. Ignore the black box, I used a template html from Emscripten. I didn’t get LLVM working in WASM yet, that seems like a big task. Although others seem to have done that. The alternative is to write a direct ASR->WASM backend, here are some relevant links:

Once LFortran can generate WASM and runs in the browser, it will work in Jupyterlite, which fully runs in the browser. People can use it to create demos on their static pages. We can use it for the standard committee, by implementing some new feature proposal in LFortran and host a static website where anyone can try out the feature.

So there are a lot of interesting ideas that can be done.

I am also looking for people to help make the above html page look good. Here is one idea how it can look like:

Mandelbrot example | The AssemblyScript Book

That page has a nice editor, that you can edit the code, it gets compiled to WASM and you can execute it. It’s very nice and fast. This can be done with Fortran now.