anyone know a good book or blog post or something about how to write a c compiler

@SuricrasiaOnline "An Incremental Approach to Compiler Construction" is a good paper on how to broadly approach it imo, check out 8cc, tcc, and chibicc, the specs themselves are surprisingly nice to read...i reckon it depends on what you want out of it tho, like do you wanna rely on other tools and libs like yacc / lex / llvm or do everything fresh? fully spec conformant cc or learning project?


@nea largely a learning project, nothing intended to be used seriously. I read that yacc was one of the first things ever implemented in the c language, so I'm interested in reenacting that history

· · Web · 1 · 0 · 2

@SuricrasiaOnline hell yeah! Parser theory is so interesting and it’s way cooler to do a LALR like yacc instead of a regular degular recursive descent parser. Being a learning project is sick bc the most cursed part of a cc is the semantics of the spec so u can just sidestep that entirely and engage with it on your terms. V cool

Sign in to participate in the conversation

cybrespace: the social hub of the information superhighway jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal support us on patreon or liberapay!