TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Write your own retro compiler

329 pointsby nils-m-holmover 1 year ago

11 comments

nils-m-holmover 1 year ago
Here it is, my latest compiler book! Basically an expanded version of &quot;Write Your Own Compiler&quot;, this time discussing code generation for CP&#x2F;M on the Z80 (instead of ELF on modern systems), which simplifies some things a lot.<p>How much complexity do you need to self-compile a compiler in 10 minutes on a 4MHz Z80 system? Take a look and find out! The code is free (but the book is not).
评论 #38593066 未加载
评论 #38596813 未加载
mati365over 1 year ago
Recently I made C multipass compiler (and asembler) in typescript for such old x86 CPUs<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Mati365&#x2F;ts-c-compiler">https:&#x2F;&#x2F;github.com&#x2F;Mati365&#x2F;ts-c-compiler</a>
评论 #38592212 未加载
scrawlover 1 year ago
I have a physical copy of Practical Compiler Construction 2nd Ed. and like it a lot. I recommend Nils&#x27; books to anyone who may be interested.
评论 #38592413 未加载
ameliusover 1 year ago
This book looks fun. But I&#x27;m still waiting for a worthy successor of The Dragon Book, discussing optimizations for modern CPUs (and perhaps GPUs), and also discusses how to design&#x2F;write a modern VM with a fast concurrent GC (something that some might say is even harder than writing the compiler!)
评论 #38606638 未加载
评论 #38593282 未加载
评论 #38606553 未加载
评论 #38593393 未加载
AlexeyBrinover 1 year ago
This looks really interesting, however a disadvantage is that the reader needs to know or learn a new programming language first T3X. I wonder if one could start from scratch on a CP&#x2F;M system: write and develop the compiler on a retro system that has no connection to the outside world except the keyboard and display.
评论 #38592633 未加载
评论 #38600944 未加载
pestsover 1 year ago
A compiler tutorial that gets past the lexing and parsing stages? First of its kind.<p>I kid, but it is a common stopping point. Gonna pick this up.
eterpsover 1 year ago
It would also be interesting to have a book on writing your own CP&#x2F;M-like OS.
评论 #38593157 未加载
Max-qover 1 year ago
This comment is not ment to be negative, just some insight that might be valuable.<p>I read the free chapter. One thing I noticed right away was that I think some things can be hard for people with not so much knowledge about the topic: under each headline, it explains a concept from the ground up, no knowledge required. Like &quot;the syntax of a language is...&quot;. But just a few sentences in, advanced topics are touched, like assembly instructions, not explained. It feels a bit like &quot;the curse of knowledge&quot;, where it&#x27;s hard to know what the other party knows. But if the reader needs to learn what syntax means, they will probably not understand the next sentences.<p>So, I think more consistency could improve the product.<p>This is of course just my meaning and interpretation of the text, it might not be relevant. But maybe something to have in mind for your next masterpiece :)
评论 #38594295 未加载
评论 #38594294 未加载
jdwithitover 1 year ago
Apart from the actual book content, I enjoy your appropriately retro and minimalist web design. It&#x27;s giving me a huge nostalgia hit. Fond memories of hand crafting my own sites with a 6 inch thick book titled something like &quot;HTML 3.2 UNLEASHED!!!!&quot; on my desk :)
评论 #38601472 未加载
thinkmassiveover 1 year ago
<a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20231210141834&#x2F;http:&#x2F;&#x2F;t3x.org&#x2F;t3x&#x2F;0&#x2F;book.html" rel="nofollow noreferrer">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20231210141834&#x2F;http:&#x2F;&#x2F;t3x.org&#x2F;t3...</a>
freedombenover 1 year ago
Why such a focus on retro computing? As an oldie I think it&#x27;s cool (though a bit impractical learning the parts that aren&#x27;t applicable to modern stuff), but my son is interested in learning operating systems, compilers, etc, and I could never get him to use something so &quot;outdated.&quot;<p>To be clear, I&#x27;m not attempting to criticize with this question (my personal opinion is write about what interests you, even if nobody else will care), I&#x27;m assuming you choose older targets for a reason, and would like to undestand those reasons :-)<p>I.e. Do you believe the retro targets to be a lot simpler and easier to understand, so people can iterate&#x2F;build in layers? Or do you just know the retro stuff better so it makes for a better book?
评论 #38593441 未加载
评论 #38596788 未加载
评论 #38604881 未加载
评论 #38593604 未加载
评论 #38593381 未加载