diff options
author | Mathias Magnusson <mathias@magnusson.space> | 2025-07-22 22:38:01 +0200 |
---|---|---|
committer | Mathias Magnusson <mathias@magnusson.space> | 2025-07-22 22:38:01 +0200 |
commit | 8b2323108f484c259d863e68a23f9766e658c07d (patch) | |
tree | fc36a437a3608bc5b9e66d60a7ab295b1ded06d6 /fibonacci.hgn | |
parent | 86532befde8205b440ae0d630fa8feb94afe27da (diff) | |
download | huginn-8b2323108f484c259d863e68a23f9766e658c07d.tar.gz |
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
Diffstat (limited to 'fibonacci.hgn')
-rw-r--r-- | fibonacci.hgn | 10 |
1 files changed, 10 insertions, 0 deletions
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) |