aboutsummaryrefslogtreecommitdiff
path: root/language.md
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-09-07 07:33:13 +0100
committerJuan J. Martinez <jjm@usebox.net>2022-09-07 07:33:13 +0100
commit48896c56c39344fa429260d3969eccc93ef8035c (patch)
treeff4b278f6a685abae64ad0139fb94835088048b1 /language.md
parent781e2803e9cebef1c0282b9a73ebdafab055fc52 (diff)
downloadmicro-lang-hs-48896c56c39344fa429260d3969eccc93ef8035c.tar.gz
micro-lang-hs-48896c56c39344fa429260d3969eccc93ef8035c.zip
Some docs on operators
Diffstat (limited to 'language.md')
-rw-r--r--language.md20
1 files changed, 19 insertions, 1 deletions
diff --git a/language.md b/language.md
index ec0a425..4044ad1 100644
--- a/language.md
+++ b/language.md
@@ -354,7 +354,25 @@ TODO: a zero ended array of u8 with special initializers
## Operators
-TODO
+Micro2 uses the same operators and almost the same operator precedence as C, from more to less priority:
+
+```
+! - ~
+/ * %
+&
+- +
+<< >> | ^
+> >= < <=
+|| &&
+!= ==
+=
+```
+
+Arithmetic operators only apply to integers.
+
+Comparison operators only apply to integers, with the exception of `==` and `!=` that also apply to other types (if both operands are of the same type).
+
+Logic operators apply to booleans and they are lazy operators (e.g. in `a && b`, `b` won't be evaluated if `a` is false).
## Flow control