Skip to content

fujita-y/ypsilon

Repository files navigation

Ypsilon: R7RS/R6RS Scheme Implementation

  • Conforms to R7RS/R6RS

  • Mostly concurrent garbage collector optimized for multi-core processor

  • Incremental native code generation with background compilation threads

  • On-the-fly FFI with native stub code generation

  • Full features of R6RS and R6RS standard libraries including:

    • arbitrary precision integer arithmetic
    • rational number
    • exact and inexact complex number
    • top-level program
    • proper tail recursion
    • call/cc and dynamic wind
    • unicode
    • bytevectors
    • records
    • exceptions and conditions
    • i/o
    • syntax-case
    • hashtables
    • enumerations
  • Full features of R7RS-small and following R7RS-large libraries:

    • (scheme comparator)
    • (scheme hash-table)
    • (scheme list)
    • (scheme sort)
  • See LICENSE for terms and conditions of use.

Performance

Documents

Requirements

  • LLVM 10, 11, 12, 13, 14, or 15

Installation

mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
cmake --install .
  • On MacOS, you may want using Homebrew to install LLVM 15.
brew update
brew install llvm
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc

Optional

  • You may want using rlwrap to make the REPL easier to use.
# Ubuntu 21.04
apt install rlwrap
# Homebrew on MacOS
brew install rlwrap

Run

  • To run R7RS sample script, try following from project root:
ypsilon --r7rs test/r7rs-sample.scm
  • To run FFI demo program, try follwing from project root:
ypsilon --r6rs --top-level-program demo/glut-demo.scm # (OpenGL 1.x, GLUT)
ypsilon --r6rs --top-level-program demo/glfw-demo.scm # (OpenGL 1.x, GLFW)
ypsilon --r6rs --top-level-program demo/glcorearb-demo.scm # (OpenGL Core Profile, GLFW)
ypsilon --r6rs --top-level-program demo/freetype-demo.scm # (OpenGL Core Profile, GLFW, freetype)
ypsilon --r6rs --top-level-program demo/widget-demo.scm # (OpenGL Core Profile, GLFW, freetype)

Docker

$ docker run --rm -it fujitay/ypsilon:latest ypsilon --r7rs
ypsilon-2.0.8 (r7rs)
> (magnitude 3/22+2/11i)
5/22
> (exit)

Packages

Packaging status

Notes

  • REPL start with (import (scheme base) (scheme process-context)) or (import (rnrs base) (rnrs programs)) depending on the command line options specified.
  • Without --top-level-program option, the contents of the specified script file will be interpreted as if they had been entered into the REPL.

Rebuild heap files

  • Open 'src/core.h' and set 'UNBOUND_GLOC_RETURN_UNSPEC' to '1'
  • make
  • Edit .scm files in 'heap/boot' directory
  • cd heap; make; cd ..; make; cd heap; make; cd ..
  • Open 'src/core.h' and set 'UNBOUND_GLOC_RETURN_UNSPEC' to '0'
  • make

Versions

  • Ypsilon version 2 have major design changes. Former version is available at version-0.9.
  • This project is migrated from code.google.com/p/ypsilon