this post was submitted on 16 Sep 2025
282 points (97.0% liked)

Programmer Humor

26390 readers
1520 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] edinbruh@feddit.it 69 points 2 days ago (1 children)

That's like... It's purpose. Compilers always have a frontend and a backend. Even when the compiler is entirely made from scratch (like Java or go), it is split between front and backend, that's just how they are made.

So it makes sense to invest in just a few highly advanced backends (llvm, gcc, msvc) and then just build frontends for those. Most projects choose llvm because, unlike the others, it was purpose built to be a common ground, but it's not a rule. For example, there is an in-developement rust frontend for GCC.

[–] Kazumara@discuss.tchncs.de 19 points 1 day ago (2 children)

that’s just how they are made.

Can confirm, even the little training compiler we made at Uni for a subset of Java (Javali) had a backend and frontend.

I can't imagine trying to spit out machine code while parsing the input without an intermediary AST stage. It was complicated enough with the proper split.

[–] LeFantome@programming.dev 10 points 1 day ago (1 children)

I have built single pass compilers that do everything in one shot without an AST. You are not going to get great error messages or optimization though.

[–] Kazumara@discuss.tchncs.de 3 points 16 hours ago

Oh! Okay, that's interesting to me! What was the input language? I imagine it might be a little more doable if it's closer to hardware?

I don't remember that well, but I think the object oriented stuff with dynamic dispatch was hard to deal with.

[–] BuboScandiacus@mander.xyz 14 points 1 day ago

I can imagine;