From 8b2323108f484c259d863e68a23f9766e658c07d Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Tue, 22 Jul 2025 22:38:01 +0200 Subject: begin implementing procedure calls the register allocator does not consider the fact that called procedures probably clobber t-registers. also, the way i refer to the built in functions is cursed. it barely works now and won't when you can define procedures --- fibonacci.hgn | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 fibonacci.hgn (limited to 'fibonacci.hgn') diff --git a/fibonacci.hgn b/fibonacci.hgn new file mode 100644 index 0000000..00c0638 --- /dev/null +++ b/fibonacci.hgn @@ -0,0 +1,10 @@ +let a = 0 +let b = 1 +let n = read_int(0) +while n > 0 { + let c = a + b + a = b + b = c + n = n - 1 +} +print(a) -- cgit v1.2.3