From e1e8f037359a3784f1eb29d1a6c0bf641dd75be0 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Sun, 9 Jul 2017 18:40:12 +0200 Subject: [PATCH] doc: Release udpate. * HACKING: Update. * INSTALL: Update. * NEWS: Update. * README: Update. * doc/ANNOUNCE-0.9: New file. * make.scm: Install it. * guix.scm (mescc-tools): Bump to 0.2. --- HACKING | 49 ++++++++++++------------- INSTALL | 13 +++---- NEWS | 35 ++++++++++++++++++ README | 40 +++++++++++++------- configure | 4 +- doc/ANNOUNCE-0.9 | 93 +++++++++++++++++++++++++++++++++++++++++++++++ guix.scm | 16 ++++---- make.scm | 3 +- module/mes/M1.mes | 2 +- 9 files changed, 197 insertions(+), 58 deletions(-) create mode 100644 doc/ANNOUNCE-0.9 diff --git a/HACKING b/HACKING index 9708f3fa..06874478 100644 --- a/HACKING +++ b/HACKING @@ -10,12 +10,15 @@ development. ** DEVELOPMENT BUILD To help development we assume ./configure sets these variables for make - CC -- gcc - CC32 -- i686-unknown-linux-gnu-gcc (or on x86, also gcc) - GUILE -- guile - MES -- unset + CC -- gcc + CC32 -- i686-unknown-linux-gnu-gcc (or on x86, also gcc) + GUILE -- guile + HEX2 -- hex2 + MES -- unset + M1 -- M1 + PREFIX -- "" -Mes is supposed to serve as a full equivalent for GUILE, however mes is much, much +Mes is supposed to serve as a full equivalent for Guile, however mes is much, much slower than guile. That's why we usually don't use mes during development. gcc is used to verify the sanity of our C sources. @@ -23,50 +26,46 @@ gcc is used to verify the sanity of our C sources. i686-unknown-linux-gnu-gcc is used to compare hex/assembly, to test the gcc variant of mlbic: mlibc/libc-gcc.c and steal ideas. -guile is used to develop mescc, the C compiler in Scheme that during +Guile is used to develop mescc, the C compiler in Scheme that during bootstrapping will be executed by mes. ** BOOTSTRAP BUILD In bootstrap mode, we don't have gcc (CC), we don't have pa 32 bit gcc -(CC32), we have no guile (GUILE)...but we should have a bootstrap mes -(MES). FIXME. +(CC32), we have no guile (GUILE)...but we should have hex2, M1, and +FIXME: mes.M1. mes is built from src/*.c and some out/src/*.h files that are snarfed from src/*.c by build-aux/mes-snarf.scm. -Also, during bootstrap we don't have make. Running `make build-scripts' -generates several recipies of sh build scripts in out/. +Running ./make.scm produces a `script' file. * ROADMAP ** TODO -*** release 0.8 - - produce ELF_sym and ELF_str tables from hex2; nicer for objdump -d, gdb +*** release 0.10 + - mescc: compile minimal main.c with tcc.mes https://gitlab.com/janneke/tinycc wip-mescc *** release 0.x, unsorted - - simplify [at least the bootstrap] build process. - - seamless connection to stage0. - - mescc: compile tcc.c. - mescc: support unsigned comparison, arithmetic. - mescc: support bitfields. - - mescc: support unions. - - mescc: support anonymous unions. - - mescc: refactor compiler.mes, esp. (decl ..) bits. + - mescc: support floats. + - mescc: some success with 8cc/pcc/libguile/eval.c. + - build: guile/guix/make.scm: add file-types, intermediate, hash all dependencies + - build: make.scm: imperative->declaritive + - hex2: produce ELF_sym and ELF_str tables from hex2; nicer for objdump -d, gdb (in mescc-tools?) - rewrite src/mes.c in stage0's stage2 LISP. - - and/or: rewrite src/mes.c in [annotated] assembly. - - and/or: rewrite src/mes.c in annotated hex2. + - and/or: rewrite src/mes.c M1 - and/or: connect to GNU Epsilon's 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 + - get full source syntax-case up (Andre van Tonder?) OR drop it psyntax/syntax-case and rewrite Nyacc without syntax-case+R7RS Ellipsis - support regexp OR rewrite Nyacc without regexps - - split-off Guile C compiler as standalone Guile project, still - respecting no-syntax-case bootstrap requirement -*** Compile the [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]] - - build tcc (tinycc) + - split-off Guile C compiler as standalone Guile project *** release 1.0 - work to replace GuixSD's bootstrap binaries for x86 - more architectures? ** DONE +** 0.9: Mescc now writes M1 macro assembly files and compiles tcc. +** 0.8: Mescc now writes object files in stage0's labeled hex2 format. ** 0.7: Mescc supports -E, -c, -o options, include more complete set of header files, enough to work on compiling tinycc's tcc.c albeit a somewhat modified version. ** 0.6: Work with unmodified, unbundled Nyacc; compile 33/55 tinycc's tests/test2 suite. diff --git a/INSTALL b/INSTALL index 5a00dbf4..c8ebddaf 100644 --- a/INSTALL +++ b/INSTALL @@ -7,10 +7,10 @@ Building and Installing Mes * Prerequisites ** Bootstrapping -For bootstrapping, the only dependency is the hex2 linker -*** [[https://github.com/oriansj/MESCC_Tools][MESCC_Tools]], 0.1 is known to work. +For bootstrapping, the M1 macro assembler and hex2 linker and Nyacc +*** [[https://github.com/oriansj/MESCC_Tools][MESCC_Tools]], 0.2 is known to work. +*** [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 0.80.3 is known to work. For development -** ** Development For development, there are some more dependencies. *** Guix @@ -19,11 +19,8 @@ For development, there are some more dependencies. guix environment --system=i686-linux -l guix.scm #32 bit only *** Other GNU/Linux -**** [[https://github.com/oriansj/MESCC_Tools][MESCC_Tools]], 0.0 is known to work. - -**** [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 0.78.0 is known to work. -Matt Wette's C99 LALR parser. - +**** [[https://github.com/oriansj/MESCC_Tools][MESCC_Tools]], 0.2 is known to work. +**** [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 0.80.3 is known to work. **** GNU Gcc, 4.9.3 is known to work. The idea is to drop this requirement, of course. diff --git a/NEWS b/NEWS index ad7c3557..24719c18 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,41 @@ Copyright © 2016,2017 Jan Nieuwenhuizen Please send Mes bug reports to janneke@gnu.org. +* Changes in 0.9 since 0.8 +** Core +*** Mes now builds better in non-Guix[SD] legacy distros/environments. Thanks, rain1! +** Mescc +*** Mescc now compiles a modified tinycc into a running [mostly segfaulting] tcc.mes. +https://gitlab.com/janneke/tinycc branch wip-mescc. +*** Mescc now supports locals stack frame larger than 1 byte offset. +*** Mescc now supports incomplete struct initializers {0}. +*** Mescc now supports >>=, <<=, ^=, ~. +*** Mescc now supports the comma operator. +*** Mescc now supports mullti-line string initializers. +*** Mescc now supports unions. +*** Mescc now supports arrays in structs. +*** Mescc now supports structs in structs. +*** Mescc now builds and runs with Guile-2.0 (legacy distro support, Guile-2.2 recommended). +*** Mescc has been refactored to use records. +*** Mescc now bundles tinycc's test2 test suite, passes one more test [34/55 pass]. +*** Mescc now has an incremental test suite consisting of 56 tests. +*** Mescc now supports stdarg variable argument lists. +*** Mescc now has __GNUC__ unset, #f (WAS: 0). +*** Mescc now depends on Nyacc 0.80.3. +*** Mescc now depends on M1 from [[https://github.com/oriansj/MESCC_Tools][MESCC_Tools]] v0.2. +*** Mescc now compiles to M1 object files. +**** 7 new mlibc functions +calloc, close, getcwd, lseek, sprintf, unlink, vprintf. +**** 31 new mlibc stubs +execvp, fclose, fdopen, fflush, fopen, fprintf, fread, free, fseek, +ftell, fwrite, localtime, longjmp, memcpy, memmove, memmove, memset, +qsort, remove, setjump, snprintf, sscanf, strchr, strrchr, strstr, +strtol, strtoll, strtoul, strtoull, time, vnsprintf. +**** 10 new header files +alloca.h, float.h, libgen.h, locale.h, stdbool.h, stddef.h, stdint.h, +stdnoreturn.h, sys/select.h, sys/wait.h. +** Noteworthy bug fixes +*** Many bugs and limitations in mescc have been fixed and removed. * Changes in 0.8 since 0.7 ** Mescc *** Mescc now has experimental annotation support for hex2. diff --git a/README b/README index ae2653da..704f46b8 100644 --- a/README +++ b/README @@ -1,26 +1,38 @@ -*- org -*- Mes -- Maxwell Equations of Software -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. +[[https://gitlab.com/janneke/mes][Mes]] aims to create full source bootstrapping for [[https://www.gnu.org/software/guix][GuixSD]] as part of the +[[http://bootstrappable.org][bootstrappable builds]] effort. 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. +[Guile] Scheme. This C prototype will be rewritten in [[https://github.com/oriansj/stage0][stage0]] M1 +assembly (or possibly stage2 slow-LISP, or ...). 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'. +library of loadable Scheme modules-- notably Dominique Boucher's [[https://github.com/schemeway/lalr-scm][LALR]], +Pre-R6RS [[https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html][portable syntax-case]] with R7RS ellipsis, Matt Wette's [[https://www.nongnu.org/nyacc][Nyacc]], +Guile's [[https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html][PEG]] --and test suite just barely enough to support a simple +REPL (repl.mes) and simple C-compiler (mescc.mes). -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, [[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. +The simple C compiler can now compile a [[https://gitlab.com/janneke/tinycc][modified TinyCC]]. This needs +more work. A with gcc compiled tcc is [[https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html][known]] to compile GCC. + +Mes is inspired by The Maxwell Equations of Software: [[http://www.softwarepreservation.org/projects/LISP/book/LISP%2525201.5%252520Programmers%252520Manual.pdf][LISP-1.5]] -- John +McCarthy page 13, GNU Guix's source/binary packaging transparency and +Jeremiah Orians's stage0 ~300 byte self-hosting hex assembler. + +[0] https://gitlab.com/janneke/mes +[1] https://www.gnu.org/software/guix +[2] http://bootstrappable.org +[3] https://github.com/oriansj/stage0 +[4] https://github.com/schemeway/lalr-scm +[5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html +[6] https://www.nongnu.org/nyacc +[7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html +[8] https://gitlab.com/janneke/tinycc +[9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html +[10] http://www.softwarepreservation.org/projects/LISP/book/LISP%25201.5%2520Programmers%2520Manual.pdf Mes is free software, it is distributed under the terms of the GNU General Public Licence version 3 or later. See the file COPYING. diff --git a/configure b/configure index ed42b9d8..17132567 100755 --- a/configure +++ b/configure @@ -174,7 +174,7 @@ exec ${GUILE} --no-auto-compile -L $(pwd) -C $(pwd) -e 'main' -s "$0" ${1+"$@"} (if (member ARCH '("i686" "arm")) (string-append BUILD_TRIPLET "-" CC) "i686-unknown-linux-gnu-gcc"))) (define HEX2 (or (getenv "HEX2") "hex2")) -(define M1 (or (getenv "M1") "M0")) +(define M1 (or (getenv "M1") "M1")) (define (parse-opts args) (let* ((option-spec @@ -220,7 +220,7 @@ Usage: ./configure [OPTION]... (set! *verbose?* verbose?) (check-version 'guile '(2 0)) (check-version HEX2 '(0 1)) - ;;(check-version M1 '(0 1)) ;; FIXME: 0xXX: bump to 0.2 + (check-version M1 '(0 2)) (check-version 'nyacc '(0 80 3) #:command (string-append GUILE " -c '(use-modules (nyacc lalr)) (display *nyacc-version*)'")) (check-version 'bash '(4 0)) diff --git a/doc/ANNOUNCE-0.9 b/doc/ANNOUNCE-0.9 new file mode 100644 index 00000000..662967ea --- /dev/null +++ b/doc/ANNOUNCE-0.9 @@ -0,0 +1,93 @@ +Subject: Mes 0.9 released + +I am pleased to announce the release of Mes 0.9, representing 107 +commits over 5 weeks. Mescc now compiles to a surprisingly readable +stage0 M1 macro assembler output format. Mescc now compiles a +modified TinyCC into a running [mostly segfaulting] executable. This +is a major milestone as tcc can compile GCC. + + +* About + + Mes[0] aims to create full source bootstrapping for GuixSD[1] as + part of the bootstrappable builds[2] project. + + 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. This C prototype will be rewritten in stage0[3] + M1 assembly (or possibly stage2 slow-LISP, or ...). + + The Scheme interpreter prototype (mes.c) has a Garbage Collector, + a library of loadable Scheme modules-- notably Dominique Boucher's + LALR[4], Pre-R6RS portable syntax-case[5] with R7RS ellipsis, Matt + Wette's Nyacc[6], Guile's PEG[7] --and test suite just barely + enough to support a simple REPL (repl.mes) and simple C-compiler + (mescc.mes). + + The simple C compiler can compile a modified TinyCC[8]. This + needs more work. A gcc-compiled tcc is known[9] to compile GCC. + + Mes is inspired by The Maxwell Equations of Software: LISP-1.5[10] + -- John McCarthy page 13, GNU Guix's source/binary packaging + transparency and Jeremiah Orians's stage0 ~300 byte self-hosting + hex assembler. + +* Download + + git clone https://gitlab.com/janneke/mes + + wget https://gitlab.com/janneke/mes/repository/archive.tar.gz?ref=v0.9 -O mes-0.9.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.9 since 0.8 + ** Core + *** Mes now builds better in non-Guix[SD] legacy distros/environments. Thanks, rain1! + ** Mescc + *** Mescc now compiles a modified tinycc into a running [mostly segfaulting] tcc.mes. + https://gitlab.com/janneke/tinycc branch wip-mescc. + *** Mescc now supports locals stack frame larger than 1 byte offset. + *** Mescc now supports incomplete struct initializers {0}. + *** Mescc now supports >>=, <<=, ^=, ~. + *** Mescc now supports the comma operator. + *** Mescc now supports mullti-line string initializers. + *** Mescc now supports unions. + *** Mescc now supports arrays in structs. + *** Mescc now supports structs in structs. + *** Mescc has been refactored to use records. + *** Mescc now builds and runs with Guile-2.0 (legacy distro support, not recommended). + *** Mescc now bundles tinycc's test2 test suite, passes one more test [34/55 pass]. + *** Mescc now has an incremental test suite consisting of 56 tests. + *** Mescc now supports stdarg variable argument lists. + *** Mescc now has __GNUC__ unset, #f (WAS: 0). + *** Mescc now depends on Nyacc 0.80.3. + *** Mescc now depends on M1 from MESCC_Tools v0.2. + *** Mescc now compiles to M1 object files. + **** 7 new mlibc functions + calloc, close, getcwd, lseek, sprintf, unlink, vprintf. + **** 31 new mlibc stubs + execvp, fclose, fdopen, fflush, fopen, fprintf, fread, free, fseek, + ftell, fwrite, localtime, longjmp, memcpy, memmove, memmove, memset, + qsort, remove, setjump, snprintf, sscanf, strchr, strrchr, strstr, + strtol, strtoll, strtoul, strtoull, time, vnsprintf. + **** 10 new header files + alloca.h, float.h, libgen.h, locale.h, stdbool.h, stddef.h, stdint.h, + stdnoreturn.h, sys/select.h, sys/wait.h. + +Greetings, +janneke + +[0] https://gitlab.com/janneke/mes +[1] https://www.gnu.org/software/guix +[2] http://bootstrappable.org +[3] https://github.com/oriansj/stage0 +[4] https://github.com/schemeway/lalr-scm +[5] https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html +[6] https://www.nongnu.org/nyacc/ +[7] https://www.gnu.org/software/guile/docs/master/guile.html/PEG-Parsing.html +[8] https://gitlab.com/janneke/tinycc +[9] https://lists.gnu.org/archive/html/tinycc-devel/2017-05/msg00103.html +[10] http://www.softwarepreservation.org/projects/LISP/book/LISP%25201.5%2520Programmers%2520Manual.pdf diff --git a/guix.scm b/guix.scm index cb129c07..857f216c 100644 --- a/guix.scm +++ b/guix.scm @@ -84,7 +84,7 @@ (define-public mescc-tools (package (name "mescc-tools") - (version "0.1") + (version "0.2") (source (origin (method url-fetch) (uri (string-append @@ -94,8 +94,9 @@ (file-name (string-append name "-" version ".tar.gz")) (sha256 (base32 - "1lzi9sqv41269isn7in70q2hhh087n4v97zr5i2qzz69j2lkr3xb")))) + "13hcz7cpp6fsq55di2kbff0bxad95cbfyzcrziynybb16px5hgz4")))) (build-system gnu-build-system) + (supported-systems '("i686-linux" "x86_64-linux")) (arguments `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))) #:test-target "test" @@ -104,7 +105,7 @@ (synopsis "Tools for the full source bootstrapping process") (description "Mescc-tools is a collection of tools for use in a full source -bootstrapping process. Currently consists of the M0 macro assembler and the +bootstrapping process. Currently consists of the M1 macro assembler and the hex2 linker.") (home-page "https://github.com/oriansj/MESCC_Tools") (license gpl3+))) @@ -151,11 +152,12 @@ hex2 linker.") build-aux/gitlog-to-changelog --srcdir= > ChangeLog\n"))) #t)) (delete 'strip)))) - (synopsis "Maxwell Equations of Software") + (synopsis "Scheme interpreter with C compiler for full source bootstrapping") (description - "Mes aims to create full source bootstrapping for GuixSD. It -consists of a mutual self-hosting [close to Guile-] Scheme interpreter -prototype in C and a Nyacc-based C compiler in [Guile] Scheme.") + "Mes [Maxwell Equations of Software] aims to create full source +bootstrapping for GuixSD. It consists of a mutual self-hosting [close to +Guile-] Scheme interpreter prototype in C and a Nyacc-based C compiler in +[Guile] Scheme.") (home-page "https://gitlab.com/janneke/mes") (license gpl3+)))) diff --git a/make.scm b/make.scm index c13e64eb..b2c95943 100755 --- a/make.scm +++ b/make.scm @@ -533,7 +533,8 @@ exec ${GUILE-guile} --no-auto-compile -L . -L guile -C . -C guile -s "$0" ${1+"$ "HACKING" "INSTALL" "NEWS" - "README")) + "README" + "doc/ANNOUNCE-0.9")) (add-target (install "doc/fosdem/fosdem.pdf" #:dir "share/doc/mes")) diff --git a/module/mes/M1.mes b/module/mes/M1.mes index 14e1c48b..470a1838 100644 --- a/module/mes/M1.mes +++ b/module/mes/M1.mes @@ -74,7 +74,7 @@ (define (hex2:offset1 o) (string-append "!" o)) -(define hex? #f) ; We need unreleased messc-tools 0.2 wih 0xXX support for this +(define hex? #t) (define (hex2:immediate o) (if hex? (string-append "%0x" (dec->hex o))