siof package icon
dermagen/siof

wasi

Public
wasmer run dermagen/siof

SIOF (Scheme In One File)

SIOF is an interpreter for the Scheme programming language.

Scheme Compatibility

SIOF is mostly compatible with R7RS-small standard, but it has the following known limitations and deviations from the standard:

  • fixnums are 30 bit long, flonums are doubles
  • no support for bignums/rational/complex numbers
  • no support for Unicode; strings are 8-bit clean, use system locale
  • source code literals cannot be circular (R7RS allows this)

Some features of the R7RS-Small standard are not yet implemented or implemented in a simplified or non-conforming way:

  • read procedure is always case-sensitive (all ports operate in no-fold-case mode)
  • #!fold-case and #!no-fold-case directives are not supported
  • include and include-ci forms are not supported
  • get-environment-variable is implemented, but get-environment-variables is not
  • current-jiffy and jiffies-per-second return inexact integers
  • current-second is defined as C difftime(time(0), 0)+37
  • macroexpander treats _ as a regular identifier, not match-all pattern
  • macroexpander does not support (... escaped) pattern escapes
  • macroexpander does not support patterns with internal ellipsis and improper tail variable

Here are some details on SIOF's interactive Read-Eval-Print-Loop (REPL) and evaluation/libraries support:

  • read supports R7RS notation for circular structures, but both eval and load reject them
  • all supported R7RS-small forms are available in the built-in (sharpf base) library
  • -L command-line option extends library search path; initial path is ./
  • cond-expand checks against (features) and available libraries
  • environment dynamically fetches library definitions from .sld files
  • non-standard expand is available (macroexpands the argument)
  • eval, load, and expand accept optional environment argument
  • command-line file arguments are dynamically loaded
  • both import and define-library forms can be entered interactively into REPL
  • features procedure returns (r7rs exact-closed siof siof-1.0.2)

Please note that SIOF's interaction environment exposes bindings for all supported R7RS-small procedures and syntax forms directly, so there is no need to use import. In order to use import forms and environment procedure with R7RS-small libraries, you will need to copy the scheme folder with .sld files for the libraries from here to your local file system and make sure SIOF can locate it (its library search path contains current directory by default and can be extended with the help of -L command line option).

Origins

SIOF's original code is written in #F, a language for building Scheme-like systems. Please see SIOF github repository for more information about the project.

SIOF (Scheme In One File) is a minimal interpreter for R7RS Scheme programming language


Github