I want to implement such a program: it reads some expressions which includes some variables. These variables will be set later, and the program should calculate the final result(like sql prepared statement).
For example, the expression maybe like $foo + $bar + 2
, and I need to calculate the result when $foo
and $bar
is set later.
I'm trying to implement it with ragel and lemon. I have learned use ragel to parse the expression. But I don't know how to use lemon to handle the variable and do the calculation.
Thanks for any help.