Small Tcl

Do you want a particularly small version of Tcl to embed in a hardware-constrained device? You're not the first. There are a few possibilities listed in the Implementations section of this page.

Background

While John Ousterhout originally created Tcl as exactly an embeddable extension language [include some history here], it's grown into a general-purpose programming language. That growth has, of course, increased its demands on memory and the C run-time library. Key transitions along the way include ... the introduction of socket (7.5 or 7.6) ... the new object system (8.0), and Unicode (8.1-8.3). Versions such as 6.7, 7.2, 7.3, and 7.4 are popular among those content with a minimalistic Tcl. More on these transitions is available in a page called "Advantages and disadvantages of different Tcl versions".

There are many other less well-known languages especially targeted for embedding. Lua [L1 ] is probably the most prominent of these (and a subject of several experiments by JCW, for example). Another that interests CL is Ficl [L2 ]. All such languages generally fit in under 100K--quite a bit smaller than recent Tcl.

Donal Fellows and others have thought about this opportunity in terms of MicroTcl for Tcl9. A "modularized Tcl" is a goal that's inspired several project starts, none of which are particularly accessible in 2001. Tcl9 might still turn out to be a modularized Tcl, that is, one for which compile-time code and functionality choices are reasonably easy.

See also

Implementations

Jim Tcl

Jim is a small footprint implementation of the Tcl programming language (full binary is around 70kb but can be reduced further), it's not based on an old version of Tcl, but was developed from scratch. Already includes features of Tcl 8.5 like dicts, {*}, as well as new extensions currently not present in Tcl 8.5, like closures, lambda with garbage collection, and the ability to build arbitrary linked data structures.

Jim is in active development as of Jan 2016

Tiny Tcl (6.8)

Karl Lehenbauer has implemented a ROMable "Tiny Tcl" [L3 ] based on 6.8, to be particularly small.

2001-05-07: Tiny Tcl 6.8 is a rommable, minimal Tcl for embedded applications.

Derived from the venerable Tcl 6.7 release, Tiny Tcl 6.8 has a solid Tcl feature set, excluding newer capabilities of Tcl 7 and 8 such as the bytecode compiler, namespaces, sockets, and async event handling, among others. (Still, major applications have been written in Tcl 6.)

Excluding C library functions, Tiny Tcl compiles down to less than 60 Kbytes on most machines, far smaller than any Tcl 7 or Tcl 8 derivatives. On an embedded DOS system with 640K of RAM, programs of up to several thousand lines of code can be executed.

http://tinytcl.sourceforge.net/

An updated version of TinyTcl is included in the uClinux distribution [L4 ]

TinyTcl is not actively developed since Apr 2001

TinyTcl

Jean-Claude Wippler re-implemented most of a modern (7.6-like?) Tcl in a particularly compact C++ coding he calls TinyTcl [L5 ].

TinyTcl is not actively developed since Jan 1999

Cricket

Larry Smith wrote "Cricket" [L6 ] as a "tiny little interpreter" reminiscent of Tcl - It uses [ and ] for command dispatch as in Tcl, and ( and ) for "second argument dispatch" - allowing one to code, for example (a := $b). The ctools package [L7 ] includes "Tinker", a tiny tcl interpreter without (). (these links are dead, sadly) He and RS co-authored the "Lightweight Object System for Tcl" LOST and MOST which uses Tequila for distributed LOST objects, which is small, but on top of regular Tcl's.

Palm Tcl

John Hall's port of 7.4 to PalmOS [L8 ] (bad link) is still another instance of a "small Tcl". Try http://rivendell.sourcefubar.net/ for John Hall's code.

APN has written Palm TCL at http://home.earthlink.net/~ashoknadkarni/ (now moved to http://palm-tcl.sf.net/ ) ; based on Tcl 7.6, it provides support for many Palm widgets and rudimentary support for the Palm databases. Runs on a 8K stack.

Picol

See Picol.

Ettcl

ETLinux [L9 ] is a small-footprint LINUX (2MB RAM, 2 MB disk) for embedded systems with a small Tcl interpreter built in, Ettcl.

MicroTcl (Nebula Device)

MicroTcl is part of the Nebula Device [L10 ]. This is a stripped down Tcl8.4 version with 36 core Tcl commands only. No file io, networking, background jobs, event handling etc. It does not need any external runtime environment files. It can be linked statically into the application and has a code size of about 160KB.

Hecl

Tcl's close cousin, Hecl, fits into a .jar file of less than 64K, including persistent storage, an 'lcdui' gui, and an http command.

NanoCL

[L11 ]

LIL

See LIL.

szl

szl is a scripting language heavily inspired by Tcl and shell. It began its life as a pet project: a clean-room, partial re-implementation of jimtcl, for self-education purposes. However, quickly enough, as more and more new ideas were translated into code, szl evolved into a much different beast.

TH1

AMG: TH1 is a small Tcl implementation embedded in Fossil to supply scripting capability, particularly in service of the web interface.

ParTcl

See ParTcl.

nimiTCL

A minimal Tcl interpreter in Nim. Inspired by and similar to ParTcl and Picol. [L12 ]