summaryrefslogtreecommitdiff
path: root/comp/lucas-standen-NEA/code2/sample.zpy
diff options
context:
space:
mode:
Diffstat (limited to 'comp/lucas-standen-NEA/code2/sample.zpy')
-rw-r--r--comp/lucas-standen-NEA/code2/sample.zpy25
1 files changed, 18 insertions, 7 deletions
diff --git a/comp/lucas-standen-NEA/code2/sample.zpy b/comp/lucas-standen-NEA/code2/sample.zpy
index 98bbf44..1eea0f4 100644
--- a/comp/lucas-standen-NEA/code2/sample.zpy
+++ b/comp/lucas-standen-NEA/code2/sample.zpy
@@ -1,11 +1,22 @@
-(defun fib int n:int)
- (if (<= n 1))
- (return n)
- (endif)
- (return (+ (fib (- n 1)) (fib (- n 2))))
+(symbol putchar int c:int)
+(symbol getchar int)
+
+(defun read char* str:char*)
+ (let count:int 0)
+ (for c:char (getchar) (!= c '\n') 0)
+ (set str[count] c)
+ (set c (getchar))
+ (set count (+ count 1))
+ (endfor)
+ (return str)
(endfun)
(defun main int)
- (fib 43)
- (return 0)
+ (let str:char* (alloc 10))
+
+ (set str (read str))
+
+ (for i:int 0 (< i 10) 1)
+ (putchar str[i])
+ (endfor)
(endfun)