I wrote a simple mathematical expression converter with Jay: Yacc for Java for my study.
http://www.cs.rit.edu/~ats/lp-2002-2/html/skript-23.html
The sample code in this page is a mathematical expression interpreter. You can calculate four arithmetic operations and more like 1 + 2 * 3
to 7
. My code which will be described in this post converts expressions into reverse Polish notation ones like 1 + 2 * 3
to 1 2 + 3 *
.