added the jump_backward_if_true instruction.

added more do-while handling code
This commit is contained in:
hyunghwan.chung
2017-01-30 16:48:42 +00:00
parent 341966e373
commit 22013650bb
8 changed files with 360 additions and 96 deletions

View File

@ -176,14 +176,29 @@ class MyObject(Object)
a := a + 100000000000000.
}.*)
(*
a := 5.
while (true)
a := while (true)
{
a := a + 1.
if (a > 20) { break }.
##if (a > 20) { break if (true) { break. }. }.
if (a > 20) {
^if (true) { break } else {10}. ## return gets ignored for break.
}.
a dump.
}.
a dump.*)
a := 5.
do {
a := do {
('in loop.....' & a asString) dump.
if (a > 5) { break }.
a := a + 1.
} while(a < 10).
} while (false).
a dump.
## these should be elimited by the compiler.
nil.
1.
0.
@ -192,6 +207,8 @@ class MyObject(Object)
thisContext.
nil.
nil.
## end of elimination.
'---------- END ------------' dump.
##Processor sleepFor: 20.
}

View File

@ -100,6 +100,7 @@ class MyObject(Object)
'literal expected'
'break or continue not within a loop'
'break or continue within a block'
'while expected'
).
f := Stdio open: 'generr.out' for: 'w'.