diff options
author | kdx <kdx@42l.fr> | 2023-03-14 01:00:28 +0100 |
---|---|---|
committer | kdx <kdx@42l.fr> | 2023-03-14 01:00:28 +0100 |
commit | 915ddb4243856339a4f95493271052523d150633 (patch) | |
tree | 748e1ba74f9b7eba829064f5f6c579f8e162da9b | |
parent | c8dbf66087ac618299dfff435ba0381588d184c3 (diff) | |
download | golem-915ddb4243856339a4f95493271052523d150633.tar.gz |
README.md
-rw-r--r-- | README.md | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..a49ddce --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +# [GOLEM](https://kdx.re/cgit/golem) + +Work in progress bytecode language created by and for [kdx](https://kdx.re). + +[Follow progress on kdx.re/cgit.](https://kdx.re/cgit/golem) + +```golem +// Focus is on having a simple toolchain to build onto. +// For this reason, MVP syntax should stay as simple as possible. +// The weird mixture of C and Lisp is a feature, I swear. + +// Global scope is initialized to zero. +global g_heap; + +main(argc argv) { + local hello; + local world; + + g_heap = 8000; + hello = (strdup "bonjour"); + world = (strdup "monde"); + (print hello); + (print " "); + (print world); + + return 0; +} + +alloc(size) { + local ptr; + + ptr = g_heap; + g_heap = (+ g_heap size); + + return heap; +} + +strdup(str) { + local dest; + local i; + + dest = (alloc (+ [str 0] 1)); + + i = 0; + while (<= i [str 0]) { + [dest i] = [str i]; + i = (+ i 1); + } + + return dest; +} + +print(str) { + local i; + + i = 1; + while (<= i [str 0]) { + (putchar [str i]); + i = i + 1; + } + + return 0; +} +``` + +Copyright (c) 2023 kdx +CC BY-SA 4.0 |