you can use tiny_expr package, there is simple and straightforward implementation of parsing the expressions from string.
tiny_expr