Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leo-ard committed Aug 18, 2024
1 parent 3f98c87 commit f62e21d
Showing 1 changed file with 36 additions and 31 deletions.
67 changes: 36 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# Ribbit

A portable, compact and extensible Scheme implementation that is **fully R4RS complient**.
This includes closures, I/O, tail calls, first-class continuations and a Read Eval Print Loop (REPL).
A portable, compact and extensible Scheme implementation that is **fully R4RS complient**.
This includes closures, I/O, tail calls, first-class continuations and a Read Eval Print Loop (REPL).

- **Compact**. Ribbit compresses the code and *only* includes the features you need. [Read about our R4RS complient REPL in 7KB](https://arxiv.org/abs/2310.13589)
- **Portable**. Ribbit can run on *almost* anything : *JavaScript*, *Assembly (x86)*, *C*, *Python*, *POSIX Shell* and more. [See all Targets](#supported-targets).
- **Extensible**. Ribbit let's you add new primitives easily and tailor the RVM to your needs. [Read about our markup system.](http://www.iro.umontreal.ca/~feeley/papers/OLearyFeeleyMOREVMS23.pdf)

For more information about Ribbit, you can look at our papers in the [paper section](#research-and-papers).
For more information about Ribbit, you can look at our papers in the [paper section](#research-and-papers).

## Try it now !

You can [try the R4RS complient repl with types checks here](https://udem-dlteam.github.io/ribbit/repl-min.html) or the version [without types here](https://udem-dlteam.github.io/ribbit/repl-max.html).
You can [try the R4RS complient repl with types checks here](https://udem-dlteam.github.io/ribbit/repl-min.html) or the version [without types here](https://udem-dlteam.github.io/ribbit/repl-max.html).

## Development

Ribbit is a research project currently **under development**. A lot of enhancements have been made since the last release
Ribbit is a research project currently **under development**. A lot of enhancements have been made since the last release
(R4RS complience, I/O primitives, define-primitive/define-feature, etc.) and a new release is planned for the end of 2023.
If you do enconter bugs, please report them in the issue section of Github.

If you are interested in contributing, you can look at the [roadmap](#roadmap)
If you are interested in contributing, you can look at the [roadmap](#roadmap)
or reach out to @leo-ard or @feeley.

### Usage
Expand All @@ -32,15 +32,15 @@ v4.7.5. For the best experience install Gambit from https://github.com/gambit/ga
The compiler's source code is in a single file: `src/rsc.scm`.

Ribbit currently supports the target among C, JavaScript, Python,
Haskell, Assembly (x86) which are selectable with the compiler's `-t`
Haskell, Assembly (x86) which are selectable with the compiler's `-t`
option with `c`, `js`, `py`, `hs` and `asm` respectively.
See the [Supported targets](#supported-targets) table for all the targets.

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

The `-l` option allows selecting the Scheme runtime library (located in the
`lib` subdirectory). Here are a list of libraries :
`lib` subdirectory). Here are a list of libraries :
- `r4rs` : Adds all essential R4RS procedures. Includes a REPL that is fully r4rs compliant.
- `r4rs-tc` : Like `r4rs` but with run time type checking.
- `min`, `max` : Minimal library for small scheme implementations, incliding a REPL.
Expand Down Expand Up @@ -76,13 +76,13 @@ Here are a few examples (all assume that a `cd src` has been done first):
> (+ 1 2)
3

Try it with different hosts :
Try it with different hosts :

$ ./rsc.exe -t asm -l r4rs lib/r4rs/repl.scm -o repl.s (x86 assembly, need linux as it generates an ELF file)
$ ./rsc.exe -t c -l r4rs lib/r4rs/repl.scm -o repl.c
$ ./rsc.exe -t hs -l r4rs lib/r4rs/repl.scm -o repl.hs

Generate the world's smalest R4RS complient repl:
Generate the world's smalest R4RS complient repl:

$ make repl-asm.exe
$ ls -la repl-asm.exe (6.5KB)
Expand All @@ -99,14 +99,14 @@ Here are a few examples (all assume that a `cd src` has been done first):
"lambda: push(pop()**2),"))
((host c) ;; C host
(define-primitive (square x)
"{
"{
int x = NUM(pop());
push2(TAG_NUM(x*x), PAIR_TAG);
push2(TAG_NUM(x*x), PAIR_TAG);
}")))

(##putchar (square 8)) ;; prints '@' as 64 is the ASCII value of '8'
(##putchar 10) ;; prints a newline

$ ./rsc.exe -t py examples/square.scm -o square.py
$ python3 square.py
@
Expand Down Expand Up @@ -135,23 +135,28 @@ The makefile in the `src` directory has these make targets:

## Supported targets

| Host\feature | Supported | Markup complete | Arity feature |
|--------------|-----------|------------------|----------------|
| py | YES | missing location | YES |
| js | YES | YES | YES |
| c | YES | missing location | YES |
| asm | YES | missing location | YES |
| sh | YES | missing location | YES |
| scm | YES | missing location | YES |
| hs | YES | missing location | |
| lua | YES | missing location | |
| ml | YES | missing location | |
| rs | NO | | |
| go | NO | | |
| idr | NO | | |
| scala | NO | | |
| rb | NO | | |
| java | NO | | |
Here :
- `core` means a traditionnal RVM implementation. These support minimal I/O (putchar, getchar only), and min/max repls.
- `variadics` means that the target supports variadic functions (arity-check and rest-params features).
- `I/O` means that the target supports the full I/O primitives defined by r4rs (open-input-file, open-output-file, etc.).
- `r4rs` means that the target supports the full r4rs `essential` standard. This relies on all above features.

| Language | Core | variadics | I/O | R4RS |
|----------------------|------|-----------|------|------|
| Python (`py`) |||||
| JavaScript (`js`) |||||
| C (`c`) |||||
| x86 Assembly (`asm`) |||||
| Posix-Shell (`sh`) |||||
| Haskell (`hs`) |||||
| Scheme (`scm`) |||||
| Go (`go`) |||||
| Prolog (`pro`) | 🚧 ||||
| Ruby (`rb`) | 🚧 ||||
| Lua (`lua`) | 🚧 ||||
| Scala (`scala`) | 🚧 ||||
| Java (`java`) |||||
| Rust (`rs`) |||||

## Research and papers

Expand Down

0 comments on commit f62e21d

Please sign in to comment.