tikC is a C compiler driver for GNU/Linux that can compile a C program and produces executable file for the compiled program.
This is the first release version of tikC, so limited C syntax/constructs are implemented. Please compile the program for which all the syntax are being implemented by tikC else the source program won't be compiled(These are detailed below).
Till now, tikC can't pre-processed a C file. So the code should be quite straight forward initially(so no header files, no macros etc). tikC generates the assembly code equivalent of the source program and invoke the GNU as(assembler)to produced the object file. And finally the linker puts the object file and the library files togehter and produces the executable file. As the asembly code generated is targeted to Intel's x86, tikC can be run on system running Linux on x86 platform.
Getting tikC into action
To compile the tikC source, you need to have GCC and GNUas installed on your system. When you first untar the tikC, you will find the below directories:
a) Docs: contains the tikC internal documents. It will be quite helpful if you plan to join me in writing tikC.
b) src: contains the tikC source code files along with the Makefile.
Along with the directories you will find some other text files. Please have a look at these files as it may contain important information.
Open "Terminal" and make ".../tikC/src" the current working directory.
- This will produced the executable "tikC".
%run ./tikC filename
-filename is your C program, should be in the same directory.
-the AST and Intermediate code generated will be displayed on the console output.
-this will produced your executable file "tikC.out".
-this will produced your program output.
Syntax you can use with tikC
a) Data type int/char/void/float.But will say try working with "int". I am working on others.
b) Data type initialization.
c) All arithmetic operators. (except division, mod)
d) All logical operators.
e) All relational operators.
f) Bitwise operators (&,|,^)
g) if/ if-else statement.
h) for, while, do-while loop.
i) Library routine "printf" and "scanf". One problem here is the control string for "printf" and "scanf"
can't be longer than twelve(12) characters. (Working on it. A serious bug here. Its eating my head)
Syntax you cannot use with tikC
a) Please don't give header files and macros in your program (heavily working on this). No pre-processing suported.
b) main() function prototype should be given (int/void). eg. int main().
c) All arithmetic operators are implemented except division and mod. (need to work on floating point operations)
d) No user defined function calls.
e) Only printf and scanf library routines can be used.
f) array, structure,union and enum not yet implemented.
tikC happens to me for my love for C programming. Its been a long dream for me to write my own C compiler since my college days. It was the thrill to understand how a hand written code is converted into instructions that a CPU can really understand. With this thrill I went down to understand how this happens. And continued with tikC. Also with tikC I could explore deeper about the C language constructs for which I am really happy about.
I would like to put a word to all students, if you want to go deeper with a proramming language then raise your hand and write down your compiler. You will feel better. Or if you feel, you can join me in completing tikC and fulfill our dreams together. tikC will provide you a wide opportunities to understand how a compiler really works, about code optimization , assembly language programming, what actually happens to your variables, function calls, etc. Shoot a mail to me.
I put here a word of thanks to all my teachers and friends who believed in me. Also, a special mention for my dearest room-mates for their encouraging words and without whom tikC won't have happen if I had to spend my remaining time after work in the kitchen cooking and washing.
I also thank my colleagues for their support and encouragement. And also extend my thankfulness to the open source community without whom tikC won't be possible.
At the least, I am dedicating tikC to my college North Eastern Regional Institute of Science and Technology(NERIST),Itanagar,India.