Zero Assembler

(zas  for som v 2.0)

There are two sections in the source:  symbolic name definitions, code.  Each section is ended by #.  The comment line starts with ;

Example

a = 1 + 2
print a


a 1
#
lit.2
lit.3
add
put.a
get.a
sys.1
end
#
The code section can contain labels.  A label is prefixed with :    A function definition starts with the instruction "fun.x" where x is the number of local variables in the body of function.  The function ends with "ret.x". 

Example

main(){
  a = 11;
  print(a);
}


;  example of calling function
#
call.main
end
:main
fun.1
lit.11
put.1
get.1
sys.1
ret.1
#

How to use Zas assembler

The assembler accepts standard input and produces "a.obj" (the som v2 object file).  The object file can be executed by somv2x.

c:> zas < source.txt
c:> somv2x a.obj


Happy coding!

last update 12 Sept 2012