From 40ead42f0f59cfc8a4a3470cc316b845d6313fe9 Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Thu, 26 Jul 2012 13:59:33 -0600 Subject: [PATCH] [honu] add module for debugging honu programs. first feature passes the input through honu-read --- collects/honu/debug.rkt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 collects/honu/debug.rkt diff --git a/collects/honu/debug.rkt b/collects/honu/debug.rkt new file mode 100644 index 0000000000..66226833a5 --- /dev/null +++ b/collects/honu/debug.rkt @@ -0,0 +1,22 @@ +#lang racket/base + +(require "core/read.rkt" + racket/pretty + racket/cmdline) + +;; Helpful debug things for Honu +;; * read a Honu program and view its structure as an s-expression (before enforestation) + +(define (read-file file) + (printf "Read file ~a\n" file) + (pretty-print (with-input-from-file file + (lambda () (honu-read))))) + +(define (do-parse-command-line) + (command-line + #:program "debug" + #:args files + files)) + +(for ([file (do-parse-command-line)]) + (read-file file))