; /* vim: set filetype=scheme : */ -*- scheme -*- (require (lib "cmdline.ss")) (command-line "compile" (current-command-line-arguments) (once-each [("-v" "--verbose") "Compile with verbose messages" (verbose-mode #t)] [("-p" "--profile") "Compile with profiling" (profiling-on #t)]) (once-any [("-o" "--optimize-1") "Compile with optimization level 1" (optimize-level 1)] ["--optimize-2" "" ; show help on separate lines "Compile with optimization level 2," "which implies all optimizations of level 1" (optimize-level 2)]) (multi [("-l" "--link-flags") lf ; flag takes one argument "Add a flag for the linker" (link-flags (cons lf (link-flags)))]) (args (filename) ; expects one command-line argument: a filename filename)) ; return a single filename to compile (define (nb trainf testf) (let ((wm ())) (file-do trainf train) (file-do testf test))) (define (two x y) (printf "~a: ~a [~a]~n" x y (symbol? (car y)))) (define (line row cells0) (let loop ((col 1) (cells cells)) (if cells (let ((token (symbolize (car cells))) (wm)))))) (define (file-do file proc) (define (worker) (let loop ((n 1) (x (read))) (cond ((not (eof-object? x)) (proc n x) (loop (+ 1 n) (read)))))) (if (file-exists? file) (with-input-from-file file worker) (error "file " file " missing"))) (file-do "/Users/timm/wisp/trunk/sandbox/timm/scm1/eg/0.in" two)