Presentation
STklos (pronounced /ˈɛs.’ti.kl’ɔss/) is a free Scheme system mostly compliant with the language features defined in R⁷RS small. The aim of this implementation is to be fast as well as light. The implementation is based on an ad-hoc Virtual Machine.
The salient points of STklos are:
- an efficient and powerful object system based on CLOS
(Common Lisp Object System) providing
- Multiple Inheritance,
- Generic Functions,
- Multi-methods
- an efficient MOP (Meta Object Protocol)
- a simple to use module system, as well as R⁷RS libraries
- a full Numerical tower, as defined in R⁷RS,
- a simple FFI (Foreign Function Interface),
- an easy connection to the GTK+ toolkit,
- a Perl compatible regular expressions thanks to the PCRE package,
- Unicode support,
- native threads built on top of Posix threads,
- Tail Call Optimization, as required by R⁷RS,
- Support for a large number of SRFIs.
Latest News
Version “26.0” released 2026-02-10
Version numbering scheme changed: the first number corresponds to the year of the version. The number after dot is the rank of this version in the year (starting from 0).
This version principally enhances STklos performance: compiler is faster and, some Scheme primitives have been rewritten in C, several numerical primitives have been optimized (thanks to Jerônimo Pellegrini). As usual a bunch of new SRFIs have been implemented.
Contributors for this version:
- Jerônimo Pellegrini (@jpellegrini)
- Retropikzel (@Retropikzel)
Enhancements
Globally, everything is a bit faster:
- some often used list primitives have been rewritten in C
- Scheme object allocation uses now a pool of pre-allocatted cells
- compiler is faster
STklos can be compiled with
-std=c23Reader:
- Accept the Common Lisp syntax for complex numbers
- Accept symbols with a leading sharp character
- Use can define new read directives
- new directives
#!uvector-syntaxand#!no-uvector-syntaxto allow/forbid the reading of unifom vectors. - Skip characters until end of line when an error occurs in the REPL to avoid cascading errors.
- the behaviour of the reader can be customized when an opening angle bracket (or curly brace) is encountered.
VM:
- added specialized instruction for
pair?testing - added new instruction for
ifwithoutelse
- added specialized instruction for
evalcan now evaluate an expression in a local (rather global) environmentCorrect/enhance implementation of numerical functions in some corner cases (in particular with NaNs and infinities).
functions in R7RS libraries can be auto-loaded
Syntax:
- implement ellipsis escaping
- implementation enhancement of
let-syntaxanddefine-syntax syntax-rulesreturns now a matching function- implement vector patterns in
syntax-rules - change: syntax value cannot be used in an expression
- all fundamental forms are now syntax and can be redefined as required by R⁷RS (they were special forms before)
let-syntaxaccepts Scheme syntax as wall as Lisp like macros.
describehas been extended to give better information on certain object typesFFI:
- code has been enhanced and should be more secure.
- fixed precision problem between float and double
- permit to access array elements
Compiler
- some new optimizations
- enhanced the code rewriter.
Added support for the R7RS-large library
(scheme rlist)
Extensions
- GTklos extension (GTK+ bindings)
- a documentation has been added
- code rewriting and widgets are more coherent
- deleted GTK+ deprecated properties
- Library paths are guessed for system which do not install libraries in standard places
New primitives / parameter objects:
pair-immutable!c-size-ofcpointer-refcpointer-set!cpointer-ref/abscpointer-set/abs!symbol-interned?compiler-current-portincludes-use-load-pathreadline-startup-hookreadline-set-option!readline-bind!compiler:verify-assumeaccept-uvector-syntaxdefine-read-directiveread-bracket-handlerread-brace-handler
Updated embedded libraries
libffiupdated to version 3.5.2pcre2updated to version 10.46libgcupdated to version 8.2.12
New supported SRFI
- SRFI-101: Purely Functional Random-Access Pairs and Lists
- SRFI-234: Topological Sorting
- SRFI 239: Destructuring Lists
- SRFI-253: Data (Type-)Checking
- SRFI-225: Dictionnaries
- SRFI-258: Uninterned symbols
- SRFI-260: Generated Symbols
- SRFI-264: String Syntax for Scheme Regular Expressions
Misc:
- Updated documentation
- Better error messages
- Added tests
- Code cleaning and optimizations
- Bug fixes
Version “2.10” released 2024-10-10
This version of STklos mostly enhances the 2.00 version released a year ago. As usual, this version could not have be finalized without the help of Jeronimo Pellegrini (@jpellegrini).
Contributors for this version:
- Akinori Hattori (@hattya)
- Jeronimo Pellegrini (@jpellegrini)
Enhancements:
- Corrected the result of
stklos-config --compile - Added the second (optional) parameter to R7RS
load(andtry-load) - Enhanced various things about STklos compilation/installation
- Added information in the summary of configuration script
- Builds are now reproducible
- FFI support can be completely disabled, if needed.
- Updated GTklos, the GTK+ extension
- Optimize
exptprimitive. - Avoid unneeded boxing of numbers in the
+,-,*and/operations - Added
!as a shell escape under the REPL - Added statistics to the VM
- Permit to build STklos with the
tccC compiler. - Added an simple hybrid (C and Scheme) module in the examples directory
- Correct/enhance implementation of numerical functions in some corner cases (in particular with NaNs and infinities).
- Added an API to add expressions rewriting rules before their compilation.
- Location given in error message is more precise
- Error messages don’t loop anymore when displaying circular structures
- Added
list-set!as the setter function oflist-ref - Added the number of allocations and collections to the output of the
timeform - Added special instructions in the VM for
member,memqandmemv - Added special instructions in the VM for
assoc,assqandassv - Do constant folding before in-lining usual functions
- Better UTF-8 support and updated Unicode tables to version 16.0.0
- Enhance the
aproposprimitive - New REPL variables:
@*,@1,@2,@3,@4and@5 - New REPL commands:
time,describe,expand,import,require-feature,open,browse,manual,apropos - Documentation of a function can be accessed directly into the HTML Reeference Manual
- Length of symbols is no more limited.
New primitives / parameters:
read-cieval-form-string-ciread-from-sring-cicompiler:source-rewritecompiler:peephole-optimizer1+and1-push!andpopinc!anddec!dolistapropos/alistapropos/ppdefault-browseropen-in-browsermanualinstall-pathdefine-parameter
Updated embedded libraries
libgcupdated to version 8.2.8libffiupdated to version 3.4.6libpcre2updated to version 10.44
New supported SRFI
- SRFI-115: Scheme Regular Expressions
- SRFI-178: Bitvector library
- SRFI-232: Flexible curried procedures
Misc:
- Updated documentation
- Added tests
- Code cleaning an optimizations
- Bug fixes
Version “2.00” released 2023-09-12
This is a major version of STklos, bringing it from R5RS to R7RS. It is the fruit of nearly two years of development with the help of the following persons (in alphabetical order):
- Amirouche Boubekki (@amirouche)
- Lassi Kortela (@lassik)
- Ivan Maidanski (@ivmai)
- Tom Niget (@zdimension)
- Jeronimo Pellegrini (@jpellegrini)
- Ryan Schmidt (@ryandesign)
- Ben Taca (@bentaca)
- Robby Zambito (@Zambito1)
The main changes in this version are:
- Support for R⁷RS libraries
- Macro system has been rewritten
- Support for ScmPkg packages has been suppressed
- New options for the commands stklos(1) and stklos-compile(1)
- Optimizations on numerical operations
- Documentation is rewritten in
asciidoctorand has been greatly enhanced - Updated the Docker build files
- New instructions in the VM
- Fixed some issues in the compilation/installation procedure
- New extension:
curlto access the multiprotocol file transfer library - Better support for macOS
describehas been enhanced for some type of objects- REPL has now tab completion
- Bash and zsh completions for
stklosandstklos-compilecommands - Better
SLIBsupport - Use PCRE2 library instead of legacy PCRE
- New-command
stklos-pp(1) - Better error messages
- New SRFIS supported
- SRFI-19: Time Data Types and Procedures
- SRFI 43: Vector Library
- SRFI-95: Sorting and Merging
- SRFI 116: Immutable List Library
- SRFI 125: Intermediate hash tables
- SRFI-138: Compiling Scheme programs to executables
- SRFI 152: String Library (reduced)
- SRFI-162: Comparators sublibrary
- SRFI 154: First-class dynamic extents
- SRFI-215: Central Log Exchange
- SRFI 217: Integer Sets
- SRFI 222: Compound objects
- SRFI 224: Integer Mappings
- SRFI-227: Optional Arguments
- SRFI 228: Composing Comparators
- SRFI-229: Tagged Procedures
- SRFI-230: Atomic Operations
- SRFI 235: Combinators
- SRFI 236: Evaluating expressions in an unspecified order
- SRFI-238: Codesets
- SRFI 244: Multiple-value Definitions
- Added support for some R7RS-large libraries
- supported libraries of the Red edition are
(scheme bytevector)(scheme box)(scheme charset)(scheme comparator)(scheme generator)(scheme hash-table)(scheme ideque)(scheme ilist)(scheme list)(scheme list-queue)(scheme lseq)(scheme set)(scheme sort)(scheme stream)(scheme text)(scheme vector)
- supported libraries of the Tangerine edition are
(scheme bitwise)(scheme bytevector)(scheme division)(scheme fixnum)(scheme flonum)(scheme generator)(scheme vector @)
- supported libraries of the Red edition are
- New primitives
library-namelibrary-listmodule-listmodule-lock!module-locked?symbol-mutable?define-constantcpointer-null?syntax-errorhash-table-clear!environementsend-signalset-signal-handler!get-signal-handlervoid?procedure-sourceprocedure-formalsshort-versionradians->degreesdegrees->radianssinh,cosh, …
- New compiler options (also parameter objects):
compiler:gen-line-numbercompiler:show-assembly-codecompiler:time-displaycompiler:keep-formalscompiler-keep-sourcecompiler:inline-common-functionscompiler:unroll-iterationsrepl-show-startup-message
- New predefined classes
<uvector><bytevector><hash-table><port><input-port><output-port>
- Code cleaning an optimizations
- Added tests
- Bug fixes