TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Chibicc: A Small C Compiler

278 点作者 marcobambini超过 4 年前

19 条评论

carapace超过 4 年前
Awesome project!<p>&gt; When I find a bug in this compiler, I go back to the original commit that introduced the bug and rewrite the commit history as if there were no such bug from the beginning. This is an unusual way of fixing bugs, but as a a part of a book, it is important to keep every commit bug-free.<p>Ooo la la! &quot;Chibicc Vol. II, The Bugs&quot; !?<p>In all seriousness, a book about the bugs would be (IMO) even more fun to read than the compiler book.
评论 #24688345 未加载
评论 #24684824 未加载
rui314超过 4 年前
Related discussions on Reddit:<p><a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;programming&#x2F;comments&#x2F;j35w0i&#x2F;im_writing_a_c_compiler_called_chibicc_and_a_book&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;programming&#x2F;comments&#x2F;j35w0i&#x2F;im_writ...</a><p><a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;C_Programming&#x2F;comments&#x2F;j2wjyp&#x2F;chibicc_a_small_c_compiler&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;C_Programming&#x2F;comments&#x2F;j2wjyp&#x2F;chibi...</a><p><a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;Compilers&#x2F;comments&#x2F;j2py9x&#x2F;im_writing_a_c_compiler_called_chibicc_and_a_book&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;Compilers&#x2F;comments&#x2F;j2py9x&#x2F;im_writin...</a>
gilmi超过 4 年前
I love &#x27;the incremental approach to compiler construction&#x27;. Here are a few other courses that use this approach to teach compiler construction:<p>* <a href="http:&#x2F;&#x2F;www.ccs.neu.edu&#x2F;course&#x2F;cs4410&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.ccs.neu.edu&#x2F;course&#x2F;cs4410&#x2F;</a><p>* <a href="https:&#x2F;&#x2F;ucsd-cse131-f19.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ucsd-cse131-f19.github.io&#x2F;</a><p>* <a href="https:&#x2F;&#x2F;jeapostrophe.github.io&#x2F;courses&#x2F;2017&#x2F;spring&#x2F;406&#x2F;notes&#x2F;book.pdf" rel="nofollow">https:&#x2F;&#x2F;jeapostrophe.github.io&#x2F;courses&#x2F;2017&#x2F;spring&#x2F;406&#x2F;notes...</a>
saagarjha超过 4 年前
Another small C compiler by the same author: <a href="https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;8cc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rui314&#x2F;8cc</a>
评论 #24681971 未加载
dibyendu超过 4 年前
For a different optimizing C compiler that is also small, and usable as a JIT see MIR project by Vladimir Makarov - <a href="https:&#x2F;&#x2F;github.com&#x2F;vnmakarov&#x2F;mir&#x2F;tree&#x2F;master&#x2F;c2mir" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;vnmakarov&#x2F;mir&#x2F;tree&#x2F;master&#x2F;c2mir</a>
stiray超过 4 年前
<a href="https:&#x2F;&#x2F;bellard.org&#x2F;tcc&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bellard.org&#x2F;tcc&#x2F;</a><p>Probably best know and with loooong beard...
评论 #24679228 未加载
评论 #24678967 未加载
philips4350超过 4 年前
Oh man I used to be a die hard fan of the author&#x27;s &#x27;turing complete fm[1]&#x27; podcast. It seems like he has stopped publishing new episodes, wonder what happened.<p>[1] <a href="https:&#x2F;&#x2F;turingcomplete.fm&#x2F;" rel="nofollow">https:&#x2F;&#x2F;turingcomplete.fm&#x2F;</a>
评论 #24684220 未加载
评论 #24679860 未加载
评论 #24680390 未加载
sdfjkl超过 4 年前
I quite like the learn-by-commit style. Look at a diff and see what changes it took to add a feature. Very good way of showing things in a format everyone is already familiar with.
niek_pas超过 4 年前
Where will we be able to buy a copy? Is there a mailing list? I will certainly forget about this book in n months time.
评论 #24678282 未加载
评论 #24678139 未加载
jart超过 4 年前
Outstanding. A professional C compiler with a hackable codebase that emits x86_64 code. I&#x27;m noticing it assumes glibc-based linux. What if I modified it to emit Actually Portable Executables without needing ld&#x2F;as?
评论 #24680504 未加载
forgotmypw77超过 4 年前
&gt;Each commit of this project corresponds to a section of the book. For this purpose, not only the final state of the project but each commit was carefully written with readability in mind. Readers should be able to learn how a C language feature can be implemented just by reading one or a few commits of this project. For example, this is how while, [], ?:, and thread-local variable are implemented. If you have plenty of spare time, it might be fun to read it from the first commit.<p>nice
DethNinja超过 4 年前
This looks great, I’ll definitely use it.<p>Is there any similar project like this where LLVM IR is used? I’ll start building a language just for fun during weekends and I plan to use LLVM but it is rather hard to understand clang on limited time, so a smaller scale project would be awesome.
评论 #24679357 未加载
评论 #24680615 未加载
评论 #24679984 未加载
garrypettet超过 4 年前
What a great resource. I will certainly pick up the book when it’s out.
emmanueloga_超过 4 年前
maybe the author can verify, from what I could see it generates assembler files that one should save to a .S file and then can be run with gcc&#x27;s `cc -o executable file.S`.
评论 #24684259 未加载
tarruda超过 4 年前
Looking forward to the release, and will definitely get a copy!
pfdietz超过 4 年前
I wonder how it does with Csmith.
ruslan超过 4 年前
Can it compile itself ?
评论 #24679664 未加载
barumi超过 4 年前
It would be helpful if the title was edited to feature the compiler&#x27;s name: chibicc. It would make it easier to search and SEO-wise it would be helpful to disseminate the project.
评论 #24678460 未加载
评论 #24684126 未加载
IncRnd超过 4 年前
<i>When I find a bug in this compiler, I go back to the original commit that introduced the bug and rewrite the commit history as if there were no such bug from the beginning. This is an unusual way of fixing bugs, but as a a part of a book, it is important to keep every commit bug-free.</i><p>Somehow I can&#x27;t imagine Brian Kernighan or Dennis Ritchie making those sorts of commits.
评论 #24678763 未加载