;; really simple calculator (add/subtract)
;;
loop while run = true:
src_in == get cli_opt(a);
if cli_opt = '0' then FAIL
else
continue
open_file(src_in) as #1
open_file(asm_out) as #2
read (#1):
case of #1,1 :
if ';;' then continue
if "a" then var1 = decmial("a")
case of #1,2 :
if ';;' then continue
if "+" then x = '+'
if "-" then x = '-'
case of #1,3 :
if ';;' then continue
if "b" then var2 == decimal("b")
case of x:
if x = '+' then z = add
if x = '-' then z = sub
else
FAIL
;; put out asm
let varA = ""push", var1 "r1""
let varB = ""push", var2 "r2""
let oper = "z, "r1 r2 > r3"
let varC = "mov r3 > s1"
write #2(varA, varB, oper, varC)
run = false