From 4cf7c8bacfc836cff5278317cb32dc029cb87273 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 20 Oct 2024 22:47:03 +0300 Subject: play around with guile as a backend + I have officially devolved my language into an alternative syntax for Scheme. Oh well. --- examples/guile.lyn | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/guile.lyn (limited to 'examples/guile.lyn') diff --git a/examples/guile.lyn b/examples/guile.lyn new file mode 100644 index 0000000..9d7f445 --- /dev/null +++ b/examples/guile.lyn @@ -0,0 +1,18 @@ +define-syntax-rule (for init condition post body) { + expand init + do () ((not (expand condition))) { + expand body + expand post + } +} + +define (sum n) { + define s 0 + for (define i 0) (< i n) (set! i (1+ i)) { + set! s (+ s i) + } + get s +} + +display (sum 1000000) +newline -- cgit v1.2.3