Skip to main content


Topic: TCC Toy C languages, run C as a script (Read 2848 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • FBnil
  • [*][*]
TCC Toy C languages, run C as a script
I re-found this on the web, a Unix system written in Javascript, straight from the browser:

It contains busybox, and tcc

TCC is a weird little C compiler:
Code: [Select]
fbnil@tortuga:~/CODE/TCC$ ./helloworld.c
Hello world!
fbnil@tortuga:~/CODE/TCC$ cat ./helloworld.c
#!/usr/bin/tcc -run
#include <stdio.h>
main() {
   printf("Hello Sphere Community!\n");

It supports inline ASM, runs everywhere, even your toaster. Does not produce very optimized C, so GCC binaries should be faster. But it does compile faster...

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: TCC Toy C languages, run C as a script
Reply #1
I remember seeing this a few years ago. It's cool and impressive. :) Wonder what practical uses it can have (useful for teaching I suppose), and if it's in actual use anywhere.

  • FBnil
  • [*][*]
Re: TCC Toy C languages, run C as a script
Reply #2
From the wiki:

Cinpy is (was?) a Python library that allows you to implement functions with C in Python modules. The functions are compiled with TCC at runtime. The results are made callable in Python through the ctypes library. However, the homepage is gone now... so its probably not maintained anymore. Here is an example though:
Although its just plain silly, just compile, and then call it...
There is also a perl binding... but the same here, things like module libraries with c code are compiled before you can use them.

however LCC has been used in Matlab and Quake.

Still like TCC though... I can finally run C scripts! lol


  • Auditable code

  • Dynamic re-compilation

Drawbacks:  -o1 only (no ultra optimizations gcc's o3 does), thus a bit slower at execution (however, faster than Python or java)
  • Last Edit: June 10, 2015, 04:52:01 pm by FBnil