Parse this, baby!

Ovid on 2005-05-05T03:20:51

I'm quite happy to have overcome a major parsing hurdle today. The following Perl code is eventually parsed down to an abstract syntax tree that our data stores can use to search for information (usually converted to SQL, but not required):

name => 'foo',
OR
( age => BETWEEN [18 => 32] )

However, the following will also reduce down to the same abstract syntax tree:

"name => 'foo',
OR
( age => BETWEEN [18 => 32] )"

What's the difference? The former is Perl code. The latter is a string. The former is useless from a Web client perspective. The latter is a piece of cake if you're working with AJAX.