Small languages (was Re: Lua, Lunatic and Python

Charles Steinkuehler charles at steinkuehler.net
Tue Dec 16 07:49:46 EST 2003


Paul Rubin wrote:
> claird at lairds.com (Cameron Laird) writes:
>> I think your decision in favor of Lua's a good one.  Guile and
>> Scheme, from the last I saw of them, are *not* slender enough to
>> compete.  Forth is the one other serious language that can be tiny
>> enough to make Lua look stout; while Forth hasn't made a good
>> impression on me as a "configuration language", that might reflect
>> my limits more than Forth's.
> 
> There are Scheme subsets like SIOD which are much smaller than either
> Guile or Lua.  Forth is a little bit too contorted for my tastes, but
> there was once an Emacs-like editor that used something close to it as
> an extension language.  PostScript, of course, also strongly resembles
> Forth.  A minimal Forth can be even smaller than SIOD, but SIOD is
> pretty small and I'd probably use something like it in preference to
> Forth in any but the tiniest environments.

I could be wrong, but it looks to me like SIOD requires a C runtime
library to function.  One of the big attractions of using Forth (at
least to me) is it's lack of reliance on a runtime library.  Direct
interfacing to the linux kernel should be possible in an
architecture-neutral manner, and the ~10K overhead of a Forth kernel is
very minimal when compared to the ~75K overhead of SIOD (from the
website) + the hundreds of KBytes (if not MegaBytes) of overhead for the
runtime C library.

The firewall oriented linux distribution I work with uses a shell-script
based linuxrc to build an initial root ramdisk.  Currently this requires
ash (~90K), busybox (~125K as configured), and ~625K for an old (and
smallish) version of glibc.

Using a forth-based solution to create the root ramdisk image would
drastically reduce the footprint of the initial ramdisk image, remove
reliance on a particular C runtime library (allowing folks to build
runtime root images based on uClibc, glibc, or whatever), and provide a
*VERY* powerful yet tiny runtime scripting/programming language for
extending the system.

The main utilities/functionality needed to bootstrap should be pretty
simple, likely 10-15 'standard' linux commands (like mkdir, mknod, tar,
gzip, etc), and a scripting language (forth itself).

I hope to get around to implementing something like this in Forth "one
of these days", but with 4-1/2 month old twins, my free time for
open-source projects has pretty much evaporated, so I'm sort of hoping
someone else beats me to it! :)

-- 
Charles Steinkuehler
charles at steinkuehler.net





More information about the Python-list mailing list