A Compiler for the Tcl Language

Adam Sah and Jon Blow
Computer Science Division
Electrical Engineering and Computer Sciences
University of California
Berkeley, CA 94720
(asah@cs.Berkeley.EDU, blojo@xcf.Berkeley.EDU)

May 24, 1993

Abstract:

Tcl is a highly dynamic language that is especially challenging to execute efficiently. The dual-language nature of the system enforced by the C callback mechanism makes traditional compilation and optimization unrealistic. In addition, the lack of formal data types (and therefore type checking) places severe limits on the ability to provide for efficient data storage at compile time. In this paper, we discuss the many issues involved with compiling Tcl, and present a design for such a system, including the mechanism for embedding a Tcl script into the compiler itself in order to provide user extensibility. The current implementation is presented along with results showing approximately ten times the performance of the existing Tcl interpreter.