From 1640915ddbd89c548987207c4e5134eefb849a5f Mon Sep 17 00:00:00 2001 From: sfja Date: Wed, 11 Dec 2024 00:22:13 +0100 Subject: [PATCH] add a few examples --- examples/add_fn.slg | 9 +++++++++ examples/add_int.slg | 5 +++++ examples/add_let.slg | 7 +++++++ compiler/example.slg => examples/example_1.slg | 0 runtime/example.slg => examples/example_2.slg | 0 examples/main.slg | 3 +++ 6 files changed, 24 insertions(+) create mode 100644 examples/add_fn.slg create mode 100644 examples/add_int.slg create mode 100644 examples/add_let.slg rename compiler/example.slg => examples/example_1.slg (100%) rename runtime/example.slg => examples/example_2.slg (100%) create mode 100644 examples/main.slg diff --git a/examples/add_fn.slg b/examples/add_fn.slg new file mode 100644 index 0000000..1107d55 --- /dev/null +++ b/examples/add_fn.slg @@ -0,0 +1,9 @@ + + +fn main() { + add(1, 2) +} + +fn add(a: int, b: int) -> int { + + a b +} diff --git a/examples/add_int.slg b/examples/add_int.slg new file mode 100644 index 0000000..24cf8d9 --- /dev/null +++ b/examples/add_int.slg @@ -0,0 +1,5 @@ + +fn main() { + + 1 2 +} + diff --git a/examples/add_let.slg b/examples/add_let.slg new file mode 100644 index 0000000..d1a564b --- /dev/null +++ b/examples/add_let.slg @@ -0,0 +1,7 @@ + +fn main() { + let a = 5; + let b = 3; + + a b +} + diff --git a/compiler/example.slg b/examples/example_1.slg similarity index 100% rename from compiler/example.slg rename to examples/example_1.slg diff --git a/runtime/example.slg b/examples/example_2.slg similarity index 100% rename from runtime/example.slg rename to examples/example_2.slg diff --git a/examples/main.slg b/examples/main.slg new file mode 100644 index 0000000..ce1caeb --- /dev/null +++ b/examples/main.slg @@ -0,0 +1,3 @@ + +fn main() {} +