unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Alex Vong <alexvong1995@gmail.com>
To: Mark H Weaver <mhw@netris.org>
Cc: guile-user@gnu.org, bootstrappable@freelists.org
Subject: Re: Can Guile be bootstrapped from source without psyntax-pp.scm?
Date: Fri, 07 Jul 2017 22:00:24 +0800	[thread overview]
Message-ID: <87podc1h53.fsf@gmail.com> (raw)
In-Reply-To: <87inj5f2eg.fsf@netris.org> (Mark H. Weaver's message of "Thu, 06 Jul 2017 21:42:47 -0400")

[-- Attachment #1: Type: text/plain, Size: 2542 bytes --]

Hi Mark,

Mark H Weaver <mhw@netris.org> writes:

> Hi Alex,
>
> Alex Vong <alexvong1995@gmail.com> writes:
>
>> Recently, I've read the chapter on Macros in Guile's manual. The manual
>> says that Guile's expander originated from that of Chez Scheme's and
>> that version was portable to other schemes as well. So I search the
>> Internet and find it[0]. The website states that the expander needs an
>> expanded version of itself for bootstrapping, i.e. psyntax.ss needs
>> psyntax.pp for bootstrapping.
>>
>> After playing for awhile, I realize the relationship of Guile's
>> psyntax.scm and psyntax-pp.scm is exactly analogus. One needs an
>> expanded version of psyntax.scm, i.e. psyntax-pp.scm for bootstrapping.
>>
>> Does this mean Guile is not bootstrappable from source only?
>
> That's correct.  psyntax-pp.scm is not source code, and it is needed to
> bootstrap Guile.  However, I made an effort some years ago to make
> psyntax-pp.scm far smaller and more readable than the corresponding file
> from upstream psyntax.  See:
>
>   https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=72ee0ef71b9a0514874976cdcf3ea9d5333db4b1
>   https://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=1af6d2a717f499564fbbc297c79e00ac14b0dcf9
>
I see. So it used to be worse --- several millions LOC. Now it is only
~3000, which is shorter than Emacs's bytecomp.el

> At this point, I believe it would be quite feasible for a single hacker
> to audit our psyntax-pp.scm and compare it to psyntax.scm within a
> reasonable time frame.  Furthermore, when we make local changes to
> psyntax.scm, the corresponding changes to psyntax-pp.scm are localized
> and quite easy to audit as well, so the full audit need not be repeated.
>
It is really good that small change in source --> small change in
binary. A fancy way of saying it: the map between source and binary is
in some sense "continuious".

> Having said this, I agree that it would be better if psyntax.scm were
> written in such a way that it could be bootstrapped without the use of
> itself.  Maybe some day we'll rewrite it to make it so.
>
Agree.

For future interested readers:

I can imagine one way of doing it: First implement a low-level hygienic
macro expander without using macros and then write the syntax-case
expander using low-level macros.

To get started, you can watch the "Let's Build a Hygienic Macro Expander
— Strange Loop 2016, Matthew Flatt" video.

>       Mark

Cheers,
Alex

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2017-07-07 14:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06 15:24 Can Guile be bootstrapped from source without psyntax-pp.scm? Alex Vong
2017-07-07  1:42 ` Mark H Weaver
2017-07-07 14:00   ` Alex Vong [this message]
2017-07-07 16:40     ` Mark H Weaver
2017-07-07 14:55   ` Jan Nieuwenhuizen
  -- strict thread matches above, loose matches on Subject: below --
2021-03-13 22:42 Michael Schierl

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=87podc1h53.fsf@gmail.com \
    --to=alexvong1995@gmail.com \
    --cc=bootstrappable@freelists.org \
    --cc=guile-user@gnu.org \
    --cc=mhw@netris.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).