summaryrefslogtreecommitdiffhomepage
path: root/snippets
diff options
context:
space:
mode:
Diffstat (limited to 'snippets')
-rw-r--r--snippets/.gitkeep0
-rw-r--r--snippets/test_snippets/inner.nc11
-rw-r--r--snippets/test_snippets/test_ostream.nc9
-rw-r--r--snippets/test_snippets/test_printf.nc11
-rw-r--r--snippets/test_snippets/test_struct.nc20
5 files changed, 51 insertions, 0 deletions
diff --git a/snippets/.gitkeep b/snippets/.gitkeep
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/snippets/.gitkeep
diff --git a/snippets/test_snippets/inner.nc b/snippets/test_snippets/inner.nc
new file mode 100644
index 0000000..5d90b41
--- /dev/null
+++ b/snippets/test_snippets/inner.nc
@@ -0,0 +1,11 @@
+extern exit;
+
+let main()
+{
+ let foo := 42;
+
+ const ret_stub():
+ foo := 0x10;
+ exit(foo);
+ return 0x0;
+}
diff --git a/snippets/test_snippets/test_ostream.nc b/snippets/test_snippets/test_ostream.nc
new file mode 100644
index 0000000..0d0410b
--- /dev/null
+++ b/snippets/test_snippets/test_ostream.nc
@@ -0,0 +1,9 @@
+#include <GenericsLibrary/ostream.nhh>
+
+let main()
+{
+ let io := 0;
+ io := ostream{};
+ let arr := io.read(0, 0);
+ return arr;
+} \ No newline at end of file
diff --git a/snippets/test_snippets/test_printf.nc b/snippets/test_snippets/test_printf.nc
new file mode 100644
index 0000000..c29bb05
--- /dev/null
+++ b/snippets/test_snippets/test_printf.nc
@@ -0,0 +1,11 @@
+export main;
+
+let main()
+{
+ if (0x01 =: 0x01):
+ {
+ return 0;
+ }
+
+ return 1;
+} \ No newline at end of file
diff --git a/snippets/test_snippets/test_struct.nc b/snippets/test_snippets/test_struct.nc
new file mode 100644
index 0000000..71a9492
--- /dev/null
+++ b/snippets/test_snippets/test_struct.nc
@@ -0,0 +1,20 @@
+extern exit;
+extern malloc;
+
+let construct_foo()
+{
+ let io := 0;
+ io := malloc(4);
+
+ return io;
+}
+
+let main()
+{
+ let io := 0x0;
+ io := construct_foo();
+
+ _ := exit(io);
+
+ return first_number;
+} \ No newline at end of file