A => r7csc.scm +24 -0
@@ 1,24 @@
+;; csc -x -X r7rs -R r7rs -uses library -uses eval $@
+
+(module r7csc ()
+ (import (only (chicken process-context) command-line-arguments)
+ (only (chicken file) file-exists?)
+ (only (chicken pathname) make-pathname)
+ (only (chicken process) process process-wait)
+ (only (chicken base) exit let*-values)
+ (scheme base)
+ (chicken foreign))
+
+ (define r7rs-options '("-x" "-X" "r7rs" "-R" "r7rs" "-uses" "library" "-uses" "eval"))
+
+ (define (compile)
+ (let*-values ([(csc) (foreign-value "C_CSC_PROGRAM" c-string)]
+ [(path) (foreign-value "C_INSTALL_BIN_HOME" c-string)]
+ [(cscpath) (or (file-exists? (make-pathname path csc)) "csc")]
+ [(in out pid)
+ (process cscpath
+ (append r7rs-options (command-line-arguments)))]
+ [(pid normal-exit? status) (process-wait pid)])
+ (exit status)))
+
+ (compile))
A => r7csi-bin.scm +20 -0
@@ 1,20 @@
+(module r7csi ()
+ (import (only (chicken process-context) get-environment-variable command-line-arguments)
+ (only (chicken process) process-execute)
+ (only (chicken base) exit)
+ (only (chicken pathname) make-pathname)
+ (only (chicken file) file-exists?)
+ (scheme base)
+ (chicken foreign))
+
+ (define r7rs-options
+ (append '("-R" "r7csi")))
+
+ (define (interpret)
+ (let*-values ([(csi) (foreign-value "C_CSI_PROGRAM" c-string)]
+ [(path) (foreign-value "C_INSTALL_BIN_HOME" c-string)]
+ [(csipath) (or (file-exists? (make-pathname path csi)) "csi")])
+ (process-execute csipath
+ (append r7rs-options (command-line-arguments)))))
+
+ (interpret))
A => r7csi.scm +8 -0
@@ 1,8 @@
+(module r7csi ()
+ (import (scheme base)
+ (scheme eval))
+
+ (define env (environment '(only chicken.base exit)))
+ (##sys#current-environment (##sys#slot env 2))
+ (##sys#macro-environment (##sys#slot env 2)))
+
A => r7rs-tools.egg +10 -0
@@ 1,10 @@
+((synopsis "'Pure' r7rs compiler and interpreter")
+ (category tools)
+ (author "Diego A. Mundo")
+ (license "public domain")
+ (dependencies r7rs)
+ (components (program r7csi-bin
+ (csc-options "-O3" "-d0")
+ (install-name r7csi))
+ (extension r7csi)
+ (program r7csc (csc-options "-O3" "-d0"))))