frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Compiler Engineering in Practice

https://chisophugis.github.io/2025/12/08/compiler-engineering-in-practice-part-1-what-is-a-compiler.html
82•dhruv3006•12h ago

Comments

dhruv3006•12h ago
“Compiler Engineering in Practice” is a blog series intended to pass on wisdom that seemingly every seasoned compiler developer knows, but is not systematically written down in any textbook or online resource. Some (but not much) prior experience with compilers is needed.
serge1978•10h ago
skimmed through the article and the structure just hints at being not written by a human
gervwyk•57m ago
have to disagree. maybe read a paragraph, its dense with context imo. i find slop to be light on context and wordy, this is not.
lqstuart•6h ago
> What is a compiler?

Might be worth skipping to the interesting parts that aren’t in textbooks

pfdietz•5h ago
Always interested in compiler testing, so I look forward to what he has to say on that.
amelius•4h ago
The compiler part of a language is actually a piece of cake compared to designing a concurrent garbage collector.
ori_b•1h ago
A good enough one isn't so bad. Here's an example concurrent collector that was used with the Inferno OS:

https://github.com/inferno-os/inferno-os/blob/master/libinte...

There's lots of room to improve it, but it worked well enough to run on telephony equipment in prod.

mrkeen•4h ago

  Why compilers are hard – the IR data structure
If you claim an IR makes things harder, just skip it.

  Compilers do have an essential complexity that makes them "hard" [...waffle waffle waffle...]

  The primary data [...waffle...] represents the computation that the compiler needs to preserve all the way to the output program. This data structure is usually called an IR (intermediate representation). The primary way that compilers work is by taking an IR that represents the input program, and applying a series of small transformations all of which have been individually verified to not change the meaning of the program (i.e. not miscompile). In doing so, we decompose one large translation problem into many smaller ones, making it manageable.
There we go. The section header should be updated to:

  Why compilers are manageable – the IR data structure
WalterBright•39m ago
In the D compiler, I realized that while loops could be rewritten as for loops, and so implemented that. The for loops are then rewritten using goto's. This makes the IR a list of expression trees connected by goto's. This data structure makes Data Flow Analysis fairly simple.

An early function inliner I implemented by inlining the IR. When I wrote the D front end, I attempted to do this in the front end. This turned out to be a significantly more complicated problem, and in the end not worth it.

The difficulty with the IR versions is, for error messages, it is impractical to try and issue error messages in the context of the original parse trees. I.e. it's the ancient "turn the hamburger into a cow" problem.

runtimepanic•4h ago
This resonates with how compiler work looks outside textbooks. Most of the hard problems aren’t about inventing new optimizations, but about making existing ones interact safely, predictably, and debuggably. Engineering effort often goes into tooling, invariants, and diagnostics rather than the optimizations themselves.
WalterBright•32m ago
I learned about DFA (Data Flow Analysis) optimizations back in the early 1980s. I eagerly implemented them for my C compiler, and it was released as "Optimum C". Then came the C compiler roundup benchmarks in the programming magazines. I breathlessly opened the issue, and was faced with the reviewers' review that Optimum C was a bad compiler because it deleted the code in the benchmarks. (The reviewer wrote Optimum C was cheating by recognizing the specific benchmark code and deleting it.)

I was really, really angry that the review had not attempted to contact me about this.

But the other compiler venders knew what I'd done, and the competition implemented DFA as well by the next year, and the benchmarks were updated.

The benchmarks were things like:

    void foo() { int i,x = 1; for (i = 0; i < 1000; ++i) x += 1; }
nn3•14m ago
I don't feel his overflow miscompilation example is a good one. A 64bit multiplication converted back to 32bit has the same overflow behavior as if the computation was in 32bit (assuming nobody depends on the overflow indication, which is rare). And in high level programming languages you typically can't tell the difference.

Hashcards: A Plain-Text Spaced Repetition System

https://borretti.me/article/hashcards-plain-text-spaced-repetition
127•thomascountz•3h ago•27 comments

The Typeframe PX-88 Portable Computing System

https://www.typeframe.net/
45•birdculture•2h ago•14 comments

AI and the ironies of automation – Part 2

https://www.ufried.com/blog/ironies_of_ai_2/
167•BinaryIgor•6h ago•55 comments

Ask HN: What Are You Working On? (December 2025)

30•david927•3h ago•62 comments

Stop crawling my HTML you dickheads – use the API

https://shkspr.mobi/blog/2025/12/stop-crawling-my-html-you-dickheads-use-the-api/
60•edent•1h ago•50 comments

Developing a food-safe finish for my wooden spoons

https://alinpanaitiu.com/blog/developing-hardwax-oil/
49•alin23•3d ago•25 comments

Do Dyslexia Fonts Actually Work? (2022)

https://www.edutopia.org/article/do-dyslexia-fonts-actually-work/
4•CharlesW•27m ago•0 comments

Shai-Hulud compromised a dev machine and raided GitHub org access: a post-mortem

https://trigger.dev/blog/shai-hulud-postmortem
125•nkko•10h ago•76 comments

GraphQL: The enterprise honeymoon is over

https://johnjames.blog/posts/graphql-the-enterprise-honeymoon-is-over
68•johnjames4214•2h ago•53 comments

Freakpages

https://freakpages.org/
5•bookofjoe•1h ago•0 comments

Illuminating the processor core with LLVM-mca

https://abseil.io/fast/99
41•ckennelly•5h ago•3 comments

In the Beginning Was the Command Line (1999)

https://web.stanford.edu/class/cs81n/command.txt
5•wseqyrku•6d ago•0 comments

Linux Sandboxes and Fil-C

https://fil-c.org/seccomp
317•pizlonator•21h ago•121 comments

Standalone Meshtastic Command Center – One HTML File Offline

https://github.com/Jordan-Townsend/Standalone
14•Subtextofficial•5d ago•2 comments

Rust Coreutils 0.5.0 Release: 87.75% compatibility with GNU Coreutils

https://github.com/uutils/coreutils/releases/tag/0.5.0
71•maxloh•3h ago•41 comments

Vacuum Is a Lie: About Your Indexes

https://boringsql.com/posts/vacuum-is-lie/
55•birdculture•6h ago•35 comments

Apple Maps claims it's 29,905 miles away

https://mathstodon.xyz/@dpiponi/115651419771418748
132•ColinWright•6h ago•107 comments

Compiler Engineering in Practice

https://chisophugis.github.io/2025/12/08/compiler-engineering-in-practice-part-1-what-is-a-compil...
82•dhruv3006•12h ago•12 comments

iOS 26.2 fixes 20 security vulnerabilities, 2 actively exploited

https://www.macrumors.com/2025/12/12/ios-26-2-security-vulnerabilities/
67•akyuu•3h ago•62 comments

Price of a bot army revealed across online platforms

https://www.cam.ac.uk/stories/price-bot-army-global-index
13•teleforce•3h ago•0 comments

More atmospheric rivers coming for flooded Washington and the West Coast

https://www.cnn.com/2025/12/12/weather/washington-west-coast-flooding-atmospheric-rivers-climate
17•Bender•1h ago•4 comments

Kimi K2 1T model runs on 2 512GB M3 Ultras

https://twitter.com/awnihannun/status/1943723599971443134
160•jeudesprits•7h ago•76 comments

Efficient Basic Coding for the ZX Spectrum

https://blog.jafma.net/2020/02/24/efficient-basic-coding-for-the-zx-spectrum/
34•rcarmo•8h ago•7 comments

I fed 24 years of my blog posts to a Markov model

https://susam.net/fed-24-years-of-posts-to-markov-model.html
271•zdw•23h ago•107 comments

Getting into Public Speaking

https://james.brooks.page/blog/getting-into-public-speaking
74•jbrooksuk•4d ago•28 comments

Using e-ink tablet as monitor for Linux

https://alavi.me/blog/e-ink-tablet-as-monitor-linux/
230•yolkedgeek•5d ago•88 comments

Show HN: Cargo-rail: graph-aware monorepo tooling for Rust; 11 deps

https://github.com/loadingalias/cargo-rail
39•LoadingALIAS•3d ago•3 comments

Science Communications on YouTube

https://blogs.memphis.edu/awindsor/2025/02/25/science-communication-on-youtube/
30•azhenley•1w ago•35 comments

Cat Gap

https://en.wikipedia.org/wiki/Cat_gap
183•Petiver•4d ago•54 comments

I tried Gleam for Advent of Code

https://blog.tymscar.com/posts/gleamaoc2025/
329•tymscar•1d ago•192 comments