unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: guile-devel@gnu.org
Subject: [PATCH] tree-il->scheme improvements
Date: Thu, 01 Mar 2012 18:34:41 -0500	[thread overview]
Message-ID: <87hay728vi.fsf@netris.org> (raw)

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	other threads:[~2012-03-01 23:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-01 23:34 Mark H Weaver [this message]
2012-03-01 23:40 ` [PATCH] tree-il->scheme improvements Mark H Weaver
2012-03-02  3:29   ` Noah Lavine
2012-03-03 17:28   ` Andy Wingo
2012-03-03 23:59     ` Mark H Weaver
2012-03-04 11:39       ` Andy Wingo
2012-03-04 15:03         ` Mark H Weaver
2012-03-04 18:43           ` Andy Wingo
2012-03-06 17:01   ` Ludovic Courtès
2012-03-02 18:34 ` Mark H Weaver
2012-03-02 19:11   ` Mark H Weaver
2012-03-03 17:10   ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87hay728vi.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).