diff --git a/HACKING b/HACKING index 5187cd7c..1c432e18 100644 --- a/HACKING +++ b/HACKING @@ -41,41 +41,56 @@ Running ./make.scm produces a `script' file. * ROADMAP ** TODO -*** release 0.11 +*** release 0.12 - mescc: compile a mes-tcc that can compile gcc-4.7. *** release 0.x, unsorted + - mescc: refactor type(/ptr?) system; expr->type and ast-type->type. + - mescc: refactor initializers. + - mescc: record and support function types, and thus foo ()->bar. + - mescc: refactor switch statement to support unpatched tinycc. + - mes/mescc: bootstrap a minimal-Guile (libguile/eval.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: some success with 8cc/pcc/libguile/eval.c. + - 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 - hex2: produce ELF_sym and ELF_str tables from hex2; nicer for objdump -d, gdb (in mescc-tools?) + - compile src/mes.c with M2-Planet. - rewrite src/mes.c in stage0's stage2 LISP. - 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 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 + - real module support, bonus for supporting Guile's define-module/define-public syntax. + - 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 MesCC as as standalone Guile C compiler project. *** release 1.0 - - work to replace GuixSD's bootstrap binaries for x86 + - replace GuixSD's bootstrap binaries for x86. + - add x86_64, replace GuixSD's bootstrap binaries for x86_64. - more architectures? ** DONE -** 0.10: Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out. -** 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. -** 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 +*** 0.11: MesCC now compiles a mes-tcc that passes 41/69 of mescc's C tests. +*** 0.10: Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out. +*** 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, +eenough 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. +*** 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 * Bugs ** eval_apply/gc + Nyacc bug @@ -88,7 +103,8 @@ 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 +** mescc can only compile itself, it cannot full-functionally compile tcc, gcc or guile +** mescc: 7n-struct-struct-array.c: struct file f = {"first.h"}; ** 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). @@ -213,6 +229,7 @@ support all C11 language features while keeping the code as small and simple as possible. *** pcc *** early GCC? +https://miyuki.github.io/2017/10/04/gcc-archaeology-1.html *** [[http://tack.sourceforge.net/][ack]] it may be possible to compile like this: mes |> ack |> pcc |> tcc |> gcc 4.7.4 |> gcc later version... up to modern diff --git a/INSTALL b/INSTALL index 44fc2fbc..408caec0 100644 --- a/INSTALL +++ b/INSTALL @@ -9,7 +9,7 @@ Building and Installing Mes ** Bootstrapping 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.81.0 is known to work. +*** [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 0.82.4 is known to work. For development ** Development For development, there are some more dependencies. @@ -20,7 +20,7 @@ For development, there are some more dependencies. *** Other GNU/Linux **** [[https://github.com/oriansj/mescc-tools][mescc-tools]], 0.2 is known to work. -**** [[https://savannah.gnu.org/projects/nyacc][Nyacc]], [[https://gitlab.com/janneke/nyacc][0.80.41 {patched 0.80.4}]] is known to work. +**** [[https://savannah.gnu.org/projects/nyacc][Nyacc]], 0.82.4 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 89ce0166..ebb1203c 100644 --- a/NEWS +++ b/NEWS @@ -10,12 +10,21 @@ Copyright © 2016,2017 Jan Nieuwenhuizen Please send Mes bug reports to janneke@gnu.org. +* Changes in 0.11 since 0.10 +** MesCC +*** MesCC now compiles a mes-tcc that passes 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 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]. +*** MesCC now depends on Nyacc 0.82.4. * Changes in 0.10 since 0.9 ** Core *** 2 new functions logand, lognot. -** Mescc *** Mes now includes M1 sources for full source bootstrapping up to tcc. +** Mescc *** Mescc now depends on Nyacc 0.81.0. *** Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out. *** Mescc now supports several (as used my tinycc) struct by value assignments. diff --git a/README b/README index 685ee306..f80612d8 100644 --- a/README +++ b/README @@ -13,10 +13,10 @@ The Scheme interpreter prototype (mes.c) has a Garbage Collector, a 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). +REPL (repl.mes) and simple C-compiler MesCC (mescc.mes). -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. +MesCC can compile a [[https://gitlab.com/janneke/tinycc][modified TinyCC]] that is close to being +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 McCarthy page 13, GNU Guix's source/binary packaging transparency and @@ -51,7 +51,7 @@ General Public Licence version 3 or later. See the file COPYING. scripts/repl.mes -* Mescc compiler +* MesCC compiler scripts/mescc.mes scaffold/main.c > a.out diff --git a/doc/ANNOUNCE-0.11 b/doc/ANNOUNCE-0.11 new file mode 100644 index 00000000..958791e9 --- /dev/null +++ b/doc/ANNOUNCE-0.11 @@ -0,0 +1,70 @@ +Subject: Mes 0.11 released + +I am pleased to announce the release of Mes 0.11, representing 16 +commits over 10 weeks. MesCC now compiles a less heavily patched +TinyCC into a mes-tcc that in turn passes 41/69 of mescc's C tests. + +When mes-tcc passes all 69 tests, this almost-full-source-bootstrapped +version of TinyCC should be able to compile itself. An unpatched, GNU +Gcc-compiled tcc is known to compile GNU 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 compiled by M2-Planet or 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 (mescc.mes). + + MesCC can compile a modified TinyCC[8] that is close to being + 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 ~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.11 -O mes-0.11.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.11 since 0.10 + ** MesCC + *** MesCC now compiles a mes-tcc that passes 41/69 of mescc's C tests. + *** 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]. + *** MesCC now depends on Nyacc 0.82.4. + +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