aboutsummaryrefslogtreecommitdiff
path: root/examples/arithmetic.hdass
diff options
context:
space:
mode:
Diffstat (limited to 'examples/arithmetic.hdass')
-rw-r--r--examples/arithmetic.hdass13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/arithmetic.hdass b/examples/arithmetic.hdass
new file mode 100644
index 0000000..359653e
--- /dev/null
+++ b/examples/arithmetic.hdass
@@ -0,0 +1,13 @@
+// Computes (5 + 3) * 2 - 1 = 15 and returns it as the exit status.
+const SYS_EXIT = 60
+
+proc main
+{
+ rdi = 5
+ rdi += 3
+ rdi *= 2
+ rdi -= 1
+
+ rax = SYS_EXIT
+ syscall
+}