On Sat, 22 Feb 2003, Jim Weirich wrote:

> Just to be a little contrary ... consider the following function
<snip>
> Probably very wise words.
<snip>

a very interesting analysis!  i am in complete agreement with you as well.  i
write a lot of decoders and parsers here at work and have found that state
machines end up being more maintainable.  this is not espcially suprising
considering that a regex is an entire state machine crammed into a single
line!  when writing a state machine you are essentially writing your own
regex, which accepts (matches), or does not accept (does not match), a given
input.

a combination of the two, state machines which also use regexs, probably
offers the most powerfull combination of ease of creation, ease of
maintainance, and speed of execution.  this is the approach some of our c++
decoder classes are taking.  i think something like ruby-lex
(http://raa.ruby-lang.org/list.rhtml?name=ruby-lex) is attractive for this
reason : it combines a state machine with ruby's builtin regex power.  with a
C lexer you only get half of this (flex generated lexer) unless you find C's
regex 'easy' to use.

just some thoughts for you parsers out there...

-a

-- 
 ====================================
 | Ara Howard
 | NOAA Forecast Systems Laboratory
 | Information and Technology Services
 | Data Systems Group
 | R/FST 325 Broadway
 | Boulder, CO 80305-3328
 | Email: ahoward / fsl.noaa.gov
 | Phone:  303-497-7238
 | Fax:    303-497-7259
 ====================================