about summary refs log tree commit diff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/19.src23
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/19.src b/examples/19.src
new file mode 100644
index 0000000..2aa5dd7
--- /dev/null
+++ b/examples/19.src
@@ -0,0 +1,23 @@
+extern printf = (*i64, varargs) => void;
+extern malloc = (i64) => *i8;
+extern free = (*i64) => void;
+
+let main = () => i64 {
+	let buf = malloc(13);
+	(*(buf+0)) = 'h';
+	(*(buf+1)) = 'e';
+	(*(buf+2)) = 'l';
+	(*(buf+3)) = 'l';
+	(*(buf+4)) = 'o';
+	(*(buf+5)) = ' ';
+	(*(buf+6)) = 'w';
+	(*(buf+7)) = 'o';
+	(*(buf+8)) = 'r';
+	(*(buf+9)) = 'l';
+	(*(buf+10)) = 'd';
+	(*(buf+11)) = '\n';
+	(*(buf+12)) = '\0';
+	printf("%s", buf);
+	free(buf);
+	return 0;
+};