From d9e5e2d21f71e003ec8253c10a9aff37b27d22fa Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 2 Apr 2017 17:01:29 +0200 Subject: [PATCH] doc: Release update. * AUTHORS: Mention Nyacc and GuixSD. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.5 New file. * HACKING: Add pointers, update TODO/DONE. --- AUTHORS | 8 ++- HACKING | 100 ++++++++++++++----------------- INSTALL | 21 ++++--- NEWS | 28 ++++++++- README | 44 +++++--------- doc/ANNOUNCE-0.5 | 79 ++++++++++++++++++++++++ module/language/c99/compiler.scm | 2 +- module/mes/display.mes | 2 +- src/gc.c | 2 +- src/posix.c | 2 +- tests/vector.test | 2 +- 11 files changed, 191 insertions(+), 99 deletions(-) create mode 100644 doc/ANNOUNCE-0.5 diff --git a/AUTHORS b/AUTHORS index 2e2dc6d5..95d7bd52 100644 --- a/AUTHORS +++ b/AUTHORS @@ -10,9 +10,15 @@ module/srfi/srfi-9.scm Based on Guile ECMAScript module/language/c/lexer.mes +Included verbatim from GNU Guix +build-aux/compile-all.scm + Included verbatim from gnulib build-aux/gitlog-to-changelog +Nyacc C99 parser +module/nyacc + Portable hygienic pattern matcher module/mes/match.scm @@ -42,4 +48,4 @@ Srfi-26 from Guile module/srfi/srfi-26.scm Sxml bits from Guile -module/sxml/xpath.scm \ No newline at end of file +module/sxml/xpath.scm diff --git a/HACKING b/HACKING index 834285f0..d0d76e4c 100644 --- a/HACKING +++ b/HACKING @@ -1,36 +1,19 @@ -*-mode:org-*- +* SETUP + guix environment -l guix.scm #64 bit + 32bit + guix environment --system=i686-linux -l guix.scm #32 bit only * ROADMAP -** TODO release 0.5 - 1. mes.c: prototype Scheme interpreter in C, mature enough to run - 2. guile/mescc.scm: C compiler on [Guile] Scheme, that can compile - 2a. scaffold/hello.c: Simplest C program, compiled with 2. - 2b. scaffold/micro-mes.c: main of 3. (2nd Scheme interpreter) + mlib.c - 2c. scaffold/cons-mes.c: run simple hardcoded sexp - 2d. scaffold/tiny-mes.c: load memory dump, run simple sexp - 2e. scaffold/t.c: c compiler tests, enough to support compiling - 3. scaffold/mini-mes.c: 2nd Scheme intepreter in C, without [g]libc, using - 4. mlib.c: Minimal Mescc C library - 4a. scaffold/hello.c: Simplest C program, compiled with 5. - 4b. scaffold/micro-mes.c: main of 3. (2nd Scheme interpreter) + mlib.c - 4c. scaffold/cons-mes.c: run simple hardcoded sexp - 4d. scaffold/tiny-mes.c: load memory dump, run simple sexp - 4e. scaffold/t.c: run c test suite with scripts/mescc.mes - 5. scripts/mescc.mes: C compiler on mes, that can build scaffold/mini-mes.c - 5a. remove __MESC__/__NYACC__ C workarounds in gc.c and vector.c - 5b. module/language/c99/compiler.mes: refactor expr->arg, expr->accu, ast->info - 5c. merge *.c into scaffold/mini-mes.c - 5d. merge scaffold/mini-mes.c into mes.c - 5x. *we are here* - make guile-t, make guile-mini-mes, make mes-mini-mes - 6. scripts/mescc.mes: C compiler on mes, that can build mes - 7. release self-hosting Mes 0.5 - 7a. discuss full source bootstrap strategy on guile-user with - Orians Jeremiah (stage0+) Luca Saiu's (GNU Epsilon). -** release 0.x, unsorted +** TODO +*** release 0.x, unsorted + - discuss full source bootstrap strategy on guile-user with Jeremiah + Orians (stage0+) Luca Saiu (GNU Epsilon). + - fix bugs - produce intermediate annotated assembly-like mes.S - - AND/OR: connect to GNU Epsilon's VM - - AND/OR: connect to OriansJ's stage0...LISP bootstrapping tools + - and/or: connect to OriansJ's stage0...LISP bootstrapping tools + - and/or: connect to GNU Epsilon's VM + - and/or: translate Mes.c interpreter into VM + - and/or: compile Scheme to C, rewrite Mes.c into Mes.scm. - real module support, bonus for supporting Guile's define-module/define-public syntax - get full source syntax-case up (Andre van Tonder?) OR drop psyntax/syntax-case and rewrite Nyacc without syntax-case+R7RS Ellipsis @@ -39,44 +22,42 @@ respecting no-syntax-case bootstrap requirement *** Compile the [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]] - build tcc (tinycc) -** release 1.0 +*** release 1.0 - work to replace GuixSD's bootstrap binaries for x86 - more architectures? - ** DONE -** Support call-with-current-continuation, refactor catch/throw +** 0.5: Mutual self-hosting Scheme interpreter and C compiler: mes.c and mescc, + Support call-with-current-continuation, refactor catch/throw ** 0.4: Support Nyacc, Gcc-compiled Mes compiles minimal main.c using nyacc ** 0.3: Garbage collector ** 0.2: Support psyntax ** 0.1: Mes eval/apply feature complete; support syntax-rules, compile main.c using LALR, dump ELF -* Full source bootstrapping - -** R6RS-like scheme interpreter -This first part is prototyped in C by the mes.c core and Scheme -bootstrap code in module/. Of course, while mes.c is pretty small it -cannot serve as a full source solution. - -The initial idea was to have the minimal core support LISP-1.5 (or -something very close to that as a tribute to John McCarthy) and extend -eval/apply from LISP-1.5 source with define, define-macro etc. and -metamorphose into R6RS. It seemed to work but performance of the -LISP-intepreted RRS was so bad (~1000x slower than initial LISP-1.5) -that this track was abandoned after the initial ANNOUNCE. - -The route changed, trying to strike a balance between core size and -performance: still writing as much as possible in Scheme but having a -mescc compiler that takes not more than some seconds to run. - -Now that we have [[https://github.com/schemeway/lalr-scm][Dominique Boucher's LALR]], a [[https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html][Pre-R6RS portable -syntax-case]] with R7RS ellipsis, [[http://www.nongnu.org/nyacc/][Nyacc]] and [[https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html][Guile's PEG]] parsers, it's -time to start doing something useful. - * Bugs +** eval_apply/gc + Nyacc bug +scripts/messc.mes intermittently exposes a bug in eval_apply/gc when +Nyacc parses mes.c-sized source. Running + + MES_MAX_ARENA= scripts/mescc.mes + +may [un]cover the bug. So there is probably some eval_apply-construct +that Nyacc uses, possiblby indirectly via with-fluid, like (call/cc, +call-with-current-continuation), that breaks when GC triggers at the +wrong time. +** mescc can only compile itself, it cannot compile tcc, gcc or guile +** mes.mes cannot read sexps, only --dump's, mes.mes cannot --dump +** Bootstrap binary mes is too big and opaque to be considered source +68kB ELF binary which can be disassembled (objdump -d mes.mes). +** Psyntax is too big and opaque to be considered source +And needs a patched Guile-1.8 to [re]generate. ** test/match.test ("nyacc-simple"): hygiene problem in match -** The Scheme reader is very slow. +** Performance +*** mes is slow +*** The Scheme reader is very slow. +*** mescc is slow +**** compiling mes.c takes mescc.mes 2h30' +mescc.scm which runs on Guile takes 30" ** Fluids are a hack for Nyacc. -** Prototype mes.c depends on a C compiler. *** Translate C-prototype mes.c into annotated hex? One idea is to use OriansJ's amazing self-hosting [[https://github.com/oriansj/stage0][stage0]] hex assembler and minimal bootstrap binaries and rewrite the mes.c core to directly @@ -89,6 +70,11 @@ bootstrap binary. *** Compile the [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]] +** Build tools do not run on mes +*** configure needs Bash, Guile +*** GNUmakefile needs Bash, Guile +*** build-aux/mes-snarf.scm needs Guile +*** build-aux/git-changelog needs Perl * OLD: Booting from LISP-1.5 into Mes Mes started out experimenting with booting from a hex-coded minimal @@ -173,3 +159,5 @@ http://common-lisp.net/project/movitz/movitz.html ** C4/C500 https://web.archive.org/web/20160604041431/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c https://github.com/rswier/c4/blob/master/c4.c +** Compilers for free +http://codon.com/compilers-for-free diff --git a/INSTALL b/INSTALL index b4252d80..256d8d5f 100644 --- a/INSTALL +++ b/INSTALL @@ -6,27 +6,32 @@ Building and Installing Mes git clone https://gitlab.com/janneke/mes * Prerequisites +** Guix -** A C compiler, GNU Gcc 4.9.3 is known to work. + guix environment -l guix.scm #64 bit + 32bit + guix environment --system=i686-linux -l guix.scm #32 bit only + +** Other GNU/Linux +*** A C compiler, GNU Gcc 4.9.3 is known to work. The idea is to drop this requirement, of course. -** Guile, version 2.0.12 or is know to work. +*** Guile, version 2.0.12 or is know to work. Guile is not strictly necessary but it is used by the configure script and in development. -** GNU Make, version 4.0 is know to work. +*** GNU Make, version 4.0 is know to work. Not strictly necessary. -** /bin/sh, GNU Bash 4.3 is known to work. +*** /bin/sh, GNU Bash 4.3 is known to work. Let's just say for now that it gets awkward without a shell. *** Development (but see [[./guix.scm]]) -** GNU coreutils -** sed, GNU sed 4.2 is known to work. -** git, 2.10 is known to work. -** Perl, 5.22 is known to work. +*** GNU coreutils +*** sed, GNU sed 4.2 is known to work. +*** git, 2.10 is known to work. +*** Perl, 5.22 is known to work. * Build it diff --git a/NEWS b/NEWS index bb9aaca6..2c7cdb64 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ #+TITLE: Mes NEWS – history of user-visible changes #+STARTUP: content hidestars -Copyright © 2016 Jan Nieuwenhuizen +Copyright © 2016,2017 Jan Nieuwenhuizen Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -10,6 +10,32 @@ Copyright © 2016 Jan Nieuwenhuizen Please send Mes bug reports to janneke@gnu.org. +* Changes in 0.5 since 0.4 +** Core +*** Support compilation with Mescc. +*** Support compilation with -nostdinc, -nostdlib using mlibc. +*** Support call-with-current-continuation. +*** Support exception handling, catch/throw. +*** Give sensible error message when a macro is missing. +** Language +*** Map now supports 4 lists. +*** The reader supports negative hex numbers. +*** 24 new functions +access?, assoc-set! c????r, compose, list->char-set, +open-input-string, read-string, string-delete, with-throw-handler. +** Mescc +*** Mescc can be used separately as a Nyacc-based C compiler backend for Guile. +*** Switch to Nyacc frontend, update Nyacc to 0.76.5. +*** Mescc now has a test suite, scaffold/t.c. +*** Mescc now includes a minimal C library libc/mlib.c libc/mstart.c. +*** Mescc can now compile mes.c. +** Noteworthy bug fixes +*** The build system (configure, make) has been refactored. +*** Support map-4. +*** Evaluate arguments of OR only once. +*** Fix assq-set! +*** Fix ,expand in the REPL. + * Changes in 0.4 since 0.3 ** Core *** Improved performance. diff --git a/README b/README index 1bb0c6b9..ae2653da 100644 --- a/README +++ b/README @@ -1,25 +1,26 @@ -*- org -*- Mes -- Maxwell Equations of Software -Mes aims to create an entirely source-based bootstrapping path. The -target is to [have GuixSD] boostrap from a minimal, easily inspectable -binary --that should be readable as source-- into something close to -R6RS Scheme. +Mes aims to create full source bootstrapping for GuixSD: an entirely +source-based bootstrap path. The target is to [have GuixSD] boostrap +from a minimal, easily inspectable binary --that should be readable as +source-- into something close to R6RS Scheme. -As bootstrapping is presumably easiest and probably most fun with -Scheme, the next step for Mes is mescc: a C compiler/linker to -boostrap into GNU Gcc and GNU Guile, possibly via Tiny-CC. +It currently consists of a mutual self-hosting [close to Guile-] +Scheme interpreter prototype in C and a Nyacc-based C compiler in +[Guile] Scheme. -It currently has an interpreter written in C (mes) with Garbage -Collector (Jam Scraper), a library of loadable Scheme modules-- -notably [[https://github.com/schemeway/lalr-scm][Dominique Boucher's LALR]], [[https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html][Pre-R6RS portable syntax-case]] with -R7RS ellipsis, [[http://www.nongnu.org/nyacc/][Nyacc]] and [[https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html][Guile's PEG]] --and test suite just barely -enough to support a simple REPL (repl.mes) and a proof-of-concept -C-compiler (mescc.mes) that produces an elf from the simplest of C -files. +The Scheme interpreter prototype (mes.c) has a Garbage Collector, a +library of loadable Scheme modules-- notably [[https://github.com/schemeway/lalr-scm][Dominique Boucher's LALR]], +[[https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html][Pre-R6RS portable syntax-case]] with R7RS ellipsis, [[http://www.nongnu.org/nyacc/][Matt Wette's Nyacc]] +and [[https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html][Guile's PEG]] --and test suite just barely enough to support a +simple REPL (repl.mes) and simple C-compiler (mescc.mes) that can +produce the second initial ELF binary from binary from mes.c, in only +about 2h30'. Mes is inspired by The Maxwell Equations of Software: [[http://www.softwarepreservation.org/projects/LISP/book/LISP%25201.5%2520Programmers%2520Manual.pdf][LISP-1.5]] -- John -McCarthy page 13. +McCarthy page 13, [[https://www.gnu.org/software/guix/][GNU Guix's]] source/binary packaging transparency and +[[https://github.com/oriansj/stage0][Jeremiah Orians's stage0]] bootstrap project. Mes is free software, it is distributed under the terms of the GNU General Public Licence version 3 or later. See the file COPYING. @@ -42,16 +43,3 @@ General Public Licence version 3 or later. See the file COPYING. scripts/mescc.mes doc/examples/main.c > a.out -* Other - - make check - make mes-check - make paren - make mescc - scripts/nyacc-calc.mes - scripts/nyacc.mes - - make guile-check - make guile-mescc - guile/nyacc-calc.scm - scripts/nyacc.scm diff --git a/doc/ANNOUNCE-0.5 b/doc/ANNOUNCE-0.5 new file mode 100644 index 00000000..4ed9d30b --- /dev/null +++ b/doc/ANNOUNCE-0.5 @@ -0,0 +1,79 @@ +Subject: Mes 0.5 released + +I am pleased to announce the release of Mes 0.5, representing 250 +commits over 4 months. Mes is now self-hosting, or rather it features +a mutual self-hosting Scheme interpreter and C compiler: mes.c and +mescc; a Nyacc-based C compiler backend that also works separately +with Guile. + +* About + + Mes aims to create full source bootstrapping for GuixSD: an + entirely source-based bootstrap path. The target is to [have + GuixSD] boostrap from a minimal, easily inspectable binary --that + should be readable as source-- into something close to R6RS + Scheme. + + It currently consists of a mutual self-hosting [close to Guile-] + Scheme interpreter prototype in C and a Nyacc-based C compiler in + [Guile] Scheme. + + The Scheme interpreter prototype (mes.c) has a Garbage Collector, + a library of loadable Scheme modules-- notably Dominique Boucher's + LALR[1], Pre-R6RS portable syntax-case[2] with R7RS ellipsis, Matt + Wette's Nyacc[3] Guile's PEG[4] --and test suite just barely + enough to support a simple REPL (repl.mes) and simple C-compiler + (mescc.mes) that can produce the second initial ELF binary from + binary from mes.c, in only about 2h30'. + + Mes was inspired by The Maxwell Equations of Software: LISP-1.5[5] + -- John McCarthy page 13, GNU Guix's[6] source/binary packaging + transparency and Jeremiah Orians's stage0[7] bootstrap project. + +* Download + + git clone https://gitlab.com/janneke/mes + + wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.5 -O mes-0.5.tar.gz + +Mes runs from the source tree and can also be built, packaged and +installed in Guix[SD] by the usual + + guix package -f guix.scm + +* Changes in 0.5 since 0.4 + ** Core + *** Support compilation with Mescc. + *** Support compilation with -nostdinc, -nostdlib using mlibc. + *** Support call-with-current-continuation. + *** Support exception handling, catch/throw. + *** Give sensible error message when a macro is missing. + ** Language + *** Map now supports 4 lists. + *** The reader supports negative hex numbers. + *** 24 new functions + access?, assoc-set! c????r, compose, list->char-set, + open-input-string, read-string, string-delete, with-throw-handler. + ** Mescc + *** Mescc can be used separately as a Nyacc-based C compiler backend for Guile. + *** Switch to Nyacc frontend, update Nyacc to 0.76.5. + *** Mescc now has a test suite, scaffold/t.c. + *** Mescc now includes a minimal C library: libc/mlib.c libc/mstart.c. + *** Mescc can now compile mes.c. + ** Noteworthy bug fixes + *** The build system (configure, make) has been refactored. + *** Support map-4. + *** Evaluate arguments of OR only once. + *** Fix assq-set! + *** Fix ,expand in the REPL. + +Greetings, +janneke + +[1] https://github.com/schemeway/lalr-scm +[2] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html +[3] https://www.nongnu.org/nyacc/ +[4] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html +[5] http://www.softwarepreservation.org/projects/LISP/book/LISP%25201.5%2520Programmers%2520Manual.pdf +[6] https://www.gnu.org/software/guix/ +[7] https://github.com/oriansj/stage0 diff --git a/module/language/c99/compiler.scm b/module/language/c99/compiler.scm index 250e51b6..a99cfbc4 100644 --- a/module/language/c99/compiler.scm +++ b/module/language/c99/compiler.scm @@ -1,7 +1,7 @@ ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016 Jan Nieuwenhuizen +;;; Copyright © 2016,2017 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; diff --git a/module/mes/display.mes b/module/mes/display.mes index 6ccc645e..51c70c77 100644 --- a/module/mes/display.mes +++ b/module/mes/display.mes @@ -1,7 +1,7 @@ ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016 Jan Nieuwenhuizen +;;; Copyright © 2016,2017 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;; diff --git a/src/gc.c b/src/gc.c index 2e8fef77..aa4eea44 100644 --- a/src/gc.c +++ b/src/gc.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * Mes --- Maxwell Equations of Software - * Copyright © 2016 Jan Nieuwenhuizen + * Copyright © 2016,2017 Jan Nieuwenhuizen * * This file is part of Mes. * diff --git a/src/posix.c b/src/posix.c index 3c1cce95..5f6901da 100644 --- a/src/posix.c +++ b/src/posix.c @@ -1,6 +1,6 @@ /* -*-comment-start: "//";comment-end:""-*- * Mes --- Maxwell Equations of Software - * Copyright © 2016 Jan Nieuwenhuizen + * Copyright © 2016,2017 Jan Nieuwenhuizen * * This file is part of Mes. * diff --git a/tests/vector.test b/tests/vector.test index 1d34dbbc..78bf00b9 100755 --- a/tests/vector.test +++ b/tests/vector.test @@ -9,7 +9,7 @@ exit $? ;;; -*-scheme-*- ;;; Mes --- Maxwell Equations of Software -;;; Copyright © 2016 Jan Nieuwenhuizen +;;; Copyright © 2016,2017 Jan Nieuwenhuizen ;;; ;;; This file is part of Mes. ;;;