VM Emulator does not read my labels

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

VM Emulator does not read my labels

Dilip
I have made a file:
function Sys.init 0
	push constant 8
	call Sys.fact 1
	label end
	goto end
(I have removed the code for Sys.fact)

When I try to load it into the VM Emulator, it gives an error at line 5(the goto end statement) saying that no label called Sys.init$end is defined. Is this my program's error (I don't have any reason to think so, as I have defined the label in line 4, just before the goto statement) or an error in the VM emulator?
Reply | Threaded
Open this post in threaded view
|

Re: VM Emulator does not read my labels

cadet1620
Administrator
Dilip wrote
I have made a file:
function Sys.init 0
	push constant 8
	call Sys.fact 1
	label end
	goto end
(I have removed the code for Sys.fact)

When I try to load it into the VM Emulator, it gives an error at line 5(the goto end statement) saying that no label called Sys.init$end is defined. Is this my program's error (I don't have any reason to think so, as I have defined the label in line 4, just before the goto statement) or an error in the VM emulator?
It looks like the VM Emulator does not like leading whitespace on label commands.  This version loads and runs:
function Sys.init 0
push constant 8
call Sys.fact 1
label end
goto end

function Sys.fact 0
push constant 0
return 0
--Mark
Reply | Threaded
Open this post in threaded view
|

Re: VM Emulator does not read my labels

Dilip
Thanks, it works without leading whitespace for all the VM commands.