![]() |
|
![]() |
|
I was unable to understand the llvm source well enough to understand your point. Are they working on a WebAssembly port that will get their intermediate code to a point where Fortran works?
|
![]() |
|
> Weird that it doesn't go into LFortran more, they even have an excellent online and mindblowing WASM example. They write: The LFortran compiler has made great strides over the last few years. In 2020, it was missing a lot of features and only supported a very small subset of Fortran. Now it now supports a much wider range of language features and can be used to compile a reasonable amount of Fortran code. It can even compile to WebAssembly out of the box! However, there are still some barriers that make using LFortran a little rough. The project is currently considered to be in alpha phase and the developers state that issues compiling real-world code are expected. While it can successfully compile some projects, such as MINPACK, the full Fortran specification is not yet supported and so many larger projects still cannot be compiled. The LFortran developers are targeting full support for Fortran 2018, and its standout feature is an interactive Jupyter-like Fortran REPL. With a few more years of development, I expect that LFortran will be an excellent choice for compiling Fortran code for WebAssembly. and Check out the LFortran demo at https://dev.lfortran.org. While extremely impressive, note that the first thing I tried was changing x * 2 to x * 3 and saw that such a change is currently not supported by the code generator. |
![]() |
|
The author of LFortran here. The demo at https://dev.lfortran.org uses our direct WASM backend that does not use LLVM. It is currently more limited, and indeed, we currently do not support the cubic power x**3 there, only square power x**2. Our most advanced backend is LLVM, and that of course supports x**3 and a very wide subset of Fortran (such as 60% of all SciPy packages fully compile and all SciPy tests pass). However, LLVM is huge and relatively slow, so we do not use LLVM in the online demo, which runs the compiler itself in the browser. For offline LLVM based WASM compilation I think LFortran is ready be tried. We'll be happy to help! |
![]() |
|
I’ve been reading these articles for years, but I’ve yet to experience any practical use of webassembly outside of contrived demos. Where do people use all this stuff? Does anyone use it?
|
![]() |
|
Cloudflare workers use them for portability/v8 isolate compatibility/speed/isolation, Figma uses for the main editor, a bunch of Web3 stuff uses them for ???
|
With the patches to LLVM Flang, WebR can be built with a real Fortran compiler.
I think George didn't want to say it directly in the blog post, but he has said that he's hoping that Flang would take his patches or implement better ones. That would be a win-win -- these patches wouldn't need to be maintained separately, and since unmodified Flang would be able to compile to wasm, it would benefit other projects out there that use Fortran.
https://docs.r-wasm.org/webr/latest/