Compilers targeting C
The following is a list of open source compilers that can generate C (or in some cases, C++) code.
Name | Supported languages | Supported targets | Notes | Links |
---|---|---|---|---|
Alumina | Alumina | C | Inspired by Rust | web repo |
ATS | ATS | C | web | |
BaCon (Basic Converter) | Basic | C | web | |
bc9Basic | Basic | C | Can generate C or C++ code. Runs only on Windows but can generate code for *nix. A fork of BCX that outputs valid ISO/ANSI C. Website archive. | web |
Bigloo | Scheme | C | Scheme (R5RS) | web |
Blech | Blech | C | A synchronous programming language for embedded reactive real-time-critical software. | repo |
bmx-ng | BlitzMax | C | A Monkey-derived BlitzMax to C transpiler. | repo |
Carp | Carp, Lisp | C | A statically typed lisp, without a GC, for real-time applications. | repo |
Cforall | Cforall, C | C | Extends ISO C and outputs augmented C code | web repo doc |
Chapel | Chapel | C | web | |
CHICKEN Scheme | Scheme | C | Scheme (R5RS) | web |
Ciao | Prolog | C | web | |
cito | Ć | C | A language for making portable libraries with a syntax like C#. Also targets Java, C#, JavaScript, ActionScript, Perl 5 and D. | web |
CLiCC | Common Lisp | C | Compiles a large strict subset of Common Lisp + CLOS to C. | repo |
Critical Mass Modula-3 | Modula-3 | C | repo | |
Cyclone | Scheme | C | Scheme (R7RS). Cheney on the M.T.A. with native threads. | repo |
Cython | Python | C | web | |
Céu | Céu | C | web | |
eC | eC | C | An object-oriented superset of C with modules and generics. | web |
EiffelStudio | Eiffel | C | web | |
Embeddable Common-Lisp | Common Lisp | C | ANSI Common Lisp | web |
Emfrp | Emfrp | C | A pure functional reactive programming language for small-scale embedded systems. | repo |
Emgo | Go | C | Compiles a subset of Go for 32-bit microcontrollers through C. | repo |
Epic | Epic | C | web | |
Esotope Brainfuck Compiler | Brainfuck | C | repo | |
Euphoria to C Translator | Euphoria | C | web | |
f2c | Fortran 77 | C | web | |
Felix | Felix | C++ | repo | |
FreeBASIC | Basic | C | web | |
Futhark | Futhark | C | Purely functional data-parallel language generating OpenCL C | repo |
Gambit | Scheme | C | Scheme (R5RS) | web |
GCL | Common Lisp | C | web | |
Genie | Genie | C | web | |
GHC | Haskell | C | C backend documentation page. | web |
GnuCOBOL | COBOL | C | COBOL 2014 with extensions | web |
go2cpp | Go | C++ | Designed to help port Go to C++ | repo |
GoLite | GoLite, Go | C++ | Transpiles a strict subset of Go | repo |
Harbour | xBase, CA-Clipper | C | xBase compatible with CA-Clipper | repo |
Haxe | Haxe | C, C++ | web | |
Idris | Idris | C | A pure functional programming language with dependent types. | web |
Ivory | Ivory | C | A Haskell eDSL for safe systems programming. | web |
jhc | Haskell 98 | C | The resulting code doesn't use a garbage collector. | web |
Kit | Kit | C | A statically typed procedural language with manual MM, traits, pattern matching, and metaprogramming designed with game development in mind. | web |
Language84 | Language84 | C | web | |
m | m | C, WebAssembly | It targets webassembly but actually it compiles to C and then requires to trigger manually clang to get webassembly | web repo |
ManKai Common Lisp | Common Lisp | C | web | |
matiec | ST, IL, SFC | C | A set of textual languages for PLC programming. (SFC: IEC 61131) | repo |
mbeddr | mbeddr | C | A set of languages for embedded software engineering. | web |
Mercury | Mercury | C | web | |
MLton | Standard ML | C | web | |
Monkey 2 | Monkey 2 | C++ | web | |
Mrustc | Rust | C | repo | |
NectarJS | JavaScript | C | The primary target is WebAssembly. How to compile to C. | repo |
Nelua | Nelua | C | A statically-typed meta-programmable systems programming language heavily inspired by Lua. | web |
Nim | Nim | C, C++, Objective C | web | |
Nit | Nit | C | web | |
NN-512 | NN-512 | C | Graph language. Generate C99 code for neural net inference. | web |
Nuitka | Python | C | web | |
nullc | nullc | C, x86, VM | It is a C-like programming language | repo doc |
OBNC | Oberon | C | web | |
ocamlcc | OCaml | C | Compiles OCaml bytecode to C. | repo |
oi | oi | C | C with traits. Compiles to code that can be directly used from plain C. | repo |
ooc | ooc | C | web | |
OpenDylan | Dylan | C | web | |
p2c | Pascal, UCSD, Turbo Pascal, Modula-2 | C, C++ | Supports several Pascal dialects, including UCSD and Turbo Pascal, Modula-2. | web |
ParparVM | Java bytecode | C | Use for the Java to iOS portability part of the Codename One project. | repo |
perlcc | Perl 5 | C | web | |
prometeo | Python | C | Transpiles subset of Python | repo doc |
PtoC | pascal, Turbo Pascal, Oregon Pascal, ISO Pascal, Sun Pascal, HP Pascal | C, C++ | Transpiles to readable code | repo |
purescript-native | PureScript | C++ | repo | |
Py14 | Python | C++ | repo | |
Pythran | Python | C++ | repo | |
QuickJS | JavaScript | C | Compiles JavaScript (ES2020) to bytecode and embeds the bytecode in C. | web |
Ragel | Ragel | C, C++ | Compiles executable finite state machines from regular languages. | web |
RPerl | RPerl, Perl. | C++ | RPerl, a restricted subset of Perl. Unrelated to RPython. | repo |
RPython | RPython, Python. | C | RPython, a restricted subset of Python. Unrelated to RPerl. | web |
Sather | Sather | C | web | |
Scheme-to-C | Scheme | C | Example nanopass compiler | repo |
Seed7 | Seed7 | C | web | |
Shedskin | Python | C++ | repo | |
SLua | Lua | C | repo | |
SystemTap | SystemTap | C | SystemTap scripting language compiles kernel modules for monitoring Linux systems. | web |
ThinScript | ThinScript | C, JavaScript, WebAssembly | A lower-level programming language inspired by TypeScript. ThinScript also compiles to JavaScript and WebAssembly. | repo |
TMPPy | TMPPy, Python | C++ | Transpiles a subset of Python | repo doc |
ts2c | JavaScript, TypeScript | C | Compiles a subset of JavaScript/TypeScript (ES3) to readable C89. | repo |
TSP | Tcl | C | A typed subset of Tcl. An experimental JIT. Compiles procedures written in a statically typed subset of Tcl to C or Java to accelerate Tcl programs. | repo |
UbxBasic | Basic | C, C++ | A fork of BCX that adds Linux support in addition to Windows. Uses Glib. | web |
Ur/Web | Ur/Web | C | web | |
V | V | C | A no-GC systems language with modern features like sum types and immutability by default. | repo |
Vala | Vala | C | web | |
Vostok | Oberon-07 | C, Java, JavaScript, Oberon | repo | |
wasm2c | WebAssembly | C | Converts WASM files to C source and header. | repo |
wasmdec | WebAssembly | C | Converts WebAssembly binaries to C. | repo |
wax | wax | C, C#, C++, Java, Lua, Python, Swift, TypeScript, WebAssembly | A language design for transpiling. | web |
Yaksha | Python | C | Transpiles "Python like" programming language to C | web repo doc |
Zephir | Zephir | C | A language for writing PHP extensions. | web |
ZZ | ZZ (Drunk Octopus) | C | A safe dialect of C for embedded systems inspired by Rust. | repo |
C macro languages
- C-Mera, a simple source-to-source compiler that transforms s-expression notation to code in a C-family language.
- LISP/c, a Common Lisp-based macrolanguage for C.
See also
- Cello, a library for high-level programming in C.
- Clue, an ANSI C compiler targeting high level languages (Lua, JavaScript, Perl 5, C, Java, Common Lisp).
- LLVM C backend resurrected.
- luastatic, a tool that builds standalone executables from Lua programs by embedding Lua code in C.
Contributing
Your contributions are welcome! Please submit a pull request or create an issue to add a new compiler to the list.