Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling to idiomatic C

Are there any compilers out there for function or lisp-ish languages that compile to idiomatic C? Most compilers out there seem to provide something resembling a machine language composed of C macros. I'm wondering if there is anything out there that can produce readable C code based on a higher-level language.

like image 898
Steve Avatar asked Feb 03 '23 08:02

Steve


1 Answers

Given that you tagged this question with Haskell I'll give a Haskell answer. JHC is a Haskell compiler which produces fairly idiomatic ansi-C. It's an optimizing whole-program compiler that can produce incredibly fast binaries. I'm not sure how stable it is at the moment though, and there seems to be limits to how big programs it can handle. But don't take my word for it, check it out yourself.

like image 112
svenningsson Avatar answered Feb 12 '23 12:02

svenningsson