#################### # ALZHEIMER SYNTAX # #################### ############ # comments # ############ # # starts a comment, end of line ends ######################## # variable declaration # ######################## var : var a :number # declare numeric variable a var ,,... : # declare multiple variables of same type var b,c,d :number # declare 3 numeric variables # arrays are supported: # var [],[] :number # creates numeric array of elements # # and numeric array of elements # to use i'th element of array [i] # also every time you create array, array.size variable creates # it stores array size (obviously) var myAwesomeArray[100] :number # myAwesomeArray.size=100 # built-in types: # :number ############## # statements # ############## # statements are much like s-expressions foo(a,bar(b,c))); # if you start statement with $: it will be not checked for stack sanity # (stack sanity check is only performed if -stackGuard command line option is enabled) $: foo(a,bar(b,c))); # if you want to assign the result of statement # you write = after $: and put everything # else (except ;) in brackets() $: a=(1); d=(foo(a bar(b c)))); # there are some build-in functions: # add(a b) or +(a b) – addition # sub(a b) or -(a b) – subtraction # mul(a b) or *(a b) – multiplication # div(a b) or /(a b) – division # more(a b) returns 1 if a > b , 0 otherwise # moreeq(a b) returns 1 if a >= b, 0 otherwise # less(a b) returns 1 if a < b , 0 otherwise # lesseq(a b) returns 1 if a <= b, 0 otherwise # eq(a b) returns 1 if a == b , 0 otherwise # neq(a b) returns 1 if a != b, 0 otherwise ############## # if - else # ############## # simplest if statement # if : # # endif # should not start with $: # remember that shoult return a number # also it's result will be checked for inequality with 0 # and if it is not 0, the before endif will be executed # (like in C and many other languages) # so, the same stuff in C # more complex if statement # if : # # else # # endif # if result is not 0, the before else will be executed # otherwise, the before endif will be executed. ############### # while loop # ############### # while : # # endwhile # while results is not 0 # before endwhile will be executed # for example: var a :number $: a=(10); while more(a 0): $: a=(sub(a 1));# will be executed 10 times endwhile # a will be 0 # break statement aborts loop execution immediatelly # continue statement aborts current loop iteration jumping it to the next one ############ # for loop # ############ INITIALIZATION; CONDITION; AFTERT HOUGHT # for ; ; ; # # endfor # # basically is transformed to # # while : # # # endwhile var i; for i=(0); less(i 3) ; i=(add(i 1)); $: a=(add(a 1)) # will be executed 3 times endfor ######################## # function declaration # ######################## # fun: (): # # end # type is return type of the function # some functions may not have any arguments # so, are optional # also ,some of them do not return nothing # so, : is also optional # return # aborts function execution # and returns result # is not necessary for # functions without return type fun: foo(a b:number):number $: a=(add(a 1)); $: b=(sub(b 1.5)); return add(a b); end fun: bar(a b c:number):number $: a=(add(a c)); $: b=(sub(b 1.5)); return add(a b); end ############ # imports # ############ # import "" "" ... "" ; # add ... as dependencies for your program import "conio" "common" ; ################# # custom types # ################# # type : # : ... # : ... # ..................... # end # # create instance # var : # access fields # . type :Point # point on screen :number x y end type :Size # size on screen :number w h end type :Rect # rectangle on screen :Point origin :Size size end var p :Point $: p.x=(1); $: p.y=(add(p.x 100)); # also you can use Type.size in your code as a numeric constant a = :Point.size # a will store Point's size (2 on mvm) ################################### # low level code (asm: statement) # ################################### # asm: # # end # each line of assembly code should terminated with ; ############# # MORE INFO # ############# # # for more info see examples in tests folder in project #