a simple parser for math expressions