Closed blackening closed 9 months ago
@martin-henz Are we sure we want to handle array literals this way? The current approach shown above makes more sense: We push values into the control in the order encountered in the parse tree, and then when the array literal instruction is called the values in the stack are in reverse order, so the machine can just pop the values and put them into the array in order.
Edit: Nevermind, I was wrong.
For input [1,2,3];
Should be the opposite order: arr 3, 3,2,1.
The CSE machine in the lecture is correct.