About the りlang
(add 1 3 (sub 3 4 (mul 2 6) (div 9 3))) # calculate
(let x 2)(let y (add 1 3)) # assign variable
(def (f arg1 arg2) (mul arg1 arg2))
(def (f arg) (proc (mul arg 3) (mul arg 2)))
# define functions, note that the last expression is the return value.
(proc (exp) (exp) (exp)) # a list of processing expression
(if (condition) (true_bench) (false_bench)) # condition test
(f arg1 arg2) # function calls
About the Assemble Code.
MOV [source], [destination] # mov source to destination
LEA [source], [destination] # load the effect value stored
in source address to destination
ADD [source], [destination] # add source to destination
SUB [source], [destination] # sub destination by source
MUL [source], [destination] # multiply destination with source
DIV [source], [destination] # divide destination by source,
note that if you divide by zero, the result would be zero.
INC [destination] # increase by one
DEC [destination] # decrease by one
CMP [a], [b] # b - a -> FLAG
J [tag] # jl if FLAG < 0, je if =
PUSH [value] # push value to stack
POP [register] # pop value in stack to register
HALT # stop the computer
NOP # do nothing