adding a small algorithm to eval mathematical expressions