Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why aren't there cutting-edge compiler backends in functional languages like Haskell? [closed]

current state-of-the-art compiler backends are mostly written in C/C++, the best example is possibly the LLVM infrastructure. Furthermore it is often stated that it would be nice to have some kind of a killer project implemented in a functional language.

Functional programming claims to have the advantage of solving heavily algorithmic problems in an elegant (and nowadays fast) way - compared to imperative languages. Nevertheless most compiler-backends are implemented in C/C++. I do know of the existence of, e.g. MLRisc but it seems outdated.

Thanks for hopefully lightning answers. For me a full compiler tool chain would be a real proof of the maturity of a language.

best regards, uli

like image 846
max_power Avatar asked Dec 08 '25 20:12

max_power


1 Answers

The probably most cutting-edge compiler both written in and for functional languages is probably GHC. It compiles Haskell and is - apart from the runtime system completely written in Haskell. I read about some compiler shootouts (sadly, I cannot find the source anymore), where Haskell took the third place, just after C and C++. It's really a pretty cool project.

GHC supports various target architectures, including x86 and x64, SPARK, and some others. GHC was ported to various platforms, including Linux, Windows, Mac OS X and various flavours of BSD. GHC can either directly emit assembly, or can use the LLVM backend to use the powerful LLVM optimizer. Additionally, there is a C backend, but it is to be removed in the next release.

like image 137
fuz Avatar answered Dec 11 '25 13:12

fuz