Ubaid Shaikh (@Ubaid-Shaikh) who is this year’s Fortran-lang/LFortran GSoC student has created a demo of LFortran running fully in the browser:
It uses his WebAssembly backend that he wrote (so LFortran is compiled without LLVM, and thus it is much smaller / loads faster and it also compiles faster). The page allows you to execute Fortran code, as well as show AST, ASR, WAT and C++ translations.
You can try to break the code, either wrong syntax or wrong semantics and you should get a nice error message, in color, with the line highlighted and exact code underlined, etc.
Current limitations:
- The LFortran runtime library is not supported yet, so you cannot use functions like
sin(x)
. We’ll fix that later. - LFortran itself does not yet compile all of Fortran yet, I would say it’s somewhere between alpha and beta.
- The ASR->WASM backend that Ubaid is writing that the above demo uses currently supports a smaller subset (much less than our default LLVM backend), that is the main task of his GSoC project to expand it to support everything
What I really like is how fast it compiles, it seems immediate for me on my phone or computer (when you click the “Run” button). And also the page seems to load very fast.
Once this is more tested, and we get the runtime library working, I would like to have it on lfortran.org page itself (probably a subpage, not the very front page).
Please let us know any feedback!