How’d you like that for an opening title? Did it grab your attention? Hell, your reading this far so I guess it did. The book I’m focusing on here is Build Your Own.NET Language and Compiler and please, don’t click the link and then go buy it. I don’t care about the 50 cents worth of referral money I’ll get if you do. I wouldn’t even recommend the book if I got 50 bucks of referral money (well, money talks, so maybe I would).
The book starts out with the basics of parsing and regular expressions and all that jazz. But the extent of the code is a bunch of screen shots. We are writing a parser/compiler dang it, we aren’t WYSIWYGing our way through life at this point, you have to show some real frigin code. What you end up with is a bunch of screen shots of many tools for writing a compiler, but not really the code, unless of course you go grab the CD and break through all of the code without a lick of explanation from the book. God I hope the code is well documented with comments, or you just bought an issue of Compiler’s Illustrated and this isn’t the Swimsuit edition. I’ll include some of my own links at the bottom, where I give actual code for many of these processes.
OK, so you get to see a bunch of tools, and what do you get? Well, you get a bunch of half-assed tools (sorry for the language if your kid is reading my highly technical blog… In fact, if he/she is I could use some interns, must type 50+ WPM and be proficient at C, C++, or C#). A mathematical expression evaluator is the first. I think it is always the first. People always trivialize math. So make sure you look at all the pretty pictures and try to glean some wisdom from the text. I have a mathematical expression evaluator by the way, it’s called calc.exe and from what I can tell it has shipped since 16-bit windows. He also makes an attempt at a regular expression workbench. You can’t have enough of those (actually I’m not being sarcastic here, I always appreciate a new regex tool), but then he never writes anything or demonstrates compiler technology that uses regular expressions. Does he go into NFA/DFA technology? Well, he does talk about it for a few sentences. BNF format? Again a few sentences here and there. But wait, another tool is what you get and this time it is a picture of a drop-down menu with all sorts of really tantalizing names (convert from BNF to XML, display a BNF parse tree, display formatted docs, etc…). At this point use one of the pages to catch the drool coming off your lip, because that is as close as you’ll get in this book to anything cool.
(more…)