Compile and execute C code everywhere!!

The Tiny C Compiler (aka TCC, tCc, or TinyCC) is an x86 and x86-64 C compiler created by Fabrice Bellard. It is designed to work for slow computers with little disk space (e.g. on rescue disks). Windows operating system support has been added in version 0.9.23 (17 Jun 2005). TCC is distributed under the GNU Lesser General Public License (LGPL).

Features:

Its small file size (about 100 KB for the x86 TCC executable) and memory footprint allow it to be used directly from a single 1.44 M floppy disk, such as a rescue disk.
TCC is intended to produce native x86 and x86-64 code very quickly; according to Bellard, it compiles, assembles and links the Links web browser about 9 times faster than GCC does.[1]
TCC has a number of compiler-specific language features intended to improve its practicality, such as an optional memory and bound checker, for improved code stability.
TCC allows programs to be run automatically at compile time using a command-line switch. This allows programs to be run as a shell script under Unix-like systems which support the shebang interpreter directive syntax.

usage:

tcc [options] [infile1 infile2…] [‘-run’ infile args…]

Compile ‘a.c’ and execute it directly :

tcc -run a.c arg1

Compile a.c and execute it directly. arg1 is given as first argument to the main() of a.c.

tcc a.c -run b.c arg1

Compile ‘a.c’ and ‘b.c’, link them together and execute them. arg1 is given as first argument to the main() of the resulting program.

tcc -o myprog a.c b.c

Compile ‘a.c’ and ‘b.c’, link them and generate the executable ‘myprog’.

tcc -o myprog a.o b.o

link ‘a.o’ and ‘b.o’ together and generate the executable ‘myprog’.
tcc -c a.c

Compile ‘a.c’ and generate object file ‘a.o’.
tcc -c asmfile.S

Preprocess with C preprocess and assemble ‘asmfile.S’ and generate object file ‘asmfile.o’.
tcc -c asmfile.s

Assemble (but not preprocess) ‘asmfile.s’ and generate object file ‘asmfile.o’.

tcc -r -o ab.o a.c b.c

Compile ‘a.c’ and ‘b.c’, link them together and generate the object file ‘ab.o’.

Scripting:

TCC can be invoked from scripts, just as shell scripts. You just need to add #!/usr/local/bin/tcc -run at the start of your C source:

#!/usr/local/bin/tcc -run
#include <stdio.h>

int main() 
{
printf("Hello World\n");
return 0;
}
TCC can read C source code from standard input when ‘-’ is used in place of ‘infile’. Example:

echo 'main(){puts("hello");}' | tcc -run -


Wiki:

http://en.wikipedia.org/wiki/Tiny_C_Compiler


Download Link:

http://bellard.org/tcc/

Comments

  1. It was quite easy to become the teacher's pet in a matter of time, but I personally did not need the help of my classmates. I have an assistant nerdify reddit, where any written work is done to order for a small price.

    ReplyDelete

Post a Comment