From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: on bootstrapping: introducing Mes Date: Tue, 21 Jun 2016 16:32:04 +0200 Message-ID: <877fdi8vff.fsf@gnu.org> References: <87twgp8mi5.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1466519593 31551 80.91.229.3 (21 Jun 2016 14:33:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 21 Jun 2016 14:33:13 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue Jun 21 16:33:03 2016 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFMjT-00078s-5E for guile-user@m.gmane.org; Tue, 21 Jun 2016 16:32:51 +0200 Original-Received: from localhost ([::1]:52327 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFMjS-0008Ga-6D for guile-user@m.gmane.org; Tue, 21 Jun 2016 10:32:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFMj0-0008GH-3E for guile-user@gnu.org; Tue, 21 Jun 2016 10:32:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFMiw-0003K3-A6 for guile-user@gnu.org; Tue, 21 Jun 2016 10:32:21 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:45397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFMiw-0003JO-3q for guile-user@gnu.org; Tue, 21 Jun 2016 10:32:18 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1bFMir-0006Uq-Vy for guile-user@gnu.org; Tue, 21 Jun 2016 16:32:14 +0200 Original-Received: from pluto.bordeaux.inria.fr ([193.50.110.57]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Jun 2016 16:32:13 +0200 Original-Received: from ludo by pluto.bordeaux.inria.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 21 Jun 2016 16:32:13 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: pluto.bordeaux.inria.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 4 Messidor an 224 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:yE1pYSQGwouFlAmJB+Z96I2kG5M= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:12676 Archived-At: Hi! Jan Nieuwenhuizen skribis: > I have a minimal LISP-1.5-resembling interpreter in C that now can > also interpret itself > > https://gitlab.com/janneke/mes > > It was inspired by the seemingly often ignored bootstrapping question > made so painfully visible by GuixSD and by OriansJ with their self > hosting hex assembler project. Sounds fun! > As a next step after a hex assembler I was thinking of getting Scheme up > and running and use that to create a tiny C compiler, probably using > PEG. For that I think we need define-syntax, which I had a peek at and > still scares the all-sorts-of-things out of me :-) > > I searched for minimal Lisp/Scheme to get that going and found an > article called the Maxwell Equations of Software 1) with a pointer to > the 1962 LISP 1.5 paper by John McCarthy 2). > > First I `implemented' Mes/LISP-1.5: the bottom half of page 13 and the > necessary helper procedures defined on pages 8-12 using Guile, removing > all but the primitives needed to run LISP-1.5/Mes (I think): car, cdr, > cond, cons, define, eq?, '()/nil, null?, pair? and quote. I cheated > with read, and with display and newline for debugging. > > Then I translated the program into C and got rid of read by using > getchar/ungetchar. > > It's been great fun and now I'm kind of stuck a bit at the point of > implementing macros. I have a simplistic version in C but want to > remove that again --I like the idea of having the absolute minimal LISP > interpreter in C-- and only introduce macros after having bootstrapped > into the LISP/Mes domain. >From a bootstrapping viewpoint, since Mes is in C, we’re back to the same problem we have with Guile. :-) Guile has an interpreter written in C, for bootstrapping purposes, and it’s capable of running any kind of Scheme code, I think, including the full macro expander. To make the bootstrap Guile smaller, maybe we could remove .go files from it and build them as the initial step. That would be comparable to the strategy you suggest, I think. Cheers, Ludo’.