#:use-module (system base compile)
#:use-module (system base language)
#:use-module (system vm program)
+ #:use-module (system vm objcode)
#:replace (eval-string))
(define (ensure-language x)
(set-port-column! port line))
(if (or compile? (not (language-evaluator lang)))
- ((make-program (read-and-compile port #:from lang #:to 'objcode)))
+ ((load-thunk-from-memory
+ (read-and-compile port #:from lang #:to 'rtl)))
(read-and-eval port #:lang lang))))))))
(define-module (language rtl spec)
#:use-module (system base language)
+ #:use-module (system vm objcode)
#:use-module (ice-9 binary-ports)
#:export (rtl))
+(define (rtl->value x e opts)
+ (let ((thunk (load-thunk-from-memory x)))
+ (if (eq? e (current-module))
+ ;; save a cons in this case
+ (values (thunk) e e)
+ (save-module-excursion
+ (lambda ()
+ (set-current-module e)
+ (values (thunk) e e))))))
+
(define-language rtl
#:title "Register Transfer Language"
- #:compilers '()
+ #:compilers `((value . ,rtl->value))
#:printer (lambda (rtl port) (put-bytevector port rtl))
#:reader get-bytevector-all
#:for-humans? #f)
#:printer write-tree-il
#:parser parse-tree-il
#:joiner join
- #:compilers `((glil . ,compile-glil)
- (cps . ,compile-cps))
+ #:compilers `((cps . ,compile-cps)
+ (glil . ,compile-glil))
#:for-humans? #f
)
;;; Compile --- Command-line Guile Scheme compiler -*- coding: iso-8859-1 -*-
-;; Copyright 2005,2008,2009,2010,2011 Free Software Foundation, Inc.
+;; Copyright 2005,2008,2009,2010,2011,2013 Free Software Foundation, Inc.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public License
(cons #:O o)
o)))
(from (or (assoc-ref options 'from) 'scheme))
- (to (or (assoc-ref options 'to) 'objcode))
+ (to (or (assoc-ref options 'to) 'rtl))
(target (or (assoc-ref options 'target) %host-type))
(input-files (assoc-ref options 'input-files))
(output-file (assoc-ref options 'output-file))
(define* (compile-file file #:key
(output-file #f)
(from (current-language))
- (to 'objcode)
+ (to 'rtl)
(env (default-environment from))
(opts '())
(canonicalization 'relative))
(define* (read-and-compile port #:key
(from (current-language))
- (to 'objcode)
+ (to 'rtl)
(env (default-environment from))
(opts '()))
(let ((from (ensure-language from))
#:use-module (system base language)
#:use-module (system base message)
#:use-module (system vm program)
+ #:use-module (system vm objcode)
#:autoload (language tree-il optimize) (optimize)
#:use-module (ice-9 control)
#:use-module (ice-9 history)
(define (repl-compile repl form)
(let ((from (repl-language repl))
(opts (repl-compile-options repl)))
- (compile form #:from from #:to 'objcode #:opts opts
+ (compile form #:from from #:to 'rtl #:opts opts
#:env (current-module))))
(define (repl-expand repl form)
(or (null? (language-compilers (repl-language repl)))
(repl-option-ref repl 'interp)))
(lambda () (eval form (current-module)))
- (make-program (repl-compile repl form)))))
+ (load-thunk-from-memory (repl-compile repl form)))))
(define (repl-eval repl form)
(let ((thunk (repl-prepare-eval-thunk repl form)))