Hi, On Thu 23 Feb 2012 03:50, Mark H Weaver <m...@netris.org> writes:
> Here's a preliminary patch that greatly improves our 'tree-il->scheme' > decompiler. Interesting patch! I suppose that readability is really the key thing here, and so we should apply it. A few comments: > I've also disabled the use of partial evaluation when generating > psyntax-pp.scm. This is by far the biggest improvement in the size and > readability of psyntax-pp.scm, since it avoids the aggressive inlining. > Peval will still be applied when it's compiled to a .go file. Interesting. Just to defend peval ;-), last time I checked, this inlining does not result in growth of the .go file. It may even make bootstrapping faster, by eliminating some of the deep lexical-ref forms. But here, readability is the concern, so disabling peval does sound like the right thing. > (tree-il->scheme): Print source identifiers where possible, otherwise > use minimal numeric suffixes. Previously we printed the gensyms. > Avoid 'begin' in contexts that provide an implicit 'begin'. Produce > 'cond', 'and', 'or', and 'let*' where appropriate. Add keyword > arguments to disable the production of these derived syntactic forms, > either globally or only within top-level definitions (a hack for use > in bootstrapping psyntax). I don't like the name of #:booting-psyntax?; wdyt about changing it to #:use-derived-syntax? ? > + (record-case e > + ((<void>) > + '(if #f #f)) *unspecified* if using derived forms? > + ((<toplevel-define> name exp) > + `(define ,name ,(if booting-psyntax? > + (recurse-with-options exp #f) > + (recurse exp)))) (define (foo ...) ...) for lambda expressions? (Dunno.) > + ((<fix> gensyms vals body) > + ;; not a typo, we really do translate back to letrec. use letrec* > since it > + ;; doesn't matter, and the naive letrec* transformation does not > require an > + ;; inner let. > + `(letrec* ,(map list (map output-name gensyms) (map recurse vals)) > + ,@(recurse-body body))) Likewise? (Dunno :) OK! Andy -- http://wingolog.org/