GNU TeXmacsUser manualReferenceAboutEnglish
The femtolisp Scheme interpreter

TeXmacs runs its Scheme code on one of three interpreters, chosen when it is built: Guile, S7 or femtolisp. This chapter is for the developers who maintain the femtolisp one: how it is put together, what it relies on, how to change it and how to find what goes wrong.

femtolisp is a small Lisp close to Scheme, by Jeff Bezanson, with a compiler to bytecode written in Lisp and a copying garbage collector. Its sources are in the tree, with the local patches: a build with femtolisp needs nothing else. It is about a sixth of the size of S7, in lines of source, and as fast or faster once the code is loaded.

1.Building and running

./configure --with-scheme=femtolisp
make

With CMake the option is -DSCHEME_IMPL=femtolisp (not tested yet); for the browser version, see femtolisp in the browser. The choice defines USE_FEMTOLISP and compiles the directory

src/Scheme/Femtolisp

. In Scheme, (femtolisp-scheme?) tells that the interpreter is femtolisp, as (s7-scheme?) does for S7.

2.Where things are

src/Scheme/Femtolisp/femtolisp/

femtolisp itself, with the local patches applied: its C sources, its library llt, its compiler and standard library (system.lsp, compiler.lsp) and the boot image made from them (flisp.boot).

src/Scheme/Femtolisp/patches/

The local patches, in order, as git format-patch writes them.

src/Scheme/Femtolisp/fl_core.c
,
fl_llt.c

The two compilation units: femtolisp and its C interface for TeXmacs, and the library llt.

src/Scheme/Femtolisp/fl_tm.h

The C interface, the only header of femtolisp which the C++ code includes.

src/Scheme/Femtolisp/femtolisp_tm.hpp
,
femtolisp_tm.cpp

The interface of the Scheme interpreters of TeXmacs (tmscm) on femtolisp, as S7/s7_tm.* and Guile/guile_tm.*.

src/Scheme/Femtolisp/fl_boot.h

The boot image as a C array, made by

make-boot-header.sh

.

TeXmacs/progs/init-femtolisp.scm

The first Scheme file loaded. It loads the two files below and the module of the third, then the

init-kernel.scm

and

init-texmacs.scm

of all the interpreters.

TeXmacs/progs/kernel/boot/r5rs-femtolisp.scm

R5RS and the basic functions of Guile, defined on femtolisp.

TeXmacs/progs/kernel/boot/boot-femtolisp.scm

The modules, the loading of files, the lazy function bodies and the caches of compiled code.

TeXmacs/progs/kernel/boot/compat-femtolisp.scm

The library functions of Guile (hash tables, lists, strings…), as a module.

docs/femtolisp/

The working notes: the measurements, the history of the decisions.

3.The main ideas

4.The chapters

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".