add raco read

This commit is contained in:
Matthew Flatt 2015-06-03 11:53:11 -06:00
parent 00893cbd3f
commit 3da4b863cf
4 changed files with 45 additions and 31 deletions

View File

@ -1,8 +1,13 @@
#lang racket/base #lang racket/base
(module expand racket/base
(require racket/cmdline (require racket/cmdline
raco/command-name raco/command-name
racket/pretty) racket/pretty)
(provide show-program)
(define (show-program expand)
(define source-files (define source-files
(command-line (command-line
#:program (short-program+command-name) #:program (short-program+command-name)
@ -30,4 +35,8 @@
(let ([e (read-syntax src-file in)]) (let ([e (read-syntax src-file in)])
(unless (eof-object? e) (unless (eof-object? e)
(pretty-write (syntax->datum (expand e))) (pretty-write (syntax->datum (expand e)))
(loop)))))))))) (loop))))))))))))
(require (submod "." expand))
(show-program expand)

View File

@ -8,6 +8,7 @@
("decompile" compiler/commands/decompile "decompile bytecode" #f) ("decompile" compiler/commands/decompile "decompile bytecode" #f)
("test" compiler/commands/test "run tests associated with files/directories" 15) ("test" compiler/commands/test "run tests associated with files/directories" 15)
("expand" compiler/commands/expand "macro-expand source" #f) ("expand" compiler/commands/expand "macro-expand source" #f)
("read" compiler/commands/read "read and pretty-print source" #f)
("distribute" compiler/commands/exe-dir "prepare executable(s) in a directory for distribution" #f) ("distribute" compiler/commands/exe-dir "prepare executable(s) in a directory for distribution" #f)
("demodularize" compiler/demodularizer/batch "produce a whole program from a single module" #f))) ("demodularize" compiler/demodularizer/batch "produce a whole program from a single module" #f)))

View File

@ -0,0 +1,4 @@
#lang racket/base
(require (submod "expand.rkt" expand))
(show-program (lambda (e) e))

View File

@ -13,4 +13,4 @@
(define pkg-authors '(mflatt)) (define pkg-authors '(mflatt))
(define version "1.2") (define version "1.3")