3 ms·
Writing a compiler is easy. Optimizing one, not so much, but setting "writing a compiler" as some kind of difficult thing that requires arcane magic irritates m
by klibertp 14y ago
Writing a compiler is easy. Optimizing one, not so much, but setting "writing a compiler" as some kind of difficult thing that requires arcane magic irritates me.
- rubinelli 14y agoMaybe most people's last contact with compilers was that lex/yacc undergraduate course. That was much harder than it had to be.
- klibertp 14y agoMy first contact with compiler writing was through a book, I forgot the title, where the guy explained how to write a compiler for pascal-like language for some specific, non-x86 processor (I forgot which; I only remember that it wasn't anything I'd heard of). The book was very amusing and made me realize how simple the idea of compilers is - I was somewhat proficient with assembly then and after a few illustrative examples it all "clicked". Needless to say, the parser was handwritten and expanded when another construct was added to the language, so it was the simplest and lowest-overhead possible. Anyway, compilers and interpreters ideas are very simple and powerful and beautiful because of that. There is no magic, however magical their workings may seem from the higher level :)
- dmpk2k 14y agoMayhap you refer to Crenshaw's tutorials.
- Silhouette 14y agosetting "writing a compiler" as some kind of difficult thing that requires arcane magic irritates me Isn't this a problem with much of software development, though? Most topics in the field are logical and easy to work with once you've spent a little time investigating them, but until you do, they can easily seem like black magic. When the Web was young and all the modern "server languages" were still obscure infants, I used to think that working with CGI was some sort of impressive, specialist skill. One day, I discovered to my amazement that it was just a simple, text-based protocol that I could work with perfectly well using nothing but standard C and a bit of trivial printf/scanf code. After literally years of assuming I'd never be smart enough to work on web sites, my perspective changed completely in a single afternoon. I must have had a dozen such epiphanies over a few years -- writing a simple compiler as we're discussing here, programming a game with graphics, dynamically linking libraries at run time, many more -- before I finally realized that usually the idea itself was quite simple but a poor choice of tools or just the lack of one good tutorial can make it seem impossibly complicated.