Remix.run Logo
torginus 3 hours ago

I love that there are compilers beside the big 2 with a simple API, and small enough codebase, that produce decent-enough code, but damn did I make an honest effort to crack the QBE source code, and it is just impenetrable, not only because the difficulty of the domain, but the code is just arcane.

It was one of the projects that made me realize what the arcane wizened sages of olden C were capable of - C is not as much a programming language with best practices as a template for one - and many competing ideas and interesting ways of coding have emerged over the ~40 years of C dominance (starting from the emergence of the language, to the early 2000s, around when for various reasons, OOP kinda 'won') - if one abandons all pretense of safety and comfort.

There's this project and MIR - both have the same mad science DNA, QBE being a bit more friendly and well documented, with MIR making faster code - boiling down mostly to the architectural decision that MIR does inlining while QBE does not.

s3graham an hour ago | parent | next [-]

IR (https://github.com/dstogov/ir) is worth a look in this vein too.

I personally went with QBE for my hobby project because of C-interop, but at least in my tests, I found IR much faster and better codegen than MIR. Neither of MIR or IR are friendly/easy though.

2 hours ago | parent | prev [-]
[deleted]