Stack class that checks Well-Formed Formulas