Packet Forth

About

Packet Forth (PF) is a scripting language for real-time video processing and graphics generation. PF is now quite stable and usable, but remains a bit of an odd duck in the land of open source video processing tools. I use it mainly as a prototyping tool for C-based signal processing.

PF is a concatenative programming language which takes ideas from Forth, Joy, PostScript, Factor, and Lisp. As opposed to its memetic parents, PF is not intended as a general purpose programming language, but a scripting language that glues together black box processing primitives and relevant open source libraries. PF is also heavily inspired by and can run as an extension of Pure Data by Miller Puckette.

As a language, its defining properties are a linear memory management model to improve locality for video processing (cache friendliness), and the use of dynamicly typed multiple dispatch (generic functions inspired by CLOS). The code base is a result of a long experimental evolution which started in 2002, and is somewhat idiosyncratic. It is written entirely in C. Its last major restructuring introduced primitives for select() based non-blocking I/O which is used to build a real-time multitasking engine based on a round-robin scheduler. Cleaning up the PF virtual machine and processing code, and generating most from a higher level description language is part of the objectives of the Staapl project. In the mean time I am working on simplifying the API and eliminating some unnecessary cleverness, making the code more homogeneous.

Download

Packet Forth is part of the zwizwa.be Debian unstable repository. Add the following line to your /etc/apt/sources.list
deb http://zwizwa.be/debian unstable main
and install the package with apt-get install packetforth. There are Debian packages for amd64 and i386. The latest source tarball can be found here. The tarball contains a debian/ directory so you can use dpkg-buildpackage -b to create a .deb for your architecture. For last minute changes, get the the darcs archive as darcs --get http://zwizwa.be/darcs/packetforth or using darcs pull to update your version.

Documentation

Check the examples in the demo/ directory. Alternatively, subscribe to the mailing list.

History

PF was forked from the Pure Data Packet (PDP) project somewhere in 2003. The PDP project started in fall 2002. The focus in the period 2006-2007 has been mainly on adding features for OpenGL based generative graphics, driven in large part by the requirements of the Metabiosis project, and on stabilizing and cleaning up the code base. Currently I use PF as a protyping environment for image processing code written in C.

The future of the PF implementation is a bit uncertain, but the language itself is considered stable. The way I see things now (September 2008), the core language part will probably be absorbed in Staapl, and the simplified glue layers for Linux media APIs will probably find a home in a C library to make them available to other projects; PF will shift more towards video processing: refocussing on the original goals after a 3 year excursion into OpenGL generative graphics. I am currently thinking about integrating PF with PLT Scheme, with an eye on integration with Fluxus.

In August 2009 I started working on a greatly simplified successor to the PF VM as part of libprim. This fixes problems with the memory and execution model, and makes the bridge to Scheme a lot more straightforward. Essentially the new interpreter has a linear core memory for stacks and lists just like old PF, but it is embedded in a GC managed graph memory that contains code and variable storage.

If you use it, send me a postcard. PF is written by Tom Schouten and released under the GPL v2.

Sat Aug 15 13:18:06 CEST 2009