Unix Review > Archives > 2005 > September 2005

UnixReview.com
September 2005

Regular Expressions: Two Easy Steps Better Than One Hard One

by Cameron Laird and Kathryn Soraiz

This year, Regular Expressions has frequently commented on the advantages of learning the idioms specific to a particular language. Let's look now at a few underappreciated approaches to parsing that apply to a broad class of languages and how they might benefit your own development.

Two overdone parsing techniques are yacc and complicated regular expressions (REs). Powerful as they are — the name of this column hints at our appreciation of the latter — they also poorly fit many of the situations where incompletely educated programmers try to apply them. Phaseit just finished a string of several months of consulting with successive clients whose coincidental overreliance on REs made trouble for them.

Structuring program and data

One engaging alternative to "normal-form"-oriented parsing is "partial evaluation" (PE) or "active data". Several distinct labels capture parts of the ideas at work in this area; we'd welcome help from readers on more precise or at least widely recognized names. PE, as we'll present it here, is most accessible in "scripting languages", Lisp, Forth, m4, and others that expose programmatic access to the language parser.

Sys Admin Spotlight

CMP DevNet Spotlight

Career Center: Going It Alone
Ever dreamed of leaving that corporate development job for the challenges of independent software consulting? Here are 10 tips to make your solo career path a success.

In the News

CD-ROM

Sys Admin and The Perl Journal CD-ROM version 11.0

Version 11.0 delivers every issue of Sys Admin from 1992 through 2005 and every issue of The Perl Journal from 1996-2002 in one convenient CD-ROM!

Order now!




MarketPlace

Workflow Enabled Help Desk & IT Service Management
Automate service desk activities and integrate processes across IT. Learn more here.

Flowcharts from C/C++ code -- Free trial download
Understand C/C++ code in less time. A new team member ? Inherited legacy code ? Get up to speed faster with Crystal Flow for C/C++. Code-formatting improves readability. Flowcharts are integrated with code browser. Export flowcharts to Visio.

Discover WinDev 11 RAD
and develop 10 times faster ! ALM, IDE, .Net, PDF, 5GL, Database, 64-bit, etc. Free Express version

Online Crash Analysis
Automatically capture customer crash data, no debugger required. Support for .NET, C++, OS X, Java.

Wanna see your ad here?