From f82c58539e1f7b9b864e68ea2ab0c6a17c15fbb5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 6 Jun 2016 18:12:31 +0200 Subject: bournish: Allow compilation of multiple expressions. * guix/build/bournish.scm (%bournish-language): Add a joiner to SCHEME. Compile only to Scheme. * tests/bournish.scm: New file. * Makefile.am (SCM_TESTS): Add it. --- guix/build/bournish.scm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/build/bournish.scm b/guix/build/bournish.scm index 3bea1c80c2..1f17e0a22d 100644 --- a/guix/build/bournish.scm +++ b/guix/build/bournish.scm @@ -149,11 +149,24 @@ (define (read-bournish port env) (define %bournish-language (let ((scheme (lookup-language 'scheme))) + ;; XXX: The 'scheme' language lacks a "joiner", so we add one here. This + ;; allows us to have 'read-bournish' read one shell statement at a time + ;; instead of having to read until EOF. + (set! (language-joiner scheme) + (lambda (exps env) + (match exps + (() '(begin)) + ((exp) exp) + (_ `(begin ,@exps))))) + (make-language #:name 'bournish #:title "Bournish" + + ;; The reader does all the heavy lifting. #:reader read-bournish - #:compilers (language-compilers scheme) - #:decompilers (language-decompilers scheme) + #:compilers `((scheme . ,(lambda (exp env options) + (values exp env env)))) + #:decompilers '() #:evaluator (language-evaluator scheme) #:printer (language-printer scheme) #:make-default-environment -- cgit v1.2.3