aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-31 17:55:16 +0200
committerhachem <im@hachem.wtf>2026-08-31 17:55:16 +0200
commitcbdb9073480c3e4d8a088b306c23406cf42e25c0 (patch)
tree39f3093654cc8f27ea701ed1338cac84d93f42eb /examples
parent53aed3fadf1f7ad66dea9a8a0b46bf42eda921be (diff)
feat: hex/binary integer literals and constant-folding const expressions
Diffstat (limited to 'examples')
-rw-r--r--examples/constants.hdass15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/constants.hdass b/examples/constants.hdass
new file mode 100644
index 0000000..1bb85eb
--- /dev/null
+++ b/examples/constants.hdass
@@ -0,0 +1,15 @@
+[entry: main]
+
+// The exit status is folded from constant arithmetic, and SYS_EXIT is a hex
+// literal. STATUS = 6 * 7 = 42.
+const A = 6
+const B = 7
+const STATUS = A * B
+const SYS_EXIT = 0x3C
+
+proc main
+{
+ rdi = STATUS
+ rax = SYS_EXIT
+ syscall
+}