unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Daniel Kraft <d@domob.eu>
Cc: guile-devel@gnu.org
Subject: Re: Emacs Lisp revived
Date: Wed, 10 Jun 2009 00:19:00 +0200	[thread overview]
Message-ID: <m3d49d2gq3.fsf@pobox.com> (raw)
In-Reply-To: <4A2EC102.70304@domob.eu> (Daniel Kraft's message of "Tue, 09 Jun 2009 22:07:30 +0200")

Howdy,

On Tue 09 Jun 2009 22:07, Daniel Kraft <d@domob.eu> writes:

> I finally started real work on implementing the elisp compiler and just
> pushed a first start-off code to branch elisp.  It is however not yet
> usable for anything, but also already has some very few things done.

Yay!! I hope to have time to look at your branch soon :)

> 1) In implementing all those special forms like progn, prog1, if, while,
> ...  I think it is best to translate a basic set directly to TreeIL via
> the compiler, but also implement some (where that's reasonably possible)
> simply as elisp macros (or even some things as functions).  What do you
> think about this plan?

A core should compile to tree-il, and then you should be able to build
the rest with macros. What fun, no? :)

> 2) It seems that elisp uses nil as false value (and does not have a
> dedicated false); so the question raises, should be then always use #f
> for nil, or maybe TreeIL's void?

Don't use void. You should use Guile's %nil, and we should have a
make-nil instruction. %nil was added to Guile for precisely this
purpose.

> tree-il@(guile-user)> (if (void) (const 1) (const 2))

Oh yes, (void) is true indeed. (I'm happy you're using the tree-il repl
btw, that's nice :)

> Not related, but I came across it: (if (begin) 1 2) gives an error,
> don't know if that's expected.

Yes, it is an error. Surprising to me when I found that out, but even
R5RS prohibits it.

> 3) I still haven't got building lexical constructs in TreeIL working
> (and I figure that named-lets for compiling the while-construct are even
> more interesting), but will hopefully manage to do so soon...

Ooh, sorry for not getting back to you about that. I'm sleepy now though
;) Here's some examples:

scheme@(guile-user)> (use-modules (language tree-il))
scheme@(guile-user)> (unparse-tree-il (compile '(let ((x 10)) (+ x x)) #:to 'tree-il))
$3 = (let (x) (x33) ((const 10)) (apply (toplevel +) (lexical x x33) (lexical x x33)))
scheme@(guile-user)> (unparse-tree-il (compile '(let ((x 10)) (+ x x)) #:to 'tree-il))
$4 = (let (x) (x34) ((const 10)) (apply (toplevel +) (lexical x x34) (lexical x x34)))
scheme@(guile-user)> (unparse-tree-il (compile '(let ((x 10)) (+ x x)) #:to 'tree-il))
$5 = (let (x) (x35) ((const 10)) (apply (toplevel +) (lexical x x35) (lexical x x35)))
scheme@(guile-user)> (compile '(let ((x 10)) (+ x x)) #:to 'tree-il)
$6 = #<<let> src: #f names: (x) vars: (x36) vals: (#<<const> src: #f exp: 10>) body: #<<application> src: #f proc: #<<toplevel-ref> src: #f name: +> args: (#<<lexical-ref> src: #f name: x gensym: x36> #<<lexical-ref> src: #f name: x gensym: x36>)>>

You see what changes and what does not? The gensyms are "fresh names"
for the lexically bound vars. They are introduced in the binding
constructs and included in the references. You can make a gensym with
the `gensym' procedure.

Happy hacking!

Andy
-- 
http://wingolog.org/




      reply	other threads:[~2009-06-09 22:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 20:07 Emacs Lisp revived Daniel Kraft
2009-06-09 22:19 ` Andy Wingo [this message]

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=m3d49d2gq3.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=d@domob.eu \
    --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).