run C like a script with a hashbang: TCC


FBnil

They'll own everything and be miserable.
Joined
Dec 14, 2012
Messages
5,116
Location
Yurp
re-found this on the web, a Unix system written in Javascript, straight from the browser: http://bellard.org/jslinux/
It contains busybox, and tcc

TCC is a weird little C compiler:


fbnil@tortuga:~/CODE/TCC$ ./helloworld.c
Hello Pandora Community!
fbnil@tortuga:~/CODE/TCC$ cat ./helloworld.c
#!/usr/bin/tcc -run
#include <stdio.h>
main() {
   printf("Hello Pandora Community!\n");
}

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

http://www.herongyang.com/Computer-History/C-TCC-Tiny-C-Compiler.html

http://bellard.org/tcc/tcc-doc.html
 
Last edited by a moderator:
I notice a little discrepancy between your source file and the output... ;)
 
I notice a little discrepancy between your source file and the output.
Yeah... copy paste error through the clipboard. Anyhow...  compiled stuff with it. it was fun
 
Back
Top