Hi,

I wanted to let you know that I implemented a math eval function for
CFEngine (http://cfengine.com) using a different tool, namely the
PEG/LEG parser from http://piumarta.com/software/peg/

The work is here https://github.com/cfengine/core/pull/882 if anyone is
interested; it contains the entire PEG/LEG parser generator
distribution and the actual integration code is pretty tiny.

Reasons for going with PEG/LEG:

- MIT license was a bit more permissive (CFEngine has a commercial
  version and I couldn't get permission to link it against libmatheval)

- lex+yacc simply suck for multiple coexisting grammars, especially
  across the many older platforms that CFEngine supports

- I found it useful to implement my own math evaluation for SI units and
  some extended operations, and the PEG grammar (current version in
  https://github.com/cfengine/core/blob/master/libpromises/math.peg) was
  very clean and intuitive.  I like the way it merges lexing and parsing.

I hope this is useful, and appreciate all the help I got on this mailing
list.

Thanks
Ted

Reply via email to