som v2 x

syscall
1)  syscall(1,a)     print a as integer
2)  syscall(2,c)     print c as character (ascii)
3)  x = syscall(3)   getchar()
4)  syscall(4,s)     gets() get string to s
5)  -
6)  syscall(6,s)     print string s
7)  syscall(7)       stop
13) syscall(13)      stop (compatible with higher version)

Rz 3.5  

It can compile "syscall" although not being a reserved word. The compiler takes "hint" from the source, by defining an empty function:

syscall()

when the compiler encounter "syscall" it can convert that into (parse tree):

syscall(14,n) =>   (call syscall 14 #1)

and generate code =>  get.1 sys.14

syscall is used as an escape hatch to add extra code to the virtual machine.

26 Sept 2011

