[ccan] The lemon parser as a ccan module

Tim Post echo at echoreply.us
Wed Apr 8 18:58:49 EST 2009


Hi,

I was considering turning this:

http://www.hwaci.com/sw/lemon/

Into a ccan module. I'm reaching a point in some programs where code is
getting almost unreadable due to clever pointer arithmetic (and very
hard to expand), but I don't want to depend on something I can't just
drop into the tree.

Recently, I wanted to allow users to specify a printf style syntax like
this in a configuration file, to dictate the output of a program:

/tmp/foo/%s/jobs/%d.out

Or perhaps

/tmp/jobs/%d/%s.out

Or perhaps

/tmp/jobs.out

So either I come up with a hand rolled parser that knows to expand %s to
a process name and %d to a job id (despite presence or order), or I
depend on a generator that the user may or may not have, all to deal
with a single string.

Since lemon is easy to drop in, would it be a good candidate for a ccan
module? Has anyone else used it beyond trivial strings (i.e. to parse a
basic language) ? Its a little different in its grammar, so I thought it
prudent to ask.

To see it in use, well, just use sqlite3 :)

Cheers,
--Tim





More information about the ccan mailing list