Tcl Command Parser
Tcl parser first process the line into Tcl tokens/words.
Then the words are evaluated right to left using the rules we reviewed in previous page.
After evaluating all the words, the first (leftmost) word/command is evaluated and the result of this command is returned.
Each command is implemented using a C procedure. This means each Tcl command line may invoke 1 or more C procedures in its evaluation.
Example: This short program below assigns values to variables a, b and c. The value assigned to variable a is "World!". The value assigned to variable b is "Hello World!", and the value assigned to variable c is "Hell" (only first four letters of variable b).
set a "World !"
set b "Hello $a"
set c [string range $b 0 3]
Note: Tcl is a case sensitive.
Command Terminator:
Normally a "new line" terminates a Command or Statement.
Use "\" to write commands which are longer than a line
Example:
set c [string range $b \
0 3]
is the same as
set c [string range $b 0 3]