diff --git a/BOOTSTRAP b/BOOTSTRAP index 427c5d31..39135975 100644 --- a/BOOTSTRAP +++ b/BOOTSTRAP @@ -92,14 +92,16 @@ be source. https://gitlab.com/janneke/tinycc * TODO -** fix MesCC so that tcc can correctly compile gcc -** remove or upstream patches from tcc -** fix bootstrap-loops: (Nyacc?, mes.M12, psyntax.pp?) +** have bootstrapped tcc compile gcc-4.7 +** remove or upstream patches from tcc-boot +** prepare src/mes.c for M2-Planet transpiler. +** fix bootstrap-loops: (Nyacc?, mes.M2, psyntax.pp?) ** make GNU gcc (8.0?) bootstrappable again, remove [need for] tcc stage ** integrate with GuixSD ** x86_64, arm, the Hurd * DONE +** have tcc-boot's mes-tcc compile a fully functional tcc ** hex.0, hex.1, M0 ** M1, hex2_linker prototyped in C ** M2-Planet is now self-hosting, written in M2 diff --git a/HACKING b/HACKING index c3dbe7d2..6c399326 100644 --- a/HACKING +++ b/HACKING @@ -59,10 +59,10 @@ mes.c. * ROADMAP ** TODO *** release 0.x, unsorted - - mes+mescc: compile a mes-tcc that can build itself. - - mes-tcc: full source bootstrapped build of gcc-4.7. - - mes: real module support, bonus for supporting Guile's define-module/define-public syntax. + - mes-tcc: have bootstrapped tcc compile gcc-4.7. + - tcc: remove or upstream patches from tcc-boot - mes: prepare src/mes.c for M2-Planet transpiler. + - mes: real module support, bonus for supporting Guile's define-module/define-public syntax. - mes: produce functional mes from mes.M1 transpiled by M2-Planet. - mes: we're a full Scheme now, drop .MES prefix, use .SCM. + find a way to fix foo.mes/foo.scm trickery (full Guile-like module support?) @@ -71,23 +71,12 @@ mes.c. internally, we could make sure to start every cond-expand with (mes) - mes: use more efficient scheme continuation stack (wip-array?) - mes: drop SCM stack in C / implement call/cc a la guile-1.8 setjmp? - - mescc: refactor type(/ptr?) system; expr->type and ast-type->type. - - mescc: refactor initializers. - - mescc: record and support function types, and thus foo ()->bar, *foo (). - - mescc: refactor switch statement to support unpatched tinycc. - mes/mescc: bootstrap a minimal-Guile + libguile/{eval,init,list,strings,values,..}.c + ice-9/eval.scm - mescc: have mes-tcc pass all scaffold/tests, scaffold/tinycc tests. - - mescc: compile a mes-tcc that can compile gcc-4.7. - - mescc: refactor switch; support heterogeneous switch case. - - mescc: support sizeof any expr. - - mescc: support function-static. - - mescc: support/grok global static. - - mescc: support unsigned comparison, arithmetic. - mescc: support long long. - - mescc: support bitfields. - - mescc: support floats. + - mescc: full support for floats? - mescc: some success with 8cc,pcc,guile/libguile/eval.c. - build: guile/guix/make.scm: add file-types, intermediate, hash all dependencies - build: make.scm: imperative->declaritive @@ -100,6 +89,7 @@ mes.c. - add x86_64, replace GuixSD's bootstrap binaries for x86_64. - more architectures? ** DONE +*** 0.14: Mes+MesCC now compiles a slightly patched self-hosting tcc. *** 0.13: Mes+MesCC now compiles a modified, functional tcc.c (~25,000LOC) in 1h30'. *** 0.12: Mes+MesCC now compiles mes.c (~3000LOC) in ~4min. *** 0.11: MesCC now compiles a mes-tcc that passes 26/69 of mescc's C tests. diff --git a/NEWS b/NEWS index 201d93b7..78dd8a09 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,40 @@ Copyright © 2016,2017,2018 Jan (janneke) Nieuwenhuizen Please send Mes bug reports to janneke@gnu.org. +* Changes in 0.14 since 0.13 +** Core +*** Bootstrapped Mes+MesCC now compiles a tcc that is self-hosting and only slightly patched. +*** The reader now supports binary numbers (previously: read as decimal). +*** String port support has been moved to C. +*** The build has been simplified, the Make-in-Scheme experiment has been removed. +*** 2 new functions +chmod, logxor. +** Language +*** Mes now supports define-immutable-record-type and single set-field from srfi-9 gnu. +*** 12 new functions +basename, chmod, const, delete-duplicates, logxor, string-contains, +string-map, string-replace, string-trim, string-trim-both, +string-trim-right, unfold. +** MesCC +*** MesCC now supports standalone usage of nestedly defined enums, structs and unions. +*** MesCC now supports comparison of unsigned and promotion of signed/unsigned -> unsigned. +*** MesCC now supports sign extension for char, short. +*** MesCC now has stubbing for floats; compiling works, data is fu. +*** MesCC now has full suport for switch case, e.g. with default as first clause. +*** MesCC now supports destruction of casted expressions: ((struct foo*)p)->bar. +*** MesCC now has full support for pre/post, e.g.: (foo--)->bar and permutations. +*** MesCC now supports sizeof any expression or type. +*** MesCC now supports initialization of anonymous unions. +*** MesCC now supports bit fields. +*** MesCC now supports valued functions in expressions: destruction and dereferencing. +*** MesCC now supports function-static variables. +*** MesCC now supports initializer lists in structs and unions. +*** MesCC now has full support for heterogeneous variable declarations, e.g.: char p, *x = "foo", buf[3]; +**** 4 new functions +__lshrdi3, __ashldi3, __ashrdi3, strncpy. +**** 9 new mlibc stubs +__fixdfdi, __fixsfdi, __fixunsxfdi, __fixxfdi, __floatundixf, ldexp, +strtod, strtof, strtold. * Changes in 0.13 since 0.12 ** Core *** Bootstrapped Mes+MesCC can now compile a patched tcc in ~1h45' (~25,000 LOC). @@ -64,8 +98,8 @@ endian.h, sys/signal.h. * Changes in 0.11 since 0.10 ** MesCC *** MesCC now compiles a mes-tcc that fails 41/69 of mescc's C tests. -*** Messc's libc can now be compiled with tcc (syscall support: write). -*** Messc now compiles a less-patched tcc: -214/+458 lines [WAS: -333/+747]. +*** MesCC's libc can now be compiled with tcc (syscall support: write). +*** MesCC now compiles a less-patched tcc: -214/+458 lines [WAS: -333/+747]. *** MesCC now supports empty for. *** MesCC has been greatly refactored, 500/3000 lines have been removed. *** MesCC now supports complex [struct] by value assign foo.bar, foo->bar, foo[bar]. diff --git a/README b/README index 599a029c..c688d2dc 100644 --- a/README +++ b/README @@ -14,7 +14,7 @@ Pre-R6RS [[https://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html][p 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 and simple C-compiler: MesCC. -Mes+MesCC can compile a [[https://gitlab.com/janneke/tinycc][modified TinyCC]] that is close to being +Mes+MesCC can compile a only [[https://gitlab.com/janneke/tinycc][lightly modified TinyCC]] that is self-hosting. A GNU Ccc-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 diff --git a/build-aux/check-mescc.sh b/build-aux/check-mescc.sh index cb9e5add..dbf65fb2 100755 --- a/build-aux/check-mescc.sh +++ b/build-aux/check-mescc.sh @@ -123,6 +123,7 @@ t 83-heterogenoous-init 84-struct-field-list 85-sizeof +86-strncpy " broken="$broken @@ -229,6 +230,7 @@ broken="$broken 28_strings 31_args +34_array_assignment 37_sprintf 39_typedef diff --git a/doc/ANNOUNCE-0.14 b/doc/ANNOUNCE-0.14 new file mode 100644 index 00000000..5ecc09b3 --- /dev/null +++ b/doc/ANNOUNCE-0.14 @@ -0,0 +1,99 @@ +Subject: Mes 0.14 released + +I am pleased to announce the release of Mes 0.14, representing 93 +commits over 3 weeks. Mes+MesCC now compiles a self-hosting tcc that +has only been slightly patched. + +This means that we can now build a tcc that depends only on a 1MB +ASCII M1 seed. GuixSD currently uses a ~250MB binary seed to build +gcc. + +Next targets are: build gcc using this almost full-source bootstrapped +tcc, and reduce the 1MB ASCII M1 seed to a ~100KB almost source seed +of M2 (a simple C-like language). + +* About + + Mes[0] aims to help create full source bootstrapping for GuixSD[1] + as part of the bootstrappable builds[2] project. + + It currently consists of a mutual self-hosting Scheme interpreter + prototype in C and a Nyacc-based C compiler in Scheme. This C + prototype is being simplified to be transpiled by M2-Planet[3]. + + 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+MesCC can compile a only slightly patched TinyCC[8] that is + self-hosting. A GNU Ccc-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[11] ~300 byte self-hosting + hex assembler. + +* Download + + git clone https://gitlab.com/janneke/mes + + wget https://gitlab.com/janneke/mes/-/archive/v0.14/mes-0.14.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.14 since 0.13 + ** Core + *** Bootstrapped Mes+MesCC now compiles a tcc that is self-hosting and only slightly patched. + *** The reader now supports binary numbers (previously: read as decimal). + *** String port support has been moved to C. + *** The build has been simplified, the Make-in-Scheme experiment has been removed. + *** 2 new functions + chmod, logxor. + ** Language + *** Mes now supports define-immutable-record-type and single set-field from srfi-9 gnu. + *** 12 new functions + basename, chmod, const, delete-duplicates, logxor, string-contains, + string-map, string-replace, string-trim, string-trim-both, + string-trim-right, unfold. + ** MesCC + *** MesCC now supports standalone usage of nestedly defined enums, structs and unions. + *** MesCC now supports comparison of unsigned and promotion of signed/unsigned -> unsigned. + *** MesCC now supports sign extension for char, short. + *** MesCC now has stubbing for floats; compiling works, data is fu. + *** MesCC now has full suport for switch case, e.g. with default as first clause. + *** MesCC now supports destruction of casted expressions: ((struct foo*)p)->bar. + *** MesCC now has full support for pre/post, e.g.: (foo--)->bar and permutations. + *** MesCC now supports sizeof any expression or type. + *** MesCC now supports initialization of anonymous unions. + *** MesCC now supports bit fields. + *** MesCC now supports valued functions in expressions: destruction and dereferencing. + *** MesCC now supports function-static variables. + *** MesCC now supports initializer lists in structs and unions. + *** MesCC now has full support for heterogeneous variable declarations, e.g.: char p, *x = "foo", buf[3]; + **** 4 new functions + __lshrdi3, __ashldi3, __ashrdi3, strncpy. + **** 9 new mlibc stubs +__fixdfdi, __fixsfdi, __fixunsxfdi, __fixxfdi, __floatundixf, ldexp, + __fixunsxfdi, __floatundixf, ldexp, strtod, strtof, strtold. + +Greetings, +janneke + +[0] https://gitlab.com/janneke/mes +[1] https://www.gnu.org/software/guix +[2] http://bootstrappable.org +[3] https://github.com/oriansj/m2-planet +[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 +[11] https://github.com/oriansj/stage0