[plt-scheme] Re: macros and eval

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Mar 16 18:43:19 EDT 2008

How about this for a VM Language interpreter:

#lang scheme

;; Path -> Path
(define (make-script script)
   (define f (make-temporary-file "vmscript~a.ss"))
   (with-output-to-file f
     (lambda ()
       (printf "#lang scheme\n")
       (with-input-from-file script copy-all))
     #:exists 'replace)

;; -> Void
;; copy all of stdin to all of stdout
(define (copy-all)
   (define next (read-line))
   (unless (eof-object? next)
     (printf "~a\n" next)

;; run script run
(define foo (make-script "foo.ss"))

(dynamic-require foo #f)

;; ---

It assumes foo.ss in the same directory contains some S expressions  
that work as a scheme module in v4, but they are not "moduled".  
Parameterize over it and add whatever requires you need to have a VM  
Language interpreter. Create an executable from within DrScheme.

I still think that even your naive systems guys want to edit and  
develop such things in a good editor and DrScheme plus a language  
level sound like the right thing.

-- Matthias

Posted on the users mailing list.