Scripting with C
While we generally think of C as the prototype industrial language -- hard-edged, high-performance, and dangerous -- numerous projects have attempted to wrap C in a more amiable package. Some were developed more than 20 years ago. Among the survivors still in production are:
Our survey excludes interpreters not generally available for Unix systems (such as QNC and Think C), those with limited interactivity (the UPS C interpreter), and interpreters that are moribund. We found software product catalogs listing C interpreters that have been orphaned for several years, but all the following systems are in active development.
"CINT covers about 95 percent of ANSI C and 85 percent of C++," including its own source code, according to CINT's homepage. CERN, the same international physics laboratory that employed Tim Berners-Lee as he designed the original World Wide Web, currently sponsors CINT.
Masaharu Goto wrote CINT in 1991 while employed by Hewlett-Packard Japan. Now an engineer with Agilent, HP's original testing and measurement business, which HP spun off late last year, he continues his development of CINT.
In 1995, Rene Brun and Fons Rademakers launched the ROOT project at CERN to introduce physicists quickly to the new world of Objects and C++ and to improve their productivity with large-scale data analysis and simulation. After comparison with candidates such as Tcl/Tk and Python, Rademakers and Brun selected CINT in 1996 for ROOT. Like CINT, ROOT is an open source project. CERN uses ROOT to structure analysis of the output from, as Bruns explains, "large Hadron Collider (LHC) experiments that will generate about ten petabytes of data per year in 2005. ROOT is being used in several hundred [particle physics] labs in the world and also in many nonscientific applications that have to analyze very large amounts of data." Finance is one area outside physics where CINT is known to be in production.
ROOT's sponsorship has encouraged CINT to support more of the C++ standard as well as extended runtime-type information, templates, and the robustness essential for interactive operation. "The next phase starting this fall will see major extensions to provide a parallel and distributed data analysis environment in the context of GRID projects both in Europe and in the US," Brun concludes.
CINT is available for most Unixes as well as Win NT. Among interesting recent CINT developments is RDBS, which interfaces to ODBC the way JDBC does.
"EiC is designed to be a production tool...one of the most complete, freely available C interpreters built to date," writes Edmond J. Breen on the EiC homepage. He's been largely successful: EiC is even getting favorable mention in publications such as Linux Magazine.
Breen designed EiC for easy portability and flexibility between interactive, batch, and embedded applications. EiC includes packaging mechanisms that simplify deployment and convenient mechanisms for interfacing foreign functions. Working programmers welcome its good diagnostics for array violations and other exceptions.
Furthermore, EiC is quite portable. Versions are available for all common platforms, including a recent port to the EPOC-based Psion handhelds. Many EiC developers use it for Web-based applications, and among available modules are those for MySQL and OpenGL. The EiC Website offers useful details about the language and supports three active EiC-related mailing lists.
Among Breen's plans for the near future is C99 compatibility. At the same time, EiC's portability presents one of his most serious, continuing challenges. He will need to recruit others to help with EiC ports so that he can concentrate on the Linux release, while volunteers maintain the generation apparatus specific to the Windows, Solaris, and other versions.
ElastiC is a bit of an outlier among the languages mentioned here. The others mostly have the semantics of C, with relatively minor variations. Marco Pantaleoni's interpreter, by contrast, is more ambitious and challenging. While its syntax is familiar to anyone who knows C, he uses that syntax to express Smalltalk-like metaprogramming, seasoned with closures, object orientation, and other concepts familiar in languages such as Scheme and Python.
ElastiC is younger than the other implementations mentioned here and is more concerned with getting its design right than with details of database extensions or Web-oriented conveniences. However, Pantaleoni, an engineer for Linuxcare Italia spa, appears to have given ElastiC a sound foundation. Furthermore, its footprint is small enough to invite embedding, and the code appears to be quite efficient and high in performance. It's already SWIGgable, and Pantaleoni offers GTK and inet modules. While the code is clean, it appears to have been ported only as far as the leading Unixes and Windows.
We devoted the April 1999 Regular Expressions column to ICI. Since then, that C-like, high-level language has appeared in a version 2.1.4, and plans were published this month for 3.0. The biggest news of the summer was relocation of the working sources to a SourceForge CVS store. "This means everyone can get up-to-date copies of the interpreter source code," according to ICI's Website.
GTK is one of ICI's newest modules. Early work on 3.0 handles Unix-style signals. One of ICI's distinctions is the prominence of its deployment; several Canon photographic products embed instances of ICI.
The LPC homepage asserts that LPC is a "small, object oriented type C language developed by Lars Pensjö for LP-MUD, a Multi-User Dungeon environment under many Unix systems." LPC scripts typically include rooms, weapons, players, and capabilities. LPC cheerfully specializes in MUDding and appears to support an active community of users.
LPC is also important for indirectly beating the best-known Web daemons. It's widely but erroneously believed that Apache is the top-performing Web server. Not only are there faster Web daemons, but one of them is open sourced, almost as portable as Apache, and arguably more extensible.
The Roxen platform combines all those virtues and the base for its achievements is its coding in the Pike-interpreted language. We covered Roxen and Pike in the mid-November 1999 installment of Regular Expressions. Roxen Internet Software AB, the Swedish corporation behind Pike, just revamped its Website at the beginning of August 2000.
LPC inspired the first version of Pike in 1994, although creator Fredrik Hübinette and his colleagues didn't settle on the name until 1996.
PiGTK currently supports GTK 1.1, and builds in support for networking protocols such as DNS, IMAP, SMTP, HTTP, LDAP, and X.
The programming world is a rich place -- even if you restrict yourself to C and its closest variants, you can have Dylan's algorithmic depth, the interactivity of Python or Tcl, or Perl's evangelically helpful error handling. Any of the above-mentioned C interpreters are sufficiently robust to support production applications, all are available at no charge, and you already know their syntax and runtime libraries (with a few specific exceptions). Take them out for a test-drive. Enjoy.