# What is the exact difference between LLVM Flang and LFortran?

**URL:** <https://fortran-lang.discourse.group/t/what-is-the-exact-difference-between-llvm-flang-and-lfortran/901>\
**Category:** Help\
**Created:** [March 24, 2021, 10:02am UTC](https://fortran-lang.discourse.group/t/what-is-the-exact-difference-between-llvm-flang-and-lfortran/901 "2021-03-24T10:02:08Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Beliavsky](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Beliavsky](https://fortran-lang.discourse.group/u/Beliavsky)\
**Post date:** [August 3, 2021, 4:04pm UTC](https://fortran-lang.discourse.group/t/what-is-the-exact-difference-between-llvm-flang-and-lfortran/901/23 "2021-08-03T16:04:35Z")

</div>

> [@Ashok](#):
>
> Sorry for this question, because I don’t know any thing about compilers, I am just trying to understand.  
> If LFortran compiler is written in C++, I what way it will be faster than C++? I understand that compiler is a program that converts source code into binary. If that is written in C++, then it is another C++ program. Then Fortran becomes a higher level C++. How then it becomes another language ? Are there any specific rules of memory allocation in Fortran compiler ? Or what makes it a Fortran language ? Semantics ?  
> If I write  
> print\*, “hello world”  
> If this is processed by a C++ program, then I have written a higher level C++ that’s all ! Or am I missing anything here ?

I don’t think there is a connection between the language a compiler is written in and how fast the resulting programs are. If a Fortran program does not follow the syntax rules of C++ it is not a C++ program, regardless of the compiler implementation language.

I have thought about whether Fortran is a subset of C (or the reverse), but the idea has to do with Fortran/C interoperability. If any standard-conforming C function can be called from a Fortran program, without a speed penalty, and if all platforms with Fortran compilers also have C compilers, maybe one could say that Fortran contains a C subset with distinct rules.

---

<div class="post-metadata">

**Author:** ![implicitall](https://avatars.discourse-cdn.com/v4/letter/i/9fc29f/32.png) [@implicitall](https://fortran-lang.discourse.group/u/implicitall)\
**Post date:** [August 3, 2021, 4:08pm UTC](https://fortran-lang.discourse.group/t/what-is-the-exact-difference-between-llvm-flang-and-lfortran/901/24 "2021-08-03T16:08:39Z")

</div>

Five parts of a compiler are Lexical Analysis, Parsing, Semantic Analysis, Optimization, and Code Generation. These slides show a little example of each related to English. [http://web.stanford.edu/class/cs143/lectures/lecture01.pdf](http://web.stanford.edu/class/cs143/lectures/lecture01.pdf)

[Previous page](https://fortran-lang.discourse.group/t/what-is-the-exact-difference-between-llvm-flang-and-lfortran/901.md?page=1)
