5 ms·
I had this same realization over the summer when I spent some time learning about interpreted languages, VMs and the like. Once I realized what a compiler does
by maximilian 18y ago
I had this same realization over the summer when I spent some time learning about interpreted languages, VMs and the like. Once I realized what a compiler does, I couldn't believe how simple the basic idea is. Obviously the devil is in the details, but its surprising nonetheless how simple a compiler can be.
- yan 18y agothe devil is in the details The details are usually what gives one project/company/etc a huge advantage over the rest and are usually the hardest to get right. The basic idea of everything isn't hard to grasp, but to create a proper modern compiler/operating system/game/etc is a ton of work not suited for everyone.
- gabrielroth 18y agoI don't think either the OP or the author of the linked article claimed that the details are unimportant or that creating a 'proper modern compiler' is simple. Rather, they're claiming that many people find compilers _conceptually_ intimidating, and that this is unwarranted.
- Nelson69 18y agoThere is some truth to this. I also think that when people say "compiler" they commonly have an expectation that is closer to something like GCC. What he's describing is akin to a code to assembly translator; in college in the first week or two of the compilers class we wrote simple C to assembly code translators in yacc. It's really not much more to it than that. You simply lex it, you parse it and if your language is simple enough you can pretty much just emit instructions. Traditionally, those were some of the hardest and most time consuming parts of compiler development. When you start to add all the translations to perform advanced optimization and those optimizations, you're talking about some very very cool stuff and it is kind of hard and I think of lot of people think of that when they think "compiler." Those simple code translators really ignore that which is the part most compiler users are really thankful for. How did Bruce Lee say it? "It is like a finger pointing away to the moon. Do not concentrate on the finger or you will miss all that heavenly glory."
- damienkatz 18y agoThe real devil in compilers is the optimization. It's one thing to take some code and expand it out correctly to lower level code, it's quite another to transform it into compact, efficient AND correct low level code. And often there are no right answers what to optimize, just tradeoffs.