Legal
Basic Syntax of Tcl
Introduction
Introduction
Before starting, let me warn you that although Tcl/Tk is an easy language to master, it is not so easy to learn. The syntax of this language is different from other popular languages like C, C++, Java, Perl etc. But if you manage to stay in the path and finish the race, the rewards are many.
Tcl stands for Tool Command Language. Tcl and Tk, its associated graphical user interface toolkit, was created by Professor John Ousterhout of the University of California, Berkeley.
First off, I would like you to pronounce the name correctly. Tcl is pronounced as 'Tickle' and not T-C-L. Ticklish, isn't it? But due to the force of habit, I still say it as T-C-L. Now, enough 'technical details'. Let's get on with studying the language.
Although Tcl works best in Unix/Linux, it has been ported for MS Windows and MacOS systems. I will only tell you how to install Tcl and run your programs in windows. If you have a Unix box, chances are that you already have Tcl and tk. They are available with all the major distributions. Anyway, I have provided some information about installing Tcl in Unix in the appendix.
Getting Tcl/Tk
Before any thing, get a copy of Tcl/Tk. It can be downloaded free from http://www.activestate.com/Products/ActiveTcl. The latest version(as of November 2004) is Tcl/Tk 8.4. Be sure to get the Windows installer version. There are Tcl interpreters for Unix, Windows, Mac etc. Be sure to get just what you want. Now install it in your system. In MS Windows all the tcl scripts will be associated with the tcl interpreter. After this you can run a tcl program by just double clicking on the script. In unix you can run your script by executing it or with the wish <FileName>
command.
If you are writing a tcl script, you can use any simple text editor like notepad. Make sure you save it with the '.tcl' extension. This is very important if you are using Windows. If you want a better editor, I would suggest Crimson Editor for windows and XEmacs for Unix/Linux. Both are available for free download from the net. Another good IDE for Tcl is ASED - This is programmed entirely in Tcl/Tk. For a big list of all editors for Tcl/Tk visit http://mini.net/tcl/TclEditors.