This post was updated on .
There's a little improvement for the if-code, which is also used by the supplied compiler, I think:
can be written as
This saves one line, because we don't have to calculate ~cond. Remark that it is now necessary to write A into a buffer, because we must not write A immediately when we encounter it while parsing. If the if's are nested, we have to use a stacked buffer.
There's also an improvement in handling let-assignments involving arrays.
If you have something like
let a[exp1] = exp2
The supplied compiler saves the value of exp2 in a temp. variable, then assigns pointer 1 and finally that 0;
however you can again save this temp-stuff by writing the exp1 code to a buffer.
pop pointer 1
pop that 0
writeBuffer() // writes the stuff inside startBuffer() ... endBuffer()