What's wrong with this code?
let vm_run vm =
let guard = ref true in
while !guard do
if vm.cur_pc = -1 && not (Stack.empty vm.call_stack) then vm_pop_ar vm
else if vm.cur_pc = -1 then guard := false
else if vm.cur_pc < Array.length vm.cur_code then
execute vm Array.get vm.cur_code vm.cur_pc;
vm.cur_pc <- vm.cur_pc + 1
else vm_pop_ar vm
done
Error is Error: Syntax error
related to the last else
keyword.
I reached good confidence with OCaml but an if/else chain still gives me some troubles.. that's not the first time (last time I exploited flow to avoid using the else keyword).
I think it's something small but have no clues, according to syntax specification it should be ok