diff options
author | Ludovic Courtès <ludo@gnu.org> | 2016-06-06 18:12:31 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2016-06-06 18:14:52 +0200 |
commit | f82c58539e1f7b9b864e68ea2ab0c6a17c15fbb5 (patch) | |
tree | d6e8c1f22cc9ec41d9fb3628d3540688dde99c02 /guix | |
parent | 8bebe00a76012a07e91930dcfd68058d4309ae99 (diff) | |
download | gnu-guix-f82c58539e1f7b9b864e68ea2ab0c6a17c15fbb5.tar gnu-guix-f82c58539e1f7b9b864e68ea2ab0c6a17c15fbb5.tar.gz |
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.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/bournish.scm | 17 |
1 files changed, 15 insertions, 2 deletions
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 @@ code as an sexp." (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 |