Larry O’Brien: Fun With Compilers...Really



Email    print   
September 1, 2007 —  (Page 1 of 2)
I used to think that writing a compiler was the most fun you could have programming. I now amend that. Writing a unit-tested compiler is the most fun you can have programming.

Compilers and translators are not very commonly required to solve business needs, but not every data-source produces library-parsable XML, and the tools needed to transform structured-but-untagged data are the same ones that are used to emit code. And while the topic of parsing text is deep enough to warrant thick books, the types of input that a business developer is likely to face are usually easily tackled with modern tools. When a translation or code-generation problem arises in discussion, your pulse should quicken from excitement rather than fear.

I think the best modern tool for parsing is ANTLR (www.antlr.org), recently updated to a long-awaited third version. ANTLR is a long-term project from the University of San Francisco’s Terence Parr and can handle most any grammar thrown at it (technically, it generates arbitrarily deep LL look-aheads and memorizes them for performance in a packrat-like manner). ANTLR has a fantastic IDE called ANTLRWorks (developed primarily by Jean Bovet) and a text-generation library called StringTemplate. Each component has a learning curve, and the overall system is complex enough that even the most bold would be wise to work their way through the time-honored four-function calculator example. This “Hello, World” of parsing is used in Parr’s new book “The Definitive ANTLR Reference,” published by The Pragmatic Programmers, and unequivocally necessary as a supplement to the ANTLR documentation and wiki.

Although I’ve used ANTLR in the past, only with the new release have I used it to tackle a production problem—handling a quite complex mainframe output with decades of accreted special-case quirks and codes. As is not uncommon, my clients felt locked in to a supplier who charged them tens of thousands in annual license fees, confident that no one would breach the barrier to entry of parsing the mainframe data. When client discussions involve people saying things like “If you look at line 429,327, you’ll see an example of the problem,” such confidence might have been justified in the past.




Pages 1 2 


Share this link: http://sdt.bz/31101
 
Most Read Latest News Blog Resources

Add comment


Name*
Email*  
Country     


  • Comment
Loading




close
NEXT ARTICLE
Analyst Watch: Why Google’s Obama gambit will fail
What could Eric Schmidt get from President Obama is he supports his jobs bill? Read More...
 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 

Download Current Issue
FEBRUARY 2012 PDF ISSUE

Need Back Issues?
DOWNLOAD HERE

Want to subscribe?


 
blogs tab
Are you at risk for burnout?
Burnout is a severe problem and it can strike at any time. Here's how to tell if you are nearing the edge.
02/09/2012 02:16 PM EST

Agility, mom, and apple pie
If we're to evaluate the state-of-the-art in software development, we should start with the values espoused in the Agile Manifesto.
02/07/2012 11:57 AM EST

RIM woos developers with free tablet
How do you get more apps ported to the BlackBerry PlayBook? By giving every developer a free tablet, of course!
02/04/2012 01:57 PM EST

GitHire: Use Headhunters to Find Your Perfect Programmer
Are you a hiring manager tired of scouring the job boards? Check out this new service that will find 5 people interested in your jobs.
02/03/2012 12:17 PM EST

Facebook claims hacker cred
Facebook's SEC S-1 filing form includes a short essay on the Hacker Way by Mark Zuckerberg himself.
02/02/2012 08:26 AM EST

Ryan Dahl steps down
Ryan Dahl, creator of Node.js, steps back from his position as gatekeeper for the project.
02/01/2012 04:58 PM EST

 
Events calendar tab
2/13/2012 to 2/16/2012
Santa Clara
TechWeb

2/26/2012 to 2/29/2012
San Francisco
BZ Media

2/27/2012 to 3/2/2012
San Francisco
RSA

3/4/2012 to 3/7/2012
Las Vegas
IBM Tivoli

3/5/2012 to 3/9/2012
San Francisco
TechWeb