Operators
Lame is a high-level interpreted language that makes hardware interaction obvious. The operators that are available reflect that.
Arithmetic
-
+- Add -
-- Subtract / Negate -
*- Multiply -
/- Divide -
%- Modulus
Comparison
-
==- Equals -
<>- Not equals -
>- Greater than -
>=- Greater than or equal to -
<- Less than -
<=- Less than or equal to
Location
Inside an object obj, anything can be referenced with ..
obj.CONSTANT
obj.variable
obj.function()
Address
The address of a symbol can be returned with @.
addr = @x
The value can be retrieved from an address with *.
y = *addr
Math Built-Ins
-
sqrt(x)- Square root -
abs(x)- Absolute value -
max(x, y)- Maximum -
min(x, y)- Minimum -
rand(x)- Random
Precedence
From highest to lowest:
-
Unary:
--,++,~,~~,@ -
Unary:
-,! -
Shift:
<<,>>,~>,<-,->,>< -
Bitwise and:
& -
Bitwise or:
|,^ -
Multiplicative:
*,/,// -
Additive:
+,- -
Relational:
==,<>,<,>,<=,=> -
Boolean not:
not -
Boolean and:
and -
Boolean or:
or -
Assignment:
:=,+=,-=,*=,/=,//=,<<=,>>=,~>=,->=,<-=,><=,&=,|=,^=