#lang scheme (require scheme/pretty (planet chongkai/sml/lang/reader) srfi/13) (define (convert filename) (let ((orig-p (open-input-file (string-append filename ".source") #:mode 'text)) (out-p (open-output-file (string-append filename ".ss") #:mode 'text #:exists 'replace))) (when (string-prefix? "#lang" (read-line orig-p)) (pretty-print (read orig-p) out-p) (close-input-port orig-p) (close-output-port out-p)))) (define (converts pathname) (for-each (lambda (path) (let ((t (regexp-match "(.*)\\.source" path))) (when t (let ((name (cadr t))) (display name) (newline) (convert name))))) (map (lambda (p) (string-append pathname (path->string p))) (directory-list pathname)))) (converts "/mnt/e/svn/sml/hamlet/")