summaryrefslogtreecommitdiff
path: root/samples/helloworld.golem
diff options
context:
space:
mode:
Diffstat (limited to 'samples/helloworld.golem')
-rw-r--r--samples/helloworld.golem39
1 files changed, 39 insertions, 0 deletions
diff --git a/samples/helloworld.golem b/samples/helloworld.golem
new file mode 100644
index 0000000..5ddde54
--- /dev/null
+++ b/samples/helloworld.golem
@@ -0,0 +1,39 @@
+global str[32];
+
+main() {
+ strappend('H');
+ strappend('e');
+ strappend('l');
+ strappend('l');
+ strappend('o');
+ strappend(' ');
+ strappend('W');
+ strappend('o');
+ strappend('r');
+ strappend('l');
+ strappend('d');
+ strappend('!');
+ strappend('\n');
+
+ print(str);
+}
+
+strappend(c) {
+ local s;
+ s = str;
+ loop {
+ if ([s] == 0)
+ break;
+ s = s + 1;
+ }
+ [s] = c;
+}
+
+print(s) {
+ loop {
+ if ([s] == 0)
+ break;
+ wrt [s];
+ s = s + 1;
+ }
+}