# LLVM Flang + Emscripten Compiler

**URL:** <https://fortran-lang.discourse.group/t/llvm-flang-emscripten-compiler/2152>\
**Category:** Announcements\
**Created:** [October 24, 2021, 6:07pm UTC](https://fortran-lang.discourse.group/t/llvm-flang-emscripten-compiler/2152 "2021-10-24T18:07:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![R\_cubed](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/r_cubed/32/263_2.png) [@R\_cubed](https://fortran-lang.discourse.group/u/R_cubed)\
**Post date:** [October 24, 2021, 6:07pm UTC](https://fortran-lang.discourse.group/t/llvm-flang-emscripten-compiler/2152/1 "2021-10-24T18:07:35Z")

</div>

Considering this announcement

> [@LLVM 11.0 Finally Available With Flang Fortran Compiler](https://fortran-lang.discourse.group/t/llvm-11-0-finally-available-with-flang-fortran-compiler/341):
>
> Does anyone have experience installing this? I would be grateful to learn how well it works. I believe this is also worth including in the next Fortran monthly newsletter.

has there been anyone trying to get modern Fortran code to compile to webassembly via Emscripten?  
I know of a few prior experiments, but integration into LLVM should make this much easier if the [about page](https://emscripten.org/docs/ihttps://emscripten.org/docs/introducing_emscripten/about_emscripten.html) for Emscripten is accurate.

> Blockquote  
> Compile C and C++ code, **or any other language that uses LLVM** , into WebAssembly, and run it on the Web, Node.js, or other wasm runtimes.

I’d like to expand upon a few R simulations I did awhile back on the repeat sampling behavior of p-values, make it a single page application, and expand on their relationship to Bayesian methods. I’d prefer to do this in Fortran + Typescript, but might have to use a c/c++ library for the numerical aspects.

> **[Stability of results from small RCTs](https://discourse.datamethods.org/t/stability-of-results-from-small-rcts/2287/12)**
>
> Blockquote The ANDROMEDA-SHOCK trial discussion on this platform discussed how a Bayesian approach might allow a more nuanced interpretation of smaller RCTs whose results don’t reach “statistical significance,” but where early data seems to be...

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [October 24, 2021, 6:57pm UTC](https://fortran-lang.discourse.group/t/llvm-flang-emscripten-compiler/2152/2 "2021-10-24T18:57:26Z")

</div>

Yes, we got simple examples working with LFortran thanks to Carlos Une:

> **[Draft: Initial support for WebAssembly (!1385) · Merge requests · lfortran /...](https://gitlab.com/lfortran/lfortran/-/merge_requests/1385)**
>
> This is initial support for WebAssembly. It generates wasm binaries in the right format, we can execute it in the browser, but there are bugs, see below.

If anyone is interested in helping us expand this and make this very usable, please let us know.

---

<div class="post-metadata">

**Author:** ![R\_cubed](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/r_cubed/32/263_2.png) [@R\_cubed](https://fortran-lang.discourse.group/u/R_cubed)\
**Post date:** [October 24, 2021, 7:03pm UTC](https://fortran-lang.discourse.group/t/llvm-flang-emscripten-compiler/2152/3 "2021-10-24T19:03:44Z")

</div>

I’ll be playing around with this! I shouldn’t need to do anything terribly intensive, just converting from p (on a 0-1 scale) to probits (-\infty \< Z \<+\infty). I’m almost positive there are Fortran intrinsic functions that already compute these things.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [October 25, 2021, 1:07am UTC](https://fortran-lang.discourse.group/t/llvm-flang-emscripten-compiler/2152/4 "2021-10-25T01:07:11Z")

</div>

If you need any intrinsic that is not yet implemented in LFortran, please report a bug and we’ll fix it.
