about summary refs log tree commit diff
path: root/examples
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-03-29 11:22:13 +0100
committerBaitinq <[email protected]>2025-03-29 11:27:15 +0100
commitd74c6a363cf457a2197f3f10c0d567a77573e79c (patch)
treeb82cad7904e8493c28cfa1612de2e0e081484e0c /examples
parentCodegen: Support void type (diff)
downloadinterpreter-d74c6a363cf457a2197f3f10c0d567a77573e79c.tar.gz
interpreter-d74c6a363cf457a2197f3f10c0d567a77573e79c.tar.bz2
interpreter-d74c6a363cf457a2197f3f10c0d567a77573e79c.zip
Feature: Add basic support for pointer references and dereferences
Diffstat (limited to 'examples')
-rw-r--r--examples/17.src12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/17.src b/examples/17.src
new file mode 100644
index 0000000..0e73fae
--- /dev/null
+++ b/examples/17.src
@@ -0,0 +1,12 @@
+extern printf = (*i64, varargs) => void;
+extern malloc = (i64) => *i64;
+extern free = (*i64) => void;
+
+let main = () => i64 {
+	let x = malloc(8);
+	*x = 10;
+	printf("%p\n", x);
+	printf("%d\n", *x);
+	free(x);
+	return 0;
+};