Cover of Compiler construction

Compiler construction

by Niklaus Wirth · first published 1996

81mentions
30recommended by
40HN commenters
2008–2026first – last mentioned

73% recommend22% neutral5% critical

Why HN recommends it

Short, concise walkthrough of building a complete compiler from scratch, using recursive descent and a small Oberon subset. Easy to read and free online; suits beginners who find the Dragon book daunting.

Summarised by Claude from recommending comments

Affiliate links. As an Amazon Associate I earn from qualifying purchases.

Mentions per year

80 2007: 0 mentions2008: 1 mention2009: 1 mention2010: 1 mention2011: 2 mentions2012: 3 mentions2013: 3 mentions2014: 5 mentions2015: 5 mentions2016: 3 mentions2017: 8 mentions2018: 6 mentions2019: 8 mentions2020: 3 mentions2021: 2 mentions2022: 4 mentions2023: 4 mentions2024: 3 mentions2025: 2 mentions2026: 1 mention200720172026

What Hacker News says

  • abecedarius · Nov 4, 2014 · Recommends

    On a first skim, this looks really nice; complaints that it's unreadable are unfounded. The background that makes it readable are Wirth's Compiler Construction http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf plus precedence climbing http://en.wikipedia.org/wiki/Operator-precedence_parser#Prec...

    on “C4 – C in 4 functions” ↗
  • journeeman · Dec 24, 2015 · Recommends

    'Compiler Construction' by Niklaus Wirth[1] is a pretty good book too. It's got the hands-on feel of Crenshaw's book with a quick but, not too superficial, introduction to theory. The book is little more than 100 pages long.…

    on “Want to Write a Compiler? Read These Two Papers (2008)” ↗
  • eatonphil · Jul 7, 2021 · Recommends

    It's always hard to find implementations of Oberon, so thanks for sharing! If you (not pjmlp) are into compilers or Oberon I highly recommend Wirth's book, Compiler Construction, that walks through its implementation and his way of thinking about languages and implementations. Edit: am I getting the language mixed up with the operating system he also designed?

    on “Project Oberon Emulator in JavaScript and Java” ↗
  • sb · Sep 30, 2008 · Recommends

    …not actually well suited for anybody new to compilers to understand what's going on. AFAICT, newcomers are much better off learning the art of simplicity w.r.t. compilers from niklaus wirth's book on compiler construction (the pdf can be downloaded from his homepage); it is an easy read, and pascal is also a worthwhile language to learn (IMHO, i sure did in the mid-90s and it was no waste of time). there is also much benefit…

    on “Writing a compiler in Ruby, bottom up” ↗
  • username3720 · Nov 18, 2014 · Recommends

    The Oberon/Modula-2 family happens to be among my favorite languages. It's one of the easier languages to implement and Amazon happens to have cheap Modula-2 compiler books. Wirth's own Compiler Construction book is free, though it's the definition of terse. I rather liked Julian R. Ullmann's Compiling in Modula-2 and John Elder's Compiler Construction. There's still interesting work that is out there to…

    on “Project Oberon, 2013 Edition” ↗
  • silentbicycle · Feb 19, 2012 · Recommends

    …is perhaps not the best way to familiarize them with it. This book is a _reference_. For someone who wants to learn basic parsing techniques, I'd first direct them to something like Niklaus Wirth's _Compiler Construction_ (PDF: http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf), which has a quick and clear introduction to recursive descent parsing, but only briefly touches on other methods. The Grune book is for when…

    on “Parsing Techniques - A Practical Guide” ↗
  • pjmlp · Apr 4, 2014 · Recommends

    Please don't. Rather pick something like "Compiler Construction" from Niklaus Wirth and learn how to write compilers using memory safe system programming languages. http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf

    on “Learn C and build your own Lisp” ↗
  • nickpsecurity · Dec 14, 2015 · Recommends

    There's quite a few decent alternatives. I often suggest Wirth's Compiler Construction and Oberon sources because they're straightforward lessons plus give experience with Wirth style of simple, safe, efficient languages. Then, they can improve the Oberon System or compilers for personal…

    on “How I wrote a self-hosting C compiler in 40 days” ↗
  • nils-m-holm · May 6, 2017 · Recommends

    …design goal. I would stick to those in the beginning. See my home page (http://t3x.org) for lots of examples! Then, books. I'll make a list some day, I promise! ;) From the top of my head: Wirth's "Compiler Construction", Richard's "BCPL, the Language and its Compiler", and - shameless plug - "Practical Compiler Construction" by myself. I have also read the Dragon Book back then - it's good, but too heavy on theory for…

    on “T3X – a minimal procedural language” ↗
  • pjmlp · Sep 27, 2019 · Recommends

    “Compiler Construction” by Niklaus Wirth (2014) [pdf] https://www.inf.ethz.ch/personal/wirth/CompilerConstruction/... Modern Compiler Implementation in Java, C and ML. https://www.cs.princeton.edu/~appel/modern/ From Nand…

    on “Crafting Interpreters: Closures” ↗
  • eatonphil · Mar 15, 2021 · Recommends

    If you're interested in more Wirth I recommend his book, Compiler Construction. It's a great small piece on building a language from scratch.

    on “The School of Wirth” ↗
  • sb · Nov 16, 2009 · Recommends

    hm, there were certainly many pieces of interesting code I have come across in the past (e.g., regular expression automata, details of compilers [simple but fast like in Niklaus Wirth's compiler construction book], details of interpreters [Lisp SECD, Prolog WAM], etc.). PageRank was certainly among the highlights--clearity, brevity: one could immediately see that it was orders of magnitude better than the…

    on “What's the best / most interesting piece of code you've ever seen?” ↗
  • silentbicycle · Oct 22, 2010 · Recommends

    Niklaus Wirth's _Compiler Construction_ (free online, http://www-old.oberon.ethz.ch/WirthPubl/CBEAll.pdf) has a good intro to parsing, though for better or worse it's skewed towards recursive-descent parsing and has a "hit the ground running…

    on “A quick intro to writing a parser with Treetop” ↗
  • silentbicycle · Jan 21, 2011 · Recommends

    …about things like whitespace, for example. While most compiler textbooks cover lexing and parsing, I particularly recommend Andrew Appel's _Modern Compiler Implementation in ML_ and Niklaus Wirth's _Compiler Construction_ (free online, http://www-old.oberon.ethz.ch/WirthPubl/CBEAll.pdf). More recommendations on learning parsing here: http://news.ycombinator.com/item?id=1820858

    on “Efficiency of regular expressions” ↗
  • silentbicycle · Aug 4, 2011 · Recommends

    You can also get better compiler texts, these days. I recommend starting with Niklaus Wirth's _Compiler Construction_ (http://www.inf.ethz.ch/personal/wirth/books/CompilerConstruc...), then Andrew Appel's _Modern Compiler Implementation in ML_. I have a comment linking together several threads of compiler-related advice…

Keyboard shortcuts

/
Focus search
j / k
Next / previous book
Enter
Open focused book
Esc
Close / go back
g h
Go to Home
g t
Go to Top all-time
g m
Go to Most recommended
g r
Go to Rising
g f
Go to For You
?
Show this help