4 ms·
That's a good point, thanks. How complete is it?
by kragen 10mo ago
That's a good point, thanks. How complete is it?
- entaloneralie 10mo agoIt's complete in sofar as being capable of compiling C programs, but it has a few quirks. https://git.sr.ht/~vdupras/duskos/tree/master/item/fs/doc/comp/c.txt#L53 https://git.sr.ht/~vdupras/duskos/tree/master/item/fs/doc/co...
- kragen 10mo agoPossibly this is why it wasn't mentioned? There are enough differences in that list that I can't imagine any existing C library would compile unchanged.
- entaloneralie 10mo agoAfter using cc<< for non-trivial programs, it's about as quirky as the Plan 9 C compiler, the lack of multi-dimensional arrays is the one thing that trips me up the most with cc<<
- NooneAtAll3 10mo ago> The "&&", "||" and "?:" operators do shortcutting. is shortcutting different from short circuiting?
- vdupras 10mo agoIt's the same thing, I used the wrong term.
- vdupras 10mo agoBy design, it's not a fully compliant ANSI C compiler, so it's never going to be complete, but it's complete enough to, for example, successfully compile Plan 9's driver for the Raspberry Pi USB controller with a minimal porting effort. So, Dusk's compiler is not apple-to-apple comparable to the other, but comparable enough to give a ballpark idea that its code density compares very, very favorably.
- kragen 10mo agoIt can be hard to tell how much extra complexity would be introduced by unimplemented features.
- vdupras 10mo agoIndeed, and it might be why the author didn't try, but I still find it odd to not at least mention how small this C compiler is, even if it is to say that it's not apples-to-apples comparable. I mean, 8x smaller than the smallest C compiler listed is still something notable...
- kragen 10mo agoIt certainly sounds like a perfectly usable C dialect.
- norir 10mo agoFrom what I can tell chibicc, unlike tcc, is not a complete c compiler in and of itself. Looking at its source code, it relies upon external tools for both x86_64 code gen and linking: https://github.com/rui314/chibicc/blob/90d1f7f199cc55b13c7fdb5839d1409806633fdb/main.c#L570-L573 https://github.com/rui314/chibicc/blob/90d1f7f199cc55b13c7fd...
- fuhsnn 10mo agoIt does rely on binutils, but by this standard GCC is not a complete C compiler either.
- kragen 10mo agoRelying on binutils and an assembler is fine. I don't think it really affects the internal complexity of the compiler much, but having textual assembly to look at can be handy for debugging the compiler, so it might reduce the human effort to get it working.