Add POSIX shell target that allows bootstrapping Ribbit using only a … · udem-dlteam/ribbit@14077d1

2 min read Original article ↗

@@ -14,7 +14,7 @@ The Ribbit AOT compiler is written in Scheme and can be executed with Gambit, Gu

14141515

The AOT compiler's source code is in a single file: `src/rsc.scm` . This Scheme file can be executed as a program with the Gambit, Guile or Chicken interpreters. Alternatively the AOT compiler can be executed using the `src/rsc` shell script, which has the additional `-c` option to select a specific build of the Ribbit AOT compiler which is useful for bootstrapping Ribbit.

161617-

Ribbit currently supports the target languages C, JavaScript, Python and Scheme which are selectable with the compiler's `-t` option with `c`, `js`, `py`, and `scm` respectively. The compacted RVM code can be obtained with the target `rvm` which is the default.

17+

Ribbit currently supports the target languages C, JavaScript, Python, Scheme, and POSIX shell which are selectable with the compiler's `-t` option with `c`, `js`, `py`, `scm` and `sh` respectively. The compacted RVM code can be obtained with the target `rvm` which is the default.

18181919

The `-m` option causes a minification of the generated program. This requires a recent version of Gambit.

2020

@@ -84,3 +84,14 @@ Here are a few examples (all assume that a `cd src` has been done first):

8484

$ ./rsc -t py -l max -c "node rsc.scm.js" h.scm # use bootstrapped compiler

8585

$ python3 h.scm.py

8686

hello!

87+88+

Bootstrap the Ribbit AOT compiler using a POSIX shell (note

89+

that with ksh this takes over 5 hours on a fast computer and it

90+

can take substantially more with other POSIX shells):

91+92+

$ ./rsc -t sh -l max -o rsc-bootstrap1.sh rsc.scm

93+

$ ./rsc -t sh -l max -c "ksh rsc-bootstrap1.sh" -o rsc-bootstrap2.sh rsc.scm

94+

$ echo '(display "hello!\n")' > h.scm

95+

$ ./rsc -t sh -l max -m -c "ksh rsc-bootstrap2.sh" h.scm

96+

$ ksh h.scm.sh

97+

hello!