Version 25 of Tcl syntax

Updated 2016-03-29 16:54:37 by pooryorick

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

Summary

The syntax of Tcl scripts is minimal and elegant. Additional layers of complexity and power are achieved via commands, which either recursively repeat some or all of the Tcl script evaluation process.

Description

A Tcl script conforms to the 12 rules of script construction, and is processed in the following way:

  1. Exactly one level of substitution and/or evaluation occurs in each pass through the Tcl interpreter, no more and no less.
  2. Each character is scanned exactly once in each pass through the interpreter.
  3. Any well-formed list is also a well-formed command; if evaluated, each element of the list will become exactly one word of the command with no further substitutions.
  4. Commands such as subst and eval submit their arguments to the Tcl interpreter, which scans them again.

See:

"args" == ARGH! Are they _really_ good for anything? , Brent Welch, comp.lang.tcl, 1994-02-01

See Also

#
{*}
specifies that each item in a list should be considered an individual argument to the current command
BNF for Tcl
A parser's monolog
An indentation syntax for Tcl
Brace your expr-essions
comment
The various ways of commenting a script.
Dodekalogue
Glossary for Tcl syntax
Hunt for Tcl Extensional Equivalents
Is there a a decent tcl script for finding matching brackets?
Syntax parsing in Tcl
substitution
syntax
Static syntax analysis
Tcl Quoting
Why is Tcl syntax so weird
In a nutshell: Because it's new to you :)