/** * Pops two terms, constructs an Evaluation from these terms, and pushes it. * * @param Assembly the assembly to work on */ public void workOn(Assembly a) { Term second = (Term) a.pop(); Term first = (Term) a.pop(); a.push(new Evaluation(first, second)); }
/** Demonstrate that this utility class does not loop. */ public static void main(String args[]) { IParser e = new MidiParser().expression(); Assembly out = e.bestMatch(new TokenAssembly("111 - (11 - 1)")); System.out.println(out.pop()); }