T =
x names ([a-z]+) like x, y, abc, foo, bar, baz
@ T T application
\ x . T abstraction
Y x . T recursion
123 number
+ T T operators: + - * / % ^ < <= <> > >= ==
if T then T else T conditional
: T T cons (pair constructor)
car T left/first/addressregister cons field
cdr T right/second/dataregister cons field
iscons T test for cons
bind T T binds a return to a function after evaluating the content of return
return T wraps a term to avoid evaluation
not T
log T
sqrt T
ceil T
floor T
round T
put T output to console (will be wrapped inside a return)
alert T output to alert window (will be wrapped inside a return)
random get random number (will be wrapped inside a return)
get get number from prompt dialog window (will be wrapped inside a return)
par T T parallel evaluation, result is second term. note: works only with lazy evaluation
the first expression will be evaluated seperately; it will vanish as soon as it is evaluated.
if the main expression of the program is evaluated, all other (parallel) evaluations stop.
syntactic sugar:
let x = T1 in T2 ==> @ (\x.T2) T1
letrec x = T1 in T2 ==> @ (\x.T2) (Yx.T1)