summaryrefslogtreecommitdiff
path: root/module/language/ghil/spec.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/language/ghil/spec.scm')
-rw-r--r--module/language/ghil/spec.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/module/language/ghil/spec.scm b/module/language/ghil/spec.scm
index ee574b50b..c9d38aa69 100644
--- a/module/language/ghil/spec.scm
+++ b/module/language/ghil/spec.scm
@@ -34,11 +34,30 @@
(lambda (env vars)
(make-ghil-lambda env #f vars #f '() (parse-ghil env x)))))
+(define (join exps env)
+ (if (or-map (lambda (x)
+ (or (not (ghil-lambda? x))
+ (ghil-lambda-rest x)
+ (memq 'argument
+ (map ghil-var-kind
+ (ghil-env-variables (ghil-lambda-env x))))))
+ exps)
+ (error "GHIL expressions to join must be thunks"))
+
+ (let ((env (make-ghil-env env '()
+ (apply append
+ (map ghil-env-variables
+ (map ghil-lambda-env exps))))))
+ (make-ghil-lambda env #f '() #f '()
+ (make-ghil-begin env #f
+ (map ghil-lambda-body exps)))))
+
(define-language ghil
#:title "Guile High Intermediate Language (GHIL)"
#:version "0.3"
#:reader read
#:printer write-ghil
#:parser parse
+ #:joiner join
#:compilers `((glil . ,compile-glil))
)