logoalt Hacker News

SectorC: A C Compiler in 512 bytes

137 pointsby valyalatoday at 5:39 PM23 commentsview on HN

Comments

mati365today at 8:56 PM

Oh, it looks like my X86-16 boot sector C compiler that I made recently [1]. Writing boot sector games has a nostalgic magic to it, when programming was actually fun and showed off your skills. It's a shame that the AI era has terribly devalued these projects.

[1] https://github.com/Mati365/ts-c-compiler

xorvoidtoday at 8:12 PM

I may be the author.. enjoy! It was an absolute blast making this!

show 3 replies
mojubatoday at 8:56 PM

Compare that to the C compiler in 100,000 lines written by Claude in two weeks for $20,000 (I think was posted on HN just yesterday)

show 2 replies
sanufartoday at 8:09 PM

The way hashing is used for tokens and for making a pseudo symbol table is such an elegant idea.

show 1 reply
riedeltoday at 8:00 PM

Beautiful, but make sure to quickly add 2023 to the title.

Discussed at the time: https://news.ycombinator.com/item?id=36064971

gonzustoday at 9:40 PM

Lacking support for structs, I think this is too minimalistic to be called "a C compiler".

NooneAtAll3today at 8:47 PM

> I wrote a fairly straight-forward and minimalist lexer and it took >150 lines of C code

was it supposed to be "<150"?

show 1 reply
SeanSullivan86today at 9:22 PM

Why is it called a C Compiler if it's a subset of C?

kayo_20211030today at 10:02 PM

Nice. Very K&R-ish. Not a bad thing.