r/linux • u/unixbhaskar • Mar 13 '23
Historical Tiny-C Language Compiler
http://www.iro.umontreal.ca/~felipe/IFT2030-Automne2002/Complements/tinyc.c3
u/Isofruit Mar 13 '23
Looks pretty useful. I'll have to check whether I can use this to compile my Nim projects during development, would be nice to compile my larger projects a bit faster.
21
u/DenkJu Mar 13 '23
What you're looking for is probably Bellard's Tiny C Compiler (TCC)
4
u/nomenMei Mar 13 '23
Ahh I could have swore tiny-C was a busybox style C compiler. TCC must have been what I was thinking of
5
Mar 13 '23 edited Jun 21 '23
fAs other user
(Albeit limited) Rgesults: TCC is great for prototyping (if you don't need multithreading), Clang is a good middleground as it takes about twice as long but has better performance, Clang with
--opt:sizeis a step further to get GCC-like performance for half of GCC's compile time.
That said, yeah it might be interesting how the twotccs compare for Nim.EDIT: note from author on HN:And yes it is the subset of C that is tiny, not a tiny compiler for the full C language.noted it's thef Bellard version, but I've done some speed testing with Godot-Nim. (which is no longer relevant because Godot 4.0 and no bindings yet)
1
u/BraveNewCurrency Mar 14 '23
This should have been called Toy-C, it doesn't even support functions?
I remember the good old days when you could put TCC into your bootloader, so you could boot the kernel from source code.
-8
Mar 13 '23
wtf , i was writing a C interpretter myself as well . small world , seems like i cant have new ideas. mine is in private repo yet.
14
u/necrophcodr Mar 13 '23
I mean... Writing an interpreter for a language that's ~50 years old and hoping to be the first seems quite a bit optimistic though?
6
Mar 14 '23
lol , downvoted to oblivion . i didnt mean to say "the first" , i just wanted to make something that not picked often , and is not easy to make .
2
u/necrophcodr Mar 14 '23
It's a good project idea no matter how many times it's been done honestly. It may be useful, but more importantly is that you'd learn a LOT from doing something like it. I 'm not sure why you were downvoted, since it IS relevant.
4
u/bobpaul Mar 13 '23
There's also
csh(cshell) which is intended to be more C-like than bourne shell. And of course TempleOS uses "HolyC" (Terry's custom language that attempts to find a middle ground between C++ and C) as the shell's language (with JIT). I believe most of the OS is kept as "HolyC" files that are interpreted/JITted as needed.
0
Mar 13 '23
[deleted]
33
u/bobpaul Mar 13 '23
This page describes the Tiny-C language. You're right that it's intended as an interpreted language with a REPL.
53
u/vbitchscript Mar 13 '23
Virgin stripped-down Tiny-C vs Chad Bellard's TCC (gcc but FAST (to compile, not execute))