Tiny-C Compiler (2001)
11–20 of 82 posts
Re: Tiny-C Compiler (2001)
#12Not to be confused with https://bellard.org/tcc/ , which is a tiny compiler for the C language.
Re: Tiny-C Compiler (2001)
#13Earlier quoted context omitted.
It's probably better to call it an interpreter, since it will also run the program and print the values of all non-zero variables afterward. Calling it a compiler is (to me) really stretching things, I can't see any code to emit any other form of the code, it's all aimed at evaluating (executing) it. Edit: oops, I didn't read the code closely enough, it does emit code but only internally, that code is what gets execu…
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).
Re: Tiny-C Compiler (2001)
#14Re: Tiny-C Compiler (2001)
#15I 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.
Re: Tiny-C Compiler (2001)
#16Not 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.
Re: Tiny-C Compiler (2001)
#17Not to be confused with https://bellard.org/tcc/ , which is a tiny compiler for the C language.
Re: Tiny-C Compiler (2001)
#18Not 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.
Optimizing for storage space is…better?
Re: Tiny-C Compiler (2001)
#19Not 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.
(tiny C) compiler --> "This is a compiler for the Tiny-C language"
vs
Tiny (C compiler) --> "TinyCC [...] is a small but hyper fast C compiler"
That's it! ;-)
Re: Tiny-C Compiler (2001)
#20Earlier 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.
> Performance isn't that important in most cases. Optimizing for storage space is…better?
#!/usr/bin/tcc -run
You can do that with gcc/clang too (e.g. #if 0, #endif to wrap a block of shell script to compile the current file and execute the result) but a primary value of tcc is that it compiles fast.On a more philosophical note, the suckless approach is to optimise for simplicity not storage. It's perfectly valid to disagree with that of course, but if simplicitly of the system as a whole is a consideration gcc and clang doesn't really fit.