4 guix environment -l guix.scm #64 bit + 32bit
8 guix environment --system=i686-linux -l guix.scm #32 bit only
12 guix package --profile=~/.config/guix/mes --manifest=build-aux/manifest.scm
13 . ~/.config/guix/mes/etc/profile
16 There are two major modes to build Mes: true bootstrap and
20 To help development we assume ./configure sets these variables for make
23 CC32 -- i686-unknown-linux-gnu-gcc (or on x86, also gcc)
30 Mes is supposed to serve as a full equivalent for Guile, however Mes
31 ~30 times slower than Guile. That's why we usually don't use Mes
34 Gcc is used to verify the sanity of our C sources.
36 i686-unknown-linux-gnu-gcc is used to compare hex/assembly, to test
37 the gcc variant of Mes-libc: lib/libc-gcc.c and steal ideas. Target
40 Guile is used to develop MesCC, the C compiler in Scheme that during
41 bootstrapping will be executed by Mes.
43 mes is built from src/*.c and some out/src/*.h files that are snarfed from
44 src/*.c by build-aux/mes-snarf.scm.
46 Running ./make.scm produces a `script' file.
52 In bootstrap mode, we don't have gcc (CC), we don't have a 32 bit gcc
53 (CC32), we have no guile (GUILE)...but we should have hex2, M1, and
54 mes.M1. That's a bootstrap problem which is currently ignored by
55 using the mes-seed package. mes.M1 will be produced by M2-Planet from
61 *** release 0.x, unsorted
62 - mes+mescc: compile a mes-tcc that can compile gcc-4.7.
63 - mes: set base-0.scm as default MES_BOOT, drop cat base-0.mes silliness.
64 - mes: real module support, bonus for supporting Guile's define-module/define-public syntax.
65 - mes: prepare src/mes.c for M2-Planet transpiler.
66 - mes: produce functional mes from mes.M1 transpiled by M2-Planet.
67 - mes: we're a full Scheme now, drop .MES prefix, use .SCM.
68 + find a way to fix foo.mes/foo.scm trickery (full Guile-like module support?)
69 + how about setting `guile' or even `guile-2' cond-expand features
70 for external libraries (Nyacc) we look like Guile/Guile-2
71 internally, we could make sure to start every cond-expand with (mes)
72 - mes: use more efficient scheme continuation stack (wip-array?)
73 - mes: drop SCM stack in C / implement call/cc a la guile-1.8 setjmp?
74 - mescc: refactor type(/ptr?) system; expr->type and ast-type->type.
75 - mescc: refactor initializers.
76 - mescc: record and support function types, and thus foo ()->bar, *foo ().
77 - mescc: refactor switch statement to support unpatched tinycc.
78 - mes/mescc: bootstrap a minimal-Guile
79 + libguile/{eval,init,list,strings,values,..}.c
81 - mescc: have mes-tcc pass all scaffold/tests, scaffold/tinycc tests.
82 - mescc: compile a mes-tcc that can compile gcc-4.7.
83 - mescc: refactor switch; support heterogeneous switch case.
84 - mescc: support sizeof any expr.
85 - mescc: support function-static.
86 - mescc: support/grok global static.
87 - mescc: support unsigned comparison, arithmetic.
88 - mescc: support long long.
89 - mescc: support bitfields.
90 - mescc: support floats.
91 - mescc: some success with 8cc,pcc,guile/libguile/eval.c.
92 - build: guile/guix/make.scm: add file-types, intermediate, hash all dependencies
93 - build: make.scm: imperative->declaritive
94 - get full source syntax-case up (Andre van Tonder?) OR drop it.
95 https://srfi.schemers.org/srfi-72/srfi-72.html
96 psyntax/syntax-case and rewrite Nyacc without syntax-case+R7RS Ellipsis.
97 - mescc: split-off MesCC as as standalone Guile C compiler project.
99 - replace GuixSD's bootstrap binaries for x86.
100 - add x86_64, replace GuixSD's bootstrap binaries for x86_64.
101 - more architectures?
103 *** 0.12: Mes+MesCC now compiles mes.c (~3000LOC) in ~4min.
104 *** 0.11: MesCC now compiles a mes-tcc that passes 26/69 of mescc's C tests.
105 *** 0.10: Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out.
106 *** 0.9: Mescc now writes M1 macro assembly files and compiles tcc.
107 *** 0.8: Mescc now writes object files in stage0's labeled hex2 format.
108 *** 0.7: Mescc supports -E, -c, -o options, include more complete set of header files,
109 eenough to work on compiling tinycc's tcc.c albeit a somewhat modified version.
110 *** 0.6: Work with unmodified, unbundled Nyacc; compile 33/55 tinycc's tests/test2 suite.
111 *** 0.5: Mutual self-hosting Scheme interpreter and C compiler: mes.c and mescc,
112 Support call-with-current-continuation, refactor catch/throw
113 *** 0.4: Support Nyacc, Gcc-compiled Mes compiles minimal main.c using nyacc
114 *** 0.3: Garbage collector
115 *** 0.2: Support psyntax
116 *** 0.1: Mes eval/apply feature complete; support syntax-rules, compile main.c using LALR, dump ELF
120 MES_DEBUG=<level> mes
124 - included SCM modules and sources
130 - parsed, expanded program
133 - opened input strings
135 5) usage of opened input strings
139 ** mes: remove pmatch-car/pmatch-cdr hack.
140 ** mes+mescc: parse tcc.c->tcc.E works, compile tcc.E -> tcc.M1 segfaults.
141 time GUILE_LOAD_PATH=/home/janneke/src/nyacc/module:$GUILE_LOAD_PATH ../mes/scripts/mescc.mes -E -o tcc.E -I . -I ../mes/lib -I ../mes/include -D 'CONFIG_TCCDIR="usr/lib/tcc"' -D 'CONFIG_TCC_CRTPREFIX="usr/lib:{B}/lib:."' -D 'CONFIG_TCC_ELFINTERP="/gnu/store/70jxsnpffkl7fdb7qv398n8yi1a3w5nx-glibc-2.26.105-g0890d5379c/lib/ld-linux.so.2"' -D 'CONFIG_TCC_LIBPATHS="/home/janneke/src/tinycc/usr/lib:{B}/lib:."' -D 'CONFIG_TCC_SYSINCLUDEPATHS="../mes/include:usr/include:{B}/include"' -D CONFIG_USE_LIBGCC=1 -D 'TCC_LIBGCC="/home/janneke/src/tinycc/usr/lib/libc+tcc-gcc.mlibc-o"' -D CONFIG_TCC_STATIC=1 -D ONE_SOURCE=yes -D TCC_TARGET_I386=1 -D BOOTSTRAP=1 tcc.c
142 time GUILE_LOAD_PATH=/home/janneke/src/nyacc/module:$GUILE_LOAD_PATH MES_ARENA=200000000 ../mes/scripts/mescc.mes -c -o tcc.M1 tcc.E
143 ** mes: with-fluids: tests/fluids.test test 7 fails with Mes.
144 ** mescc: 7n-struct-struct-array.c: struct file f = {"first.h"};
145 ** test/match.test ("nyacc-simple"): hygiene problem in match
146 * OLD: Booting from LISP-1.5 into Mes
148 Mes started out experimenting with booting from a hex-coded minimal
149 LISP-1.5 (prototype in mes.c), into an almost-RRS Scheme.
151 When EOF is read, the LISP-1.5 machine calls loop2 from loop2.mes,
152 which reads the rest of stdin and takes over control. The functions
153 readenv, eval and apply-env in mes.mes introduced define, define-macro
154 quasiquote and macro expansion.
156 While this works, it's amazingly slow. We implemented a full reader
157 in mes.c, which makes running mes:apply-env mes:eval somewhat
158 bearable, still over 1000x slower than running mes.c.
160 Bootstrapping has been removed and mes.c implements enough of RRS to
161 run a macro-based define-syntax and syntax-rules.
163 loop.mes and mes.mes are unused and lagging behind. Probably it's not
164 worth considering this route without a VM. GNU Epsilon is taking the
165 more usual VM-route to provide multiple personas. While that sounds
166 neat, Lisp/Scheme, bootstrapping and trusted binaries are probably not
167 in scope as there is no mention of such things; only ML is mentioned
168 while Guile is used for bootstrapping.
170 * Assorted ideas and info
171 ** Using GDB on assembly/a.out
175 set disassemble-next-line on
176 gdb-display-disassembly-buffer
178 ** Create memory dump with 32 bit Gcc compiled Mes
179 make out/i686-unknown-linux-gnu-mes
180 out/i686-unknown-linux-gnu-mes --dump < module/mes/read-0.mes > module/mes/read-0-32.mo
182 *** [[https://savannah.gnu.org/projects/nyacc][nyacc]]
183 *** PEG: [[http://piumarta.com/software/peg/][parse C using PEG]]
184 *** [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]]
185 *** [[http://www.t3x.org/subc/index.html][Sub C]]
186 *** [[https://groups.google.com/forum/#!topic/comp.lang.lisp/VPuX0VsjTTE][C intepreter in LISP/Scheme/Python]]
188 ** C assembler/linker
189 *** [[http://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]]
192 *** [[http://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]]
193 *** [[http://www.cirosantilli.com/elf-hello-world/][Elf hello world]]
194 ** SC - c as s-expressions
195 sc: http://sph.mn/content/3d3
197 *** [[http://www.scheme-reports.org/][Scheme Reports]]
198 *** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf][Scheme - Report on Scheme]]
199 *** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-452.pdf][RRS - Revised Report on Scheme]]
202 http://forum.osdev.org/viewtopic.php?f=15&t=19937
204 http://www.stripedgazelle.org/joey/dreamos.html
205 http://armpit.sourceforge.net/
206 http://common-lisp.net/project/movitz/movitz.html
208 <civodul> janneke: https://github.com/namin/inc looks interesting [15:18]
210 <OriansJ> janneke: also, if you look at
211 https://github.com/oriansj/stage0/tree/master/stage2/High_level_prototypes
212 [the garbage collected lisp I implemented], if there are any pieces
213 I could add to finish off your mes lisp bootstrap just let me know
214 because I would be more than happy to do that :D
215 <janneke> OriansJ: that's what I'm hoping for, that our efforts can be
216 complementary and we can work together
217 *** lfam (~lfam@2601:47:4180:2ffb:7c05:17de:cf5f:23ef) has quit: Ping timeout:
219 <janneke> exciting times! [00:23]
220 <janneke> OriansJ: i looked a few times and saw 'LISP empty', so thanks for
222 <civodul> OriansJ, janneke: from that page, there's also:
223 https://web.archive.org/web/20160604035203fw_/http://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html
226 https://web.archive.org/web/20160604041431/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c
227 https://github.com/rswier/c4/blob/master/c4.c
228 ** Compilers for free
229 http://codon.com/compilers-for-free
231 *** [[https://www.mirrorservice.org/sites/www.bitsavers.org/bits/TI/Explorer/zeta-c/][ZETA-C]]
234 *** [[https://github.com/rui314/8cc][8cc]] -- a C11 compiler, but simple
235 8cc is a compiler for the C programming language. It's intended to
236 support all C11 language features while keeping the code as small and
240 https://miyuki.github.io/2017/10/04/gcc-archaeology-1.html
241 *** [[http://tack.sourceforge.net/][ack]]
242 <rain1> it may be possible to compile like this: mes |> ack |> pcc |> tcc |>
243 gcc 4.7.4 |> gcc later version... up to modern
244 *** [[https://web.archive.org/web/20160402225843/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/][cc500]]
245 ** rain1's Bootstrapping Wiki: https://bootstrapping.miraheze.org/wiki/Main_Page
247 https://notabug.org/rain1/hex86/src/master/tests/hex0b3.hex86