diff --git a/README.md b/README.md index d6835a42..0b94309f 100644 --- a/README.md +++ b/README.md @@ -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 @@ -32,7 +32,7 @@ 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. @@ -40,7 +40,7 @@ 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. @@ -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) @@ -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 @ @@ -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