Tcl syntax

Tcl's syntax is small enough to fit in the working memory of a typical human. -- Cameron Laird


The syntax of Tcl scripts is minimal and elegant. Additional layers of complexity and power are achieved via commands. Some commands pass one or more of their arguments to the interpreter for evaluation as a separate script. Other commands such as subst perform a subset of the steps performed to fully evaluate a script. Commands such as exec, expr, glob, and regexp implement their own little languages that are independent of the main interpreter. expr is particularly interesting because it is almost a superset of Tcl itself.

One of the distinguishing features of Tcl among string-based languages is that although it features substitutions, the substituted values are not themselves scanned for additional subsitutions. This gives Tcl a distincly different flavour than Unix shells or TeX.

Lists are a subject in their own right. Their syntax is that of Tcl, but without the dynamic features of substitution and command evaluation.

See Also

specifies that each item in a list should be considered an individual argument to the current command
"args" == ARGH! Are they _really_ good for anything? , Brent Welch, comp.lang.tcl, 1994-02-01
BNF for Tcl
A parser's monolog
An indentation syntax for Tcl
Brace your expr-essions
The various ways of commenting a script.
Rules of Tcl
The "official" rules.
Glossary for Tcl syntax
Hunt for Tcl Extensional Equivalents
Is there a a decent tcl script for finding matching brackets?
Syntax parsing in Tcl
Static syntax analysis
Tcl Quoting
Why is Tcl syntax so weird
In a nutshell: Because it's new to you :)