Correct me if I'm wrong, but can't jumping out of a stack-based loop without adjusting the stack (popping the last address) come back to bite you in the a** later?
hmm. I admit not knowing how to write a compiler, but here's how I would imagine it'd work:(yes, i know, not asm yada yada, this is just an asmish lang i've made up just now thats pretty low level. not low low though :P)
SET i,0 'Line 1 CMP i,100,4'Line 2 If i=100 jump to line 5, else continue ADD i,1,i 'Line 3 i=i+1 JMP 2 'Line 4 Go back to line 2Why have a stack? This can of course work for the other loops as well, simpler in most other cases.
exit[n] is a horrible solution. Worse than goto which is at least readable. It doesn't even point to a label so you'd have to study the code to figure out where it's going.
Yes, but according to skid/mark you cannot use goto in strict mode, so we look for alternatives. Even if it isnt so readable, if you have your code indented its no problem to find where execution pops back out.