guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] tree-il->scheme improvements


From: Mark H Weaver
Subject: [PATCH] tree-il->scheme improvements
Date: Thu, 01 Mar 2012 18:34:41 -0500

Hello all,

Here's a significantly refactored version of my 'tree-il->scheme'
improvements.  In addition the previous features, it can now produce
'case' statements, named-let, internal defines, procedure documentation
strings, and various other improvements.  It now works mostly in a
bottom-up fashion, and uses (ice-9 match) to recognize the derived
forms.  I also removed the 'booting-psyntax?' hack; the relevant
workarounds for booting are now contained solely within
compile-psyntax.scm.

The last patch is new.  It minimizes the wraps of the embedded syntax
objects in psyntax-pp.scm, such that they can no longer be used as the
first argument to 'datum->syntax' but are otherwise equivalent.  (The
resulting syntax-objects are the same as those returned by
'locally-bound-identifiers', but without the added anti-marks).

With these patches, 'psyntax-pp.scm' is now less than 1/9 of its
original size.  Also, the output of the ,expand and ,optimize REPL
commands is much nicer.  For example:

Before:

  scheme@(guile-user)> ,use (ice-9 match)
  scheme@(guile-user)> ,optimize (match x ((v . v) v) (_ #f))
  $1 = (begin
    (letrec*
      ()
      (let ((v-159 x))
        (if (pair? v-159)
          (begin
            (letrec*
              ()
              (let ((w-162 (car v-159)) (x-163 (cdr v-159)))
                (if (equal? x-163 w-162) w-162 #f))))
          #f))))

After:

  scheme@(guile-user)> ,use (ice-9 match)
  scheme@(guile-user)> ,optimize (match x ((v . v) v) (_ #f))
  $1 = (let ((v x))
    (and (pair? v)
         (let ((w (car v)) (x (cdr v)))
           (and (equal? x w) w))))

Still yet to do: add tests for full coverage of the new code.

Comments and suggestions solicited.

     Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]