4 guix environment -l guix.scm #64 bit + 32bit
5 guix environment --system=i686-linux -l guix.scm #32 bit only
7 There are two major modes to build Mes: true bootstrap and
11 To help development we assume ./configure sets these variables for make
14 CC32 -- i686-unknown-linux-gnu-gcc (or on x86, also gcc)
21 Mes is supposed to serve as a full equivalent for Guile, however mes is much, much
22 slower than guile. That's why we usually don't use mes during development.
24 gcc is used to verify the sanity of our C sources.
26 i686-unknown-linux-gnu-gcc is used to compare hex/assembly, to test
27 the gcc variant of mlbic: mlibc/libc-gcc.c and steal ideas.
29 Guile is used to develop mescc, the C compiler in Scheme that during
30 bootstrapping will be executed by mes.
33 In bootstrap mode, we don't have gcc (CC), we don't have pa 32 bit gcc
34 (CC32), we have no guile (GUILE)...but we should have hex2, M1, and
37 mes is built from src/*.c and some out/src/*.h files that are snarfed from
38 src/*.c by build-aux/mes-snarf.scm.
40 Running ./make.scm produces a `script' file.
45 - mescc: compile a mes-tcc that can compile gcc-4.7.
46 *** release 0.x, unsorted
47 - mescc: refactor type(/ptr?) system; expr->type and ast-type->type.
48 - mescc: refactor initializers.
49 - mescc: record and support function types, and thus foo ()->bar.
50 - mescc: refactor switch statement to support unpatched tinycc.
51 - mes/mescc: bootstrap a minimal-Guile (libguile/eval.c,ice-9/eval.scm).
52 - mescc: have mes-tcc pass all scaffold/tests, scaffold/tinycc tests.
53 - mescc: compile a mes-tcc that can compile gcc-4.7.
54 - mescc: refactor switch; support heterogeneous switch case.
55 - mescc: support sizeof any expr.
56 - mescc: support function-static.
57 - mescc: support/grok global static.
58 - mescc: support unsigned comparison, arithmetic.
59 - mescc: support long long.
60 - mescc: support bitfields.
61 - mescc: support floats.
62 - mescc: some success with 8cc,pcc,guile/libguile/eval.c.
63 - build: guile/guix/make.scm: add file-types, intermediate, hash all dependencies
64 - build: make.scm: imperative->declaritive
65 - hex2: produce ELF_sym and ELF_str tables from hex2; nicer for objdump -d, gdb (in mescc-tools?)
66 - compile src/mes.c with M2-Planet.
67 - rewrite src/mes.c in stage0's stage2 LISP.
68 - and/or: rewrite src/mes.c M1
69 - and/or: connect to GNU Epsilon's VM
70 - and/or: compile Scheme to C, rewrite Mes.c into Mes.scm.
71 - real module support, bonus for supporting Guile's define-module/define-public syntax.
72 - get full source syntax-case up (Andre van Tonder?) OR drop it.
73 psyntax/syntax-case and rewrite Nyacc without syntax-case+R7RS Ellipsis.
74 - support regexp OR rewrite Nyacc without regexps.
75 - split-off MesCC as as standalone Guile C compiler project.
77 - replace GuixSD's bootstrap binaries for x86.
78 - add x86_64, replace GuixSD's bootstrap binaries for x86_64.
81 *** 0.11: MesCC now compiles a mes-tcc that passes 41/69 of mescc's C tests.
82 *** 0.10: Mescc now compiles a mes-tcc that compiles a trivial C to a running a.out.
83 *** 0.9: Mescc now writes M1 macro assembly files and compiles tcc.
84 *** 0.8: Mescc now writes object files in stage0's labeled hex2 format.
85 *** 0.7: Mescc supports -E, -c, -o options, include more complete set of header files,
86 eenough to work on compiling tinycc's tcc.c albeit a somewhat modified version.
87 *** 0.6: Work with unmodified, unbundled Nyacc; compile 33/55 tinycc's tests/test2 suite.
88 *** 0.5: Mutual self-hosting Scheme interpreter and C compiler: mes.c and mescc,
89 Support call-with-current-continuation, refactor catch/throw
90 *** 0.4: Support Nyacc, Gcc-compiled Mes compiles minimal main.c using nyacc
91 *** 0.3: Garbage collector
92 *** 0.2: Support psyntax
93 *** 0.1: Mes eval/apply feature complete; support syntax-rules, compile main.c using LALR, dump ELF
96 ** eval_apply/gc + Nyacc bug
97 scripts/messc.mes intermittently exposes a bug in eval_apply/gc when
98 Nyacc parses mes.c-sized source. Running
100 MES_MAX_ARENA=<another-size> scripts/mescc.mes
102 may [un]cover the bug. So there is probably some eval_apply-construct
103 that Nyacc uses, possiblby indirectly via with-fluid, like (call/cc,
104 call-with-current-continuation), that breaks when GC triggers at the
106 ** mescc can only compile itself, it cannot full-functionally compile tcc, gcc or guile
107 ** mescc: 7n-struct-struct-array.c: struct file f = {"first.h"};
108 ** mes.mes cannot read sexps, only --dump's, mes.mes cannot --dump
109 ** Bootstrap binary mes is too big and opaque to be considered source
110 68kB ELF binary which can be disassembled (objdump -d mes.mes).
111 ** Psyntax is too big and opaque to be considered source
112 And needs a patched Guile-1.8 to [re]generate.
113 ** test/match.test ("nyacc-simple"): hygiene problem in match
116 *** The Scheme reader is very slow.
118 **** compiling mes.c takes mescc.mes 2h30'
119 mescc.scm which runs on Guile takes 30"
120 ** Fluids are a hack for Nyacc.
121 *** Translate C-prototype mes.c into annotated hex?
122 One idea is to use OriansJ's amazing self-hosting [[https://github.com/oriansj/stage0][stage0]] hex assembler
123 and minimal bootstrap binaries and rewrite the mes.c core to directly
124 bootstrap into Scheme.
126 *** Rewrite mes.c in Schemy/Sexp-C and generate annotated hex?
127 Another idea (thanks Rutger!) is to rewrite the mes.c core in a s-exp
128 C/Assembly variant and thave mescc produce the simple, annotated
131 *** Compile the [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]]
133 ** Build tools do not run on mes
134 *** configure needs Bash, Guile
135 *** GNUmakefile needs Bash, Guile
136 *** build-aux/mes-snarf.scm needs Guile
137 *** build-aux/git-changelog needs Perl
138 * OLD: Booting from LISP-1.5 into Mes
140 Mes started out experimenting with booting from a hex-coded minimal
141 LISP-1.5 (prototype in mes.c), into an almost-RRS Scheme.
143 When EOF is read, the LISP-1.5 machine calls loop2 from loop2.mes,
144 which reads the rest of stdin and takes over control. The functions
145 readenv, eval and apply-env in mes.mes introduced define, define-macro
146 quasiquote and macro expansion.
148 While this works, it's amazingly slow. We implemented a full reader
149 in mes.c, which makes running mes:apply-env mes:eval somewhat
150 bearable, still over 1000x slower than running mes.c.
152 Bootstrapping has been removed and mes.c implements enough of RRS to
153 run a macro-based define-syntax and syntax-rules.
155 loop.mes and mes.mes are unused and lagging behind. Probably it's not
156 worth considering this route without a VM. GNU Epsilon is taking the
157 more usual VM-route to provide multiple personas. While that sounds
158 neat, Lisp/Scheme, bootstrapping and trusted binaries are probably not
159 in scope as there is no mention of such things; only ML is mentioned
160 while Guile is used for bootstrapping.
162 * Assorted ideas and info
163 ** Using GDB on assembly/a.out
167 set disassemble-next-line
168 gdb-display-disassembly-buffer
170 ** Create memory dump with 32 bit Gcc compiled Mes
171 make out/i686-unknown-linux-gnu-mes
172 out/i686-unknown-linux-gnu-mes --dump < module/mes/read-0.mes > module/mes/read-0-32.mo
174 *** [[https://savannah.gnu.org/projects/nyacc][nyacc]]
175 *** PEG: [[http://piumarta.com/software/peg/][parse C using PEG]]
176 *** [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]]
177 *** [[http://www.t3x.org/subc/index.html][Sub C]]
178 *** [[https://groups.google.com/forum/#!topic/comp.lang.lisp/VPuX0VsjTTE][C intepreter in LISP/Scheme/Python]]
180 ** C assembler/linker
181 *** [[http://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]]
184 *** [[http://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]]
185 *** [[http://www.cirosantilli.com/elf-hello-world/][Elf hello world]]
186 ** SC - c as s-expressions
187 sc: http://sph.mn/content/3d3
189 *** [[http://www.scheme-reports.org/][Scheme Reports]]
190 *** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf][Scheme - Report on Scheme]]
191 *** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-452.pdf][RRS - Revised Report on Scheme]]
194 http://forum.osdev.org/viewtopic.php?f=15&t=19937
196 http://www.stripedgazelle.org/joey/dreamos.html
197 http://armpit.sourceforge.net/
198 http://common-lisp.net/project/movitz/movitz.html
200 <civodul> janneke: https://github.com/namin/inc looks interesting [15:18]
202 <OriansJ> janneke: also, if you look at
203 https://github.com/oriansj/stage0/tree/master/stage2/High_level_prototypes
204 [the garbage collected lisp I implemented], if there are any pieces
205 I could add to finish off your mes lisp bootstrap just let me know
206 because I would be more than happy to do that :D
207 <janneke> OriansJ: that's what I'm hoping for, that our efforts can be
208 complementary and we can work together
209 *** lfam (~lfam@2601:47:4180:2ffb:7c05:17de:cf5f:23ef) has quit: Ping timeout:
211 <janneke> exciting times! [00:23]
212 <janneke> OriansJ: i looked a few times and saw 'LISP empty', so thanks for
214 <civodul> OriansJ, janneke: from that page, there's also:
215 https://web.archive.org/web/20160604035203fw_/http://homepage.ntlworld.com/edmund.grimley-evans/bcompiler.html
218 https://web.archive.org/web/20160604041431/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/cc500.c
219 https://github.com/rswier/c4/blob/master/c4.c
220 ** Compilers for free
221 http://codon.com/compilers-for-free
223 *** [[https://www.mirrorservice.org/sites/www.bitsavers.org/bits/TI/Explorer/zeta-c/][ZETA-C]]
226 *** [[https://github.com/rui314/8cc][8cc]] -- a C11 compiler, but simple
227 8cc is a compiler for the C programming language. It's intended to
228 support all C11 language features while keeping the code as small and
232 https://miyuki.github.io/2017/10/04/gcc-archaeology-1.html
233 *** [[http://tack.sourceforge.net/][ack]]
234 <rain1> it may be possible to compile like this: mes |> ack |> pcc |> tcc |>
235 gcc 4.7.4 |> gcc later version... up to modern
236 *** [[https://web.archive.org/web/20160402225843/http://homepage.ntlworld.com/edmund.grimley-evans/cc500/][cc500]]
237 ** rain1's Bootstrapping Wiki: https://bootstrapping.miraheze.org/wiki/Main_Page
239 https://notabug.org/rain1/hex86/src/master/tests/hex0b3.hex86