Punie operators

Allison on 2006-02-16T06:50:25

Yesterday and today I finished plugging in the operator precedence parser. (Three cheers to Patrick for his work that made it possible!) Punie can now handle statements like:

print 1 + 2 + 3;


and

print 1 - 2, "\n", 7 - 1, "\n";


and

if (42 + 11) {
  print "ok 1\n";
}


I first implemented it with most of the work happening in the POST->PIR transformation, but that turned out to be pretty hacky. So, I redid the bottom half with most of the work in the PAST->POST transformation. This is much cleaner, and produces POST structures that are quite close to the final PIR syntax. While I was at it, I refactored the code for printing lists, so it also splits out the opcodes during the PAST->POST transformation. Both the operator implementation and the print statement refactor rely heavily on the new POST::Ops node, so it is turning out to be quite useful.