logoalt Hacker News

chvidyesterday at 7:43 PM4 repliesview on HN

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.


Replies

falcor84yesterday at 7:56 PM

> 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.

show 1 reply
anematodeyesterday at 7:52 PM

A 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.

blibbleyesterday at 10:49 PM

indeed

building a working C compiler from scratch is literally in my "teach yourself C in 24 hours" book from 30 years ago

show 1 reply
wmfyesterday at 7:54 PM

This has multiple backends and a long tail of C extensions that are not in the textbook.