3 ms·
100.000 lines of code for something that is literally a text book task? I guess if it only created 1.000 lines it would be easy to see where those lines came f
by chvid 8mo ago
100.000 lines of code for something that is literally a text book task?
I guess if it only created 1.000 lines it would be easy to see where those lines came from.
- wmf 8mo agoThis has multiple backends and a long tail of C extensions that are not in the textbook.
- anematode 8mo agoA simple C89 compiler is a textbook task; a GCC-compatible compiler targeting multiple architectures that can pass 99% of the GCC torture test suite is absolutely not.
- falcor84 8mo ago> literally a text book task Generating a 99% compliant C compiler is not a textbook task in any university I've ever heard of. There's a vast difference between a toy compiler and one that can actually compile Linux and Doom. From a bit of research now, there are only three other compilers that can compile an unmodified Linux kernel: GCC, Clang/LLVM and Intel's oneAPI. I can't find any other compiler implementation that came close.
- cv5005 8mo agoThat's because you need to implement a bunch of gcc-specific behavior that linux relies on. A 100% standards compliant c23 compiler can't compile linux.
- falcor84 8mo agoOk, yes, that's true, though my understanding is that it's not the GCC is not compliant, but rather that it includes extensions beyond the standard, which is allowed by the standard, which says (in section 4. Conformance): > A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming program Anyway, this just makes Claude's achievement here more impressive, right?
- blibble 8mo agoindeed building a working C compiler from scratch is literally in my "teach yourself C in 24 hours" book from 30 years ago
- simonw 8mo agoWhich book was that? Sounds excellent. Might have been Compiler Design in C from 1990. Looks like that's available for free now: https://holub.com/compiler/ https://holub.com/compiler/
- blibble 8mo agoit's not that one, but it's in my parents house you'll forgive me if I don't ring them in the early hours of the morning... remember C was specifically designed to be easy to compile (hence anachronisms like forward declarations)