summaryrefslogtreecommitdiff
path: root/module/ice-9/compile-psyntax.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2012-03-01 17:56:14 -0500
committerMark H Weaver <mhw@netris.org>2012-03-03 18:05:21 -0500
commit72ee0ef71b9a0514874976cdcf3ea9d5333db4b1 (patch)
tree31412c012bf443ca2864f90362caf108784a26c8 /module/ice-9/compile-psyntax.scm
parent8c43b28a1136aba186fd211b0f6037cf0c35f006 (diff)
downloadguile-72ee0ef71b9a0514874976cdcf3ea9d5333db4b1.tar.gz
tree-il->scheme improvements
* module/language/tree-il.scm (tree-il->scheme): New implementation that simply calls 'decompile-tree-il'. * module/language/scheme/decompile-tree-il.scm (choose-output-names, do-decompile): New internal procedures. (decompile-tree-il): New and improved implementation. Print source identifiers where possible, otherwise add minimal numeric suffixes. Previously we printed the gensyms. Avoid 'begin' in contexts that provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or', 'let*', named let, and internal defines where appropriate. Recognize keyword arguments in 'opts' to disable the production of these derived syntactic forms, and to optionally strip numeric suffixes from variable names. * module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec fixing, and primitive expansion when producing psyntax-pp.scm, in order to produce output as close to the original source as practical. Disable production of derived syntactic forms as needed during bootstrap. Strip numeric suffixes from variable names. Adjust pretty-printing parameters. * module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half of the original size.
Diffstat (limited to 'module/ice-9/compile-psyntax.scm')
-rw-r--r--module/ice-9/compile-psyntax.scm16
1 files changed, 11 insertions, 5 deletions
diff --git a/module/ice-9/compile-psyntax.scm b/module/ice-9/compile-psyntax.scm
index 3d803e9c7..ee0bd9efd 100644
--- a/module/ice-9/compile-psyntax.scm
+++ b/module/ice-9/compile-psyntax.scm
@@ -17,7 +17,7 @@
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(use-modules (language tree-il)
- (language tree-il optimize)
+ (language tree-il primitives)
(language tree-il canonicalize)
(ice-9 pretty-print)
(system syntax))
@@ -41,11 +41,17 @@
(begin
(pretty-print (tree-il->scheme
(canonicalize!
- (optimize!
+ (resolve-primitives!
(macroexpand x 'c '(compile load eval))
- (current-module)
- '())))
- out)
+ (current-module)))
+ (current-module)
+ (list #:avoid-lambda? #f
+ #:use-case? #f
+ #:strip-numeric-suffixes? #t
+ #:use-derived-syntax?
+ (and (pair? x)
+ (eq? 'let (car x)))))
+ out #:width 120 #:max-expr-width 70)
(newline out)
(loop (read in))))))
(system (format #f "mv -f ~s.tmp ~s" target target)))