[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-libmatheval] how CFEngine got a math eval function
From: |
Ted Zlatanov |
Subject: |
[bug-libmatheval] how CFEngine got a math eval function |
Date: |
Fri, 03 Jan 2014 11:50:43 -0500 |
User-agent: |
Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux) |
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
- [bug-libmatheval] how CFEngine got a math eval function,
Ted Zlatanov <=