Sunday, October 20, 2024

Tiny CC, from JavaScript, with Bun

TCC : Tiny C Compiler (LGPL)

  • SMALL! You can compile and execute C code everywhere, for example on rescue disks (about 100KB for x86 TCC executable, including C preprocessor, C compiler, assembler and linker).
  • FAST! tcc generates x86 code. No byte code overhead. Compile, assemble and link 9 times faster than GCC.
  • UNLIMITED! Any C dynamic library can be used directly. TCC is heading torward full ISOC99 compliance. TCC can of course compile itself.
  • SAFE! tcc includes an optional memory and bound checker. Bound checked code can be mixed freely with standard code.
  • Compile and execute C source directly. No linking or assembly necessary. Full C preprocessor and GNU-like assembler included.

Compile and run C in JavaScript | Bun Blog

From compression to cryptography to networking to the web browser you're reading this on, the world runs on C. If it's not written in C, it speaks the C ABI (C++, Rust, Zig, etc) and is available as a C library. C and the C ABI are the past, present, and future of systems programming.


from: JavaScript Weekly Issue 705: September 19, 2024

Now You Can Compile and Run C in JavaScript — Well, if you’re using Bun, at least. Bun v1.1.28 lands experimental support for compiling and native C code and then running its functions from JavaScript. It's easier than it sounds..





Fabrice Bellard (French pronunciation: [fa.bʁis bɛ.laʁ]; born 1972) is a French computer programmer known for writing FFmpegQEMU, and the Tiny C Compiler. He developed Bellard's formula for calculating single digits of pi.


Index of /releases/tinycc/ downloads, including Windows build


the smallest C compiler which is able to compile itself. 
The original OTCC code could only run on i386 Linux