vm-repl.scm 371 B

123456789101112131415161718
  1. (define (print0 port)
  2. (lambda (s)
  3. (display:port s port)
  4. (display:port (integer->char 0) port)))
  5. (define (compile-and-run exp)
  6. (let ((p (vm:open)))
  7. (display ">>> ")
  8. (compile exp #f p '(halt))
  9. (print `(result ,(vm:finish p)))))
  10. (load-macros)
  11. (let ((code (read-s* (tokenize standard-input))))
  12. (for-each compile-and-run code))
  13. (print 'completed)