Commit graph

12 commits

Author SHA1 Message Date
32d17134cd evalexpr: parse: parse operand more correctly
I noted that the `right_prec` and `next_prec` functions taking a
character only work because prefix operators come after infix operators
in the table. We should compare the *actual* operator kind, which would
probably need a single operator enum to make sure there are no
collisions.
2020-11-02 15:48:30 +01:00
b5912f508e evalexpr: parse: improve precedence climbing
The previous version of the algorithm did not take into account the fact
that the main loop should only run while we have postfix or infix
operators. This happened to work because of the small amount of
operators used in the grammar.

The previous version also had prefix operators hard-coded in the operand
parsing function.
2020-11-02 15:48:30 +01:00
88b7f50a3a evalexpr: parse: use single 'ops' table 2020-11-02 15:48:30 +01:00
81f7d30ddd ci: add Drone CI 2020-11-02 15:48:30 +01:00
665e05401f git: ignore testsuite binary 2020-11-02 15:48:30 +01:00
f9719e9c9b evalexpr: tests: add Criterion testsuite 2020-11-02 15:48:30 +01:00
b5b2744a1e git: ignore evalexpr binary 2020-11-02 15:48:30 +01:00
23c94b1d06 doc: add README 2020-11-02 15:48:30 +01:00
92ae5e3ab9 evalexpr: allow choosing parser at build time 2020-11-02 15:48:30 +01:00
9a6da7b19a evalexpr: parse: add precedence climbing parser 2020-11-02 15:48:29 +01:00
ad56ea521a evalexpr: parse: rename recursive parsing function 2020-11-02 15:48:29 +01:00
a92e39dbec evalexpr: initial recursive descent parser 2020-10-28 15:40:57 +01:00