Qbasicnews.com

Full Version: c toy compiler
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
greetings,

i wrote a c toy compiler that produces assembler code/exes in the same way fb does. for now there's only a win32 version as i was to lazy to change the linker and assembler command line options Smile.

http://ratatoskr.dragonhill.cc/temp/cc/tcc.rar

there's a lot missing but it works. there's 3 examples in the example folder one isn't working yet ( ogl.c need stdcall for this to work... ).

this is a univ. project and up until now it took me 8 days. it is originally written in java and then natively compiled with gcj so you don't need java for it. you can however build a java version ( or execute Main.class in the class folder ) and it will work just fine too.

have fun
Hey, hot stuff!
it's pretty lame atm, but i will extend it with the following features this week:

+ stdcall calling convention so it is 100% usable on windows too
+ arrays
+ chars as datatype
+ udts
+ function pointers ( this needs only some syntax sugar )
+ a few more controll structures ( while, switch, again just syntactical suger )
+ include statement

with this it is nearly as powerfull as fb in its earlier stages Smile

pointers and pointer arithmetics work 100%. besides the design is clean enough to write any backend within a few hours ( the x86 backend took me about an hour to implement, though it took me 4 hours to get into assembler itself again and translate the im code statements to assembler templates Smile )

anyways if somebody feels like writting small test applications for it feel free to go ahead and do so Smile. i would really love to see such thingies here, also error and bug reporting would be nice. don't be afraid of the stack trace prints that appear if there's something wrong those are for debugging purposes and i was to lazy to exclude them.
nice...
linux version working, though only the java version as i'm to lazy to download gcj...