From f7b36cb81d96817d1c69ffe9025b88112de7400c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sun, 24 Nov 2024 13:05:11 +0100 Subject: Implement the while loop --- tests/expectations/print_after_loop.txt | 1 + tests/expectations/print_in_proc.txt | 1 + tests/vm/print_after_loop.elna | 9 +++++++++ tests/vm/print_in_proc.elna | 7 +++++++ 4 files changed, 18 insertions(+) create mode 100644 tests/expectations/print_after_loop.txt create mode 100644 tests/expectations/print_in_proc.txt create mode 100644 tests/vm/print_after_loop.elna create mode 100644 tests/vm/print_in_proc.elna (limited to 'tests') diff --git a/tests/expectations/print_after_loop.txt b/tests/expectations/print_after_loop.txt new file mode 100644 index 0000000..0cfbf08 --- /dev/null +++ b/tests/expectations/print_after_loop.txt @@ -0,0 +1 @@ +2 diff --git a/tests/expectations/print_in_proc.txt b/tests/expectations/print_in_proc.txt new file mode 100644 index 0000000..8351c19 --- /dev/null +++ b/tests/expectations/print_in_proc.txt @@ -0,0 +1 @@ +14 diff --git a/tests/vm/print_after_loop.elna b/tests/vm/print_after_loop.elna new file mode 100644 index 0000000..3fd9175 --- /dev/null +++ b/tests/vm/print_after_loop.elna @@ -0,0 +1,9 @@ +proc main() { + var x: int; + + x := 0; + while (x < 2) { + x := x + 1; + } + printi(x); +} diff --git a/tests/vm/print_in_proc.elna b/tests/vm/print_in_proc.elna new file mode 100644 index 0000000..8c4588b --- /dev/null +++ b/tests/vm/print_in_proc.elna @@ -0,0 +1,7 @@ +proc print2(a: int) { + printi(a); +} + +proc main() { + print2(14); +} -- cgit v1.2.3