You could just punt and pass things off to gnuplot.
In reply to Re: Parsing Math Strings by Fletch in thread Parsing Math Strings by pokemonk