This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: guile-vm-0.2
Mikael Djurfeldt <mdj@mdj.nada.kth.se> writes:
> > Or could I commit the source code in the Guile's CVS repository?
>
> If we knew now how to make the integration into Guile and how to mix
> code from your VM and from QScheme's, then we could add a subdirectory
> under guile-core.
>
> But we don't know that yet, so I've created the dirctory `guile-vm'
> for your vm. Just check out this module using
Thanks. Probably it is better to develop the VM as a separate package
until it becomes able to compile/evaluate all Guile's Scheme code.
> The best (in the sense of producing efficient code) compiler I'm aware
> of is ftp://ftp.nj.nec.com/pub/qobi/stalin-0.8.tar.gz. (You'll find
> the actual compiler in the file "stalin.sc".)
Wow, it's really a big compiler. Maybe it's too complex for me...
And we don't need type analysis now.
> A compiler that might be more accessible is Twobit by William Clinger.
> Here's some design notes for Twobit that you might find interesting:
This looks nice. I'll read the documents and the codes.
> I know that you have your own `cond' form. Are you asking this
> because you want to replace that one with a macro provided by the
> syntax case package? (I think this is a valid reason, I'm just
> asking.)
Yes. My `cond' implementation is incomplete, and I'm just translating
it into `if' forms. This should be done by syncase.
> Which other core syntax forms would you like to have support for?
I think that's it for now. I want to have support for generalized
`set!', but is it possible? Currently, syncase throws an error:
guile> (use-modules (ice-9 syncase))
guile> (syncase '(set! (foo x) #t))
ERROR: invalid syntax (set! (foo x) #t)
ABORT: (misc-error)
From another message:
> This is actually a tricky issue. If we want to be able to use
> different evaluators, each with its own "core language" together with
> the syntax case macros, we need to somehow tell the syntax case
> package what the core language for the expansion in question is.
>
> The question is how the API for this should look like. Maybe we can
> pass some kind of language definition object to the macro expander.
I think it would be the best if I could define my own syntax set
in a module and use it for expansion. Something like:
---- vm/syntax.scm ---------------------
(define-module (vm syntax)
:use-module (ice-9 syncase))
(define-syntax cond
(lambda (x)
(syntax-case ...)))
----------------------------------------
---- vm/compile.scm --------------------
(define-module (vm compile)
:use-module (ice-9 syncase))
(define compiler-syntax (module-syntax (resolve-module '(vm syntax))))
(define (compile form . opts)
(let ((expanded-form (expand form compiler-syntax)))
...
))
----------------------------------------
This is symmetrical to eval and very customizable.