I did my CS degree at umontreal and this was an assignment in a second year class. This was a pretty interesting introduction to compilers, and even if this is a toy subset of C, this was challenging, at least for me. We would get 0 if there were any memory leak, so we were pretty paranoid about it. The second assignment was writing a Scheme interpreter.
That's kind of surprising they cared so much about memory use, a lot of one-shot C programs such as compilers don't bother freeing memory and let the OS clean up after them once they exit.
Tiny-C Compiler (2001)
21–30 of 82 posts
Re: Tiny-C Compiler (2001)
#22Not to be confused with https://bellard.org/tcc/ , which is a tiny compiler for the C language.
I use tcc for all of my small C "scripts" for doing ioctls, etc. Less bloat, suckless. I imagine most software would be better off using tcc than gcc/clang. Performance isn't that important in most cases.
Re: Tiny-C Compiler (2001)
#23Not to be confused with https://bellard.org/tcc/ , which is a tiny compiler for the C language.
I use tcc for all of my small C "scripts" for doing ioctls, etc. Less bloat, suckless. I imagine most software would be better off using tcc than gcc/clang. Performance isn't that important in most cases.
Re: Tiny-C Compiler (2001)
#24Earlier quoted context omitted.
I use tcc for all of my small C "scripts" for doing ioctls, etc. Less bloat, suckless. I imagine most software would be better off using tcc than gcc/clang. Performance isn't that important in most cases.
I think you are confusing the work of Frabrice Bellard with this very one. The former is a C-language compiler. This once is a compiler for a language called "Tiny C". Understandable confusion, though.
Re: Tiny-C Compiler (2001)
#25Earlier quoted context omitted.
It is a compiler rather than a direct evaluator, since it generates bytecode for a stack VM --- and also includes the interpreter for that (look at the bottom).
That’s more or less every interpreter. CPython compiles to bytecode before interpreting that, yet nobody would call it a compiler.
Re: Tiny-C Compiler (2001)
#26I admit I have trouble understanding how the VM run() function works... anybody can give some insight?
Re: Tiny-C Compiler (2001)
#27Re: Tiny-C Compiler (2001)
#28Re: Tiny-C Compiler (2001)
#29Earlier quoted context omitted.
I use tcc for all of my small C "scripts" for doing ioctls, etc. Less bloat, suckless. I imagine most software would be better off using tcc than gcc/clang. Performance isn't that important in most cases.
Thanks for sharing! I've yet to go through my C phase, but see it on the horizon, and will remember this and the shebang trick.
Re: Tiny-C Compiler (2001)
#30Not to be confused with https://bellard.org/tcc/ , which is a tiny compiler for the C language.
I'm quite confused, not the same project at all? To me tiny c compiler always meant the bellard page. Super useful stuff for micro hacky projects.