[bootstrappable] Re: Can Guile be bootstrapped from source without psyntax-pp.scm?

  • From: Michael Schierl <schierlm@xxxxxx>
  • To: Jan Nieuwenhuizen <janneke@xxxxxxx>
  • Date: Sun, 14 Mar 2021 15:18:13 +0100


Hello Jan,


Am 14.03.2021 um 14:57 schrieb Jan Nieuwenhuizen:

Michael Schierl writes:

Hello,

For the record, I have written a psyntax implementation that can be used
by Guile (3.0.2) and does not require an expanded version of itself.

Oh, that's amazing!  I see that you are using make-syntax-transformer
(and others) which GNU Mes does not support yet; it only has
define-macro.  This may be a good reason/opportunity to work towards
better Guile support in Mes.

In fact, I use make-syntax-transformer only because Guile does not have
native define-macro support (it uses psyntax to emulate it).

When there is native define-macro support, you can replace step1.scm by

(define s1*-define-macro define-macro)

(define-macro (s1*-expand-with-side-effects seff1 body seff2)
  (list '(lambda (a b . c) (apply values b))
        seff1
        (list 'call-with-values (list 'lambda '() body)
              '(lambda rest rest))
        seff2))

which will make the bootstrap even shorter.

Probably you should validate whether the evaluation order is right so
that s1*-expand-with-side-effects will really expand the side effect 1
before the body and side effect 2 after the body (there is an example in
psyntax-bootstrapping.scm line 76 which should display 1 2 3 and return 42).

You can skip step 2 as well, as you already have a quasiquote expander
that does not rely on psyntex.

The further steps up to step 7 will not use make-syntax-transformer, it
will come back in step 8 (patched psyntax.scm). But probably for step 8
you would have to patch your own psyntax.scm instead of patching guile's
version anyway.


Regards,


Michael

Other related posts: