diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2023-11-07 16:29:52 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2023-11-07 16:29:52 +0200 |
| commit | 5a0e57601a9489d9f56602e0184e722c85ffc310 (patch) | |
| tree | d217f13caa628bba83411da15a027fecbbb7244c /high-level-lang-idea.perl | |
| parent | 7309d563c6661f6e17c1ed3577b40b9646a85bb4 (diff) | |
WIP tree walking compiler
Diffstat (limited to 'high-level-lang-idea.perl')
| -rw-r--r-- | high-level-lang-idea.perl | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/high-level-lang-idea.perl b/high-level-lang-idea.perl deleted file mode 100644 index 426cae8..0000000 --- a/high-level-lang-idea.perl +++ /dev/null @@ -1,36 +0,0 @@ -# Builtin types: -# u8, u16, i8, i16, block[T], void - -# allocate 16 words, returning block -# a block is similar to a C pointer but contains the allocated size as well -decl v :: block[u16] = alloc-words 16 - -# define a fn that zeroes a block of memory -decl zero-block :: block[u16] -> void -func zero-block block - # for each address in block - for-addr addr block - # store the value 0 in memory at address addr - store addr 0 - -# call fn zero-block in inlined mode -zero-block% v - -# compute first 16 fibonacci numbers -decl a :: u16 = 0 -decl b :: u16 = 1 -for-index idx block - # declarations in loop constructs are hoisted - decl addr :: u16 = addr-at idx block - decl v :: u16 - - if idx == 0 - v = a - else if idx == 1 - v = b - else - v = a + b - - store addr v - a = b - b = v |
