Prepare for 0.1 release: update READMEs.
* NEWS: New file. * AUTHORS: Add info about files taken from Scheme48. * HACKING: Update with info from TODO. * TODO: Remove.
This commit is contained in:
parent
6d64e55500
commit
2001183928
13
AUTHORS
13
AUTHORS
|
@ -1 +1,14 @@
|
||||||
Jan Nieuwenhuizen <janneke@gnu.org>
|
Jan Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
Main author
|
||||||
|
All files except the files listed below
|
||||||
|
|
||||||
|
Based on Scheme48's scheme/alt
|
||||||
|
module/mes/record.mes
|
||||||
|
module/mes/syntax.mes
|
||||||
|
module/srfi/srfi-9.mes
|
||||||
|
|
||||||
|
Based on Guile ECMAScript
|
||||||
|
module/language/c/lexer.mes
|
||||||
|
|
||||||
|
Included verbatim from gnulib
|
||||||
|
build-aux/gitlog-to-changelog
|
||||||
|
|
108
HACKING
108
HACKING
|
@ -1,9 +1,65 @@
|
||||||
-*-mode:org-*-
|
-*-mode:org-*-
|
||||||
|
|
||||||
* Booting from LISP-1.5 into Mes
|
* Fully source-based bootstrapping
|
||||||
|
|
||||||
|
** R5RS-like scheme interpreter
|
||||||
|
This first part is prototyped in C by the mes.c core and Scheme
|
||||||
|
bootstrap code in module/. Of course, while mes.c is pretty small it
|
||||||
|
cannot serve as a fully source-based solution.
|
||||||
|
|
||||||
|
The initial idea was to have the minimal core support LISP-1.5 (or
|
||||||
|
something very close to that as a tribute to John McCarthy) and extend
|
||||||
|
eval/apply from LISP-1.5 source with define, define-macro etc. and
|
||||||
|
metamorphose into R6RS. It seemed to work but performance of the
|
||||||
|
LISP-intepreted RRS was so bad (~1000x slower than initial LISP-1.5)
|
||||||
|
that this track was abandoned after the initial ANNOUNCE.
|
||||||
|
|
||||||
|
The route changed trying strike a balance between core size and
|
||||||
|
performance: still writing as much as possible in Scheme, but having a
|
||||||
|
mescc compiler that takes not more than some seconds to run.
|
||||||
|
|
||||||
|
Now that the important bits of R5RS are done and R6RS's syntax-case
|
||||||
|
comes in scope, mes.c has grown into ~1500LOC, some effort must
|
||||||
|
probably be directed into making that smaller.
|
||||||
|
|
||||||
|
** Move mes.c into hex?
|
||||||
|
One idea is to use OrianJ's amazing self-hosting [[https://github.com/oriansj/stage0][stage0]] hex assembler
|
||||||
|
and minimal bootstrap binaries and rewrite the mes.c core to directly
|
||||||
|
bootstrap into Scheme.
|
||||||
|
|
||||||
|
** Rewrite mes.c and generate hex?
|
||||||
|
Another idea (thanks Rutger!) is to rewrite the mes.c core in a
|
||||||
|
C/Assembly variant and have mescc produce the simple, annotated
|
||||||
|
bootstrap binary.
|
||||||
|
|
||||||
|
** R6RS's syntax-case
|
||||||
|
|
||||||
|
Having syntax-case should enable Mes to run [[https://savannah.gnu.org/projects/nyacc][nyacc]], which comes with a
|
||||||
|
full C parser.
|
||||||
|
|
||||||
|
*** Get Andre van Tonder's portable syntax-case up.
|
||||||
|
+ This would avoid the psyntax.ss -> psyntax.pp -> psyntax.ss
|
||||||
|
bootstrap problem with an elegantly small implementation.
|
||||||
|
|
||||||
|
- Does this support the idea of a minimal mes.c core, or is too
|
||||||
|
much Scheme support required in the core?
|
||||||
|
*** Get a version of portable psyntax.pp up.
|
||||||
|
+ Fully standard complient R6RS macros.
|
||||||
|
+ Minimal mes.c core required (not even quasiquote?).
|
||||||
|
- Sloooowwwww with intepreter?
|
||||||
|
|
||||||
|
* Bugs
|
||||||
|
** Garbage collection?
|
||||||
|
Mes is using malloc without freeing anything, memory is patient these
|
||||||
|
days :-)
|
||||||
|
** find/fix hygiene problem: see module/mes/match.scm ;; X vs x
|
||||||
|
**
|
||||||
|
** Actually do something useful, build: [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]]
|
||||||
|
|
||||||
|
* OLD: Booting from LISP-1.5 into Mes
|
||||||
|
|
||||||
Mes started out experimenting with booting from a hex-coded minimal
|
Mes started out experimenting with booting from a hex-coded minimal
|
||||||
LISP-1.5 (prototype in mes.c), into an intepreted full-flegded Scheme.
|
LISP-1.5 (prototype in mes.c), into an almost-RRS Scheme.
|
||||||
|
|
||||||
When EOF is read, the LISP-1.5 machine calls loop2 from loop2.mes,
|
When EOF is read, the LISP-1.5 machine calls loop2 from loop2.mes,
|
||||||
which reads the rest of stdin and takes over control. The functions
|
which reads the rest of stdin and takes over control. The functions
|
||||||
|
@ -14,30 +70,40 @@ While this works, it's amazingly slow. We implemented a full reader
|
||||||
in mes.c, which makes running mes:apply-env mes:eval somewhat
|
in mes.c, which makes running mes:apply-env mes:eval somewhat
|
||||||
bearable, still over 1000x slower than running mes.c.
|
bearable, still over 1000x slower than running mes.c.
|
||||||
|
|
||||||
Bootstrapping has been removed and mes.c implements enough of R3RS to
|
Bootstrapping has been removed and mes.c implements enough of RRS to
|
||||||
run a macro-based define-syntax and syntax-rules.
|
run a macro-based define-syntax and syntax-rules.
|
||||||
|
|
||||||
loop.mes and mes.mes are unused and lagging behind. Probably it's not
|
loop.mes and mes.mes are unused and lagging behind. Probably it's not
|
||||||
worth considering this route without a VM. GNU Epsilon is taking the
|
worth considering this route without a VM. GNU Epsilon is taking the
|
||||||
more usual VM-route to provide multiple personas. While that sounds
|
more usual VM-route to provide multiple personas. While that sounds
|
||||||
very cool, Lisp/Scheme, bootstrapping and trusted binaries are
|
neat, Lisp/Scheme, bootstrapping and trusted binaries are probably not
|
||||||
probably not in scope as there is no mention of such things; only ML
|
in scope as there is no mention of such things; only ML is mentioned
|
||||||
is mentioned while Guile is used for bootstrapping.
|
while Guile is used for bootstrapping.
|
||||||
|
|
||||||
mes.c is ~1200 lines which seems much too big to start translating it
|
mes.c is ~1500 lines (~10,000LOC Assembly) which seems much too big to
|
||||||
to assembly/hex.
|
start translating it to assembly/hex.
|
||||||
|
|
||||||
* Garbage collection
|
* Assorted ideas and info
|
||||||
Mes is using malloc without freeing anything, memory is patient these
|
** C parser/compiler
|
||||||
days :-)
|
*** [[https://savannah.gnu.org/projects/nyacc][nyacc]]
|
||||||
|
*** PEG: [[http://piumarta.com/software/peg/][parse C using PEG]]
|
||||||
|
*** [[https://en.wikipedia.org/wiki/Tiny_C_Compiler][Tiny C Compiler]]
|
||||||
|
*** [[http://www.t3x.org/subc/index.html][Sub C]]
|
||||||
|
*** [[https://groups.google.com/forum/#!topic/comp.lang.lisp/VPuX0VsjTTE][C intepreter in LISP/Scheme/Python]]
|
||||||
|
|
||||||
|
** C assembler/linker
|
||||||
|
*** [[http://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html][Assembly HOWTO]]
|
||||||
|
*** System call clue bat
|
||||||
|
Basically, you issue an int 0x80, with the __NR_syscallname number
|
||||||
|
(from asm/unistd.h) in eax, and parameters (up to six) in ebx, ecx,
|
||||||
|
edx, esi, edi, ebp respectively.
|
||||||
|
*** ELF
|
||||||
|
7f 45 4c 46
|
||||||
|
*** [[http://www.muppetlabs.com/~breadbox/software/tiny/][Small ELF programs]]
|
||||||
|
*** [[http://www.cirosantilli.com/elf-hello-world/][Elf hello world]]
|
||||||
|
|
||||||
|
** RNRS
|
||||||
|
*** [[http://www.scheme-reports.org/][Scheme Reports]]
|
||||||
|
*** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf][Scheme - Report on Scheme]]
|
||||||
|
*** [[ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-452.pdf][RRS - Revised Report on Scheme]]
|
||||||
|
|
||||||
* The [GuixSD] boostrap binaries
|
|
||||||
** Run a C parser on Mes
|
|
||||||
*** Run simple PEG on Guile
|
|
||||||
*** Run simple PEG on Mes
|
|
||||||
*** Find/port a PEG C and parse minimal C program
|
|
||||||
*** Generate an executable from this C-AST
|
|
||||||
*** Find a tiny C compiler that can compile gcc
|
|
||||||
** Run lalr on Mes
|
|
||||||
*** Get paren.scm test running
|
|
||||||
*** Translate cgram.y into lalr, generate AST
|
|
||||||
|
|
30
NEWS
Normal file
30
NEWS
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
-*- org -*-
|
||||||
|
#+TITLE: Mes NEWS – history of user-visible changes
|
||||||
|
#+STARTUP: content hidestars
|
||||||
|
|
||||||
|
Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
|
||||||
|
Copying and distribution of this file, with or without modification,
|
||||||
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
notice and this notice are preserved.
|
||||||
|
|
||||||
|
Please send Mes bug reports to janneke@gnu.org.
|
||||||
|
|
||||||
|
* Changes in 0.1 (since progress report #2)
|
||||||
|
|
||||||
|
** Core
|
||||||
|
*** expand_macro is now a separate function.
|
||||||
|
** Language
|
||||||
|
*** Mes now provides a subset of R5RS.
|
||||||
|
*** Mes now provides let-syntax.
|
||||||
|
*** Mes now provides match.
|
||||||
|
** User interface
|
||||||
|
*** Mes now provides a REPL, run:
|
||||||
|
scripts/repl.mes
|
||||||
|
* Mes compiler can be run as a script:
|
||||||
|
scripts/mescc.mes doc/examples/main.c
|
||||||
|
*** Macro expansion can be inspected in the REPL, e.g.:
|
||||||
|
,expand (and 0 1)
|
||||||
|
** Noteworthy bug fixes
|
||||||
|
*** Performance of (e.g. scripts/mescc.mes) has been improved by a factor of 40.
|
||||||
|
*** Symbols are now truly unique.
|
48
README
48
README
|
@ -1,41 +1,35 @@
|
||||||
|
-*- org -*-
|
||||||
Mes -- Maxwell Equations of Software
|
Mes -- Maxwell Equations of Software
|
||||||
|
|
||||||
Mes is inspired by The Maxwell Equations of Software -- John McCarthy page 13
|
Mes aims to create an entirely source-based bootstrapping path. The
|
||||||
http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf
|
target is to [have GuixSD] boostrap from a minimal, easily inspectable
|
||||||
|
binary --that should be readable as source-- into something close to
|
||||||
|
R5RS Scheme.
|
||||||
|
|
||||||
Its aim is to have GuixSD boostrap from a minimal trusted binary into
|
As bootstrapping is presumably easiest and probably most fun with
|
||||||
Scheme. The strategy is to use OrianJs self-hosting hex assembler to
|
Scheme, the next step for Mes is mescc: a C compiler/linker to
|
||||||
write a minimal LISP called MES to bootstrap a full fledged Scheme,
|
boostrap into GNU Gcc and GNU Guile, possibly via Tiny-CC.
|
||||||
written in 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.
|
||||||
|
|
||||||
Mes is free software, it is distributed unde the terms of the GNU
|
Mes is free software, it is distributed unde the terms of the GNU
|
||||||
General Public Licence version 3 or later. See the file COPYING.
|
General Public Licence version 3 or later. See the file COPYING.
|
||||||
|
|
||||||
Current targets.
|
* Get it
|
||||||
|
|
||||||
* make check
|
git clone https://gitlab.com/janneke/mes
|
||||||
|
|
||||||
* C compiler
|
* Build it (see INSTALL for full instructions)
|
||||||
|
|
||||||
make mescc
|
./configure
|
||||||
make guile-mescc
|
make all
|
||||||
|
make check
|
||||||
|
|
||||||
from there, work on mescc.scm, main.c.
|
* REPL it
|
||||||
|
|
||||||
* syntax-case: simple portable version by Andre van Tonder
|
scripts/repl.mes
|
||||||
|
|
||||||
TODO
|
* Mescc compiler
|
||||||
|
|
||||||
* syntax-case: using portable psyntax.pp
|
scripts/mescc.mes doc/examples/main.c
|
||||||
|
|
||||||
make psyntax
|
|
||||||
|
|
||||||
* syntax-case using define-macro
|
|
||||||
|
|
||||||
make syntax-case
|
|
||||||
make guile-syntax-case
|
|
||||||
|
|
||||||
* PEG
|
|
||||||
|
|
||||||
make peg
|
|
||||||
make guile-peg
|
|
||||||
|
|
96
TODO
96
TODO
|
@ -1,96 +0,0 @@
|
||||||
-*-mode:org-*-
|
|
||||||
|
|
||||||
* minimal bootstrap binary, via Scheme, into C compiler/linker
|
|
||||||
** core: mes.c
|
|
||||||
*** make mes.c smaller
|
|
||||||
**** replace mes.c:quasiquote by quasiquote.mes
|
|
||||||
***** SPEEDUP
|
|
||||||
**** cleanup environment/closures
|
|
||||||
*** make mes.c faster
|
|
||||||
*** use GC
|
|
||||||
*** move from C to hex/assembly
|
|
||||||
|
|
||||||
** bugs
|
|
||||||
See bugs/
|
|
||||||
|
|
||||||
*** find/fix hygiene problem: see lib/match.scm ;; X vs x
|
|
||||||
Is it in let, define-syntax, match or intrinsically in define-macro?
|
|
||||||
|
|
||||||
** parse C using PEG
|
|
||||||
http://piumarta.com/software/peg/
|
|
||||||
*** Simple Guile test:
|
|
||||||
make guile-peg
|
|
||||||
*** PEG on Mes does not work yet:
|
|
||||||
make peg
|
|
||||||
**** syntax-case
|
|
||||||
***** portable syntax-case Andre van Tonder
|
|
||||||
***** psyntax.pp
|
|
||||||
***** hook-up sc-expand, see guile-1.0?: scheme:eval-transformer
|
|
||||||
Find out how to hook-up sc-expand in eval/apply.
|
|
||||||
|
|
||||||
** parse C using LALR
|
|
||||||
*** Translate cgram.y into lalr, generate AST
|
|
||||||
*** C grammar in lex/yacc
|
|
||||||
https://github.com/rabishah/Mini-C-Compiler-using-Flex-And-Yacc
|
|
||||||
https://www.lysator.liu.se/c/ANSI-C-grammar-y.html
|
|
||||||
http://www2.cs.uidaho.edu/~jeffery/courses/nmsu/370/cgram.y
|
|
||||||
https://github.com/ProgramLeague/C-Compilerp
|
|
||||||
*** parsing in scheme
|
|
||||||
ftp://ftp.cs.indiana.edu/pub/scheme-repository/code/lang/cgram-ll1
|
|
||||||
** Tiny C
|
|
||||||
https://en.wikipedia.org/wiki/Tiny_C_Compiler
|
|
||||||
** Sub C
|
|
||||||
http://www.t3x.org/subc/index.html
|
|
||||||
**
|
|
||||||
https://groups.google.com/forum/#!topic/comp.lang.lisp/VPuX0VsjTTE
|
|
||||||
*** any, each?
|
|
||||||
|
|
||||||
|
|
||||||
* assorted info
|
|
||||||
** ASM
|
|
||||||
http://www.tldp.org/HOWTO/Assembly-HOWTO/linux.html
|
|
||||||
|
|
||||||
Basically, you issue an int 0x80, with the __NR_syscallname number
|
|
||||||
(from asm/unistd.h) in eax, and parameters (up to six) in ebx, ecx,
|
|
||||||
edx, esi, edi, ebp respectively.
|
|
||||||
|
|
||||||
** ELF
|
|
||||||
7f 45 4c 46
|
|
||||||
|
|
||||||
http://www.muppetlabs.com/~breadbox/software/tiny/
|
|
||||||
|
|
||||||
http://www.cirosantilli.com/elf-hello-world/
|
|
||||||
|
|
||||||
** SCM
|
|
||||||
** RNRS
|
|
||||||
http://www.scheme-reports.org/
|
|
||||||
*** Scheme
|
|
||||||
ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-349.pdf
|
|
||||||
*** RRS
|
|
||||||
ftp://publications.ai.mit.edu/ai-publications/pdf/AIM-452.pdf
|
|
||||||
|
|
||||||
http://groups.csail.mit.edu/mac/ftpdir/scm/OLD/scm2e.tar.Z
|
|
||||||
wget http://groups.csail.mit.edu/mac/ftpdir/scm/OLD/scm3c13.tar.Z
|
|
||||||
http://groups.csail.mit.edu/mac/ftpdir/scm/OLD/scm4a5.tar.Z
|
|
||||||
|
|
||||||
http://groups.csail.mit.edu/mac/ftpdir/scm/OLD/scm5a1.tar.gz --> syntax-rules
|
|
||||||
http://groups.csail.mit.edu/mac/ftpdir/scm/OLD/scm5c0.tar.gz
|
|
||||||
|
|
||||||
|
|
||||||
define-
|
|
||||||
|
|
||||||
http://www.cs.indiana.edu/chezscheme/syntax-case/old-psyntax.html
|
|
||||||
|
|
||||||
http://www.cs.indiana.edu/chezscheme/syntax-case/
|
|
||||||
|
|
||||||
1.4..2.9:
|
|
||||||
http://groups.csail.mit.edu/mac/ftpdir/siod/
|
|
||||||
|
|
||||||
http://groups.csail.mit.edu/mac/ftpdir/s48/archive/scheme48-0-21.tar.gz
|
|
||||||
|
|
||||||
Macros:
|
|
||||||
http://www.bcl.hamilton.ie/~barak/teach/F97/CS257/macros.html
|
|
||||||
|
|
||||||
|
|
||||||
syntax-case/syntax-rules in clojure
|
|
||||||
https://github.com/qbg/syntax-rules/blob/master/src/qbg/syntax_rules.clj
|
|
Loading…
Reference in a new issue