The Tcl programming Language

The Tcl programming Language

Tcl (Tool Command Language) is a very powerful but easy to learn dynamic programming language, suitable for a very wide range of uses, including web and desktop applications, networking, administration, testing and many more. Open source and business-friendly, Tcl is a mature yet evolving language that is truly cross platform, easily deployed and highly extensible.

Tk is a graphical user interface toolkit that takes developing desktop applications to a higher level than conventional approaches. Tk is the standard GUI not only for Tcl, but for many other dynamic languages, and can produce rich, native applications that run unchanged across Windows, Mac OS X, Linux and more.

Here in Library Systems at The University of Chicago Tcl is already in use :

* as a general-purpose scripting language to write Unix applications;
* to automate login scripts for telnet connections;
* as the programming language for the Reserve System.

In addition, a number of our Unix applications are written in Tcl (see below), and Tcl is the programming language of the University of Chicago BSDAC Phoenix Project.

The Tcl/Tk developer community now numbers in the tens of thousands and there are thousands of Tcl applications in existence or under development. The application areas for Tcl and Tk cover virtually the entire spectrum of graphical and engineering applications, including computer-aided design, software development, testing, instrument control, scientific visualization, and multimedia. […] Tcl and Tk are being used by hundreds of companies, large and small, as well as universities and research laboratories.[1]

It provides all the usual high-level programming features that we’ve come to expect from languages like the Unix shell, Awk, Perl, or Rexx, such as:

* Variable-length strings
* Associative arrays
* Lists
* Keyed lists (aka structs, structures or records)
* Pattern matching with regular expressions
* Ability to define or redefine procedures at run-time
* Full file access
* Error handling

Tcl is a small language designed to be embedded in other applications (C programs for example) as a configuration and extension language. This minimizes the number of languages that users need to learn in order to configure their applications, and makes these applications programmable with no extra effort. In addition, Tcl is a complete and well-designed programming language, whereas many existing configuration languages were designed (to be kind) in an ad hoc manner.

An instruction is the name of a command (not a keyword) followed by a list of words separated by a whitespace, the arguments.
Statements end with the end of the line. They may be separated by a semi-colon on a same line.
Square brackets replace an argument by a command. These are so a substitution symbols.
The = sign is never used, the “set” command assigns a value to a variable:

set varname value

The { } serve for grouping, without subsitution.

# introduces a comment.

Control structures

The if command use two groups { }, the first for the condition, the second for the actions.

if { x < 10 }
puts “x less than 10”
The while command has the same syntax.

The definition starts with the proc command, plus the name and two groups for the arguments and the statements.

proc procname { arguments }

More Information and Tutorials on the TCL programming language can be

found on the TCL/TK website

Similar Posts:

Leave a Reply

Your email address will not be published.