Neatware Company

An ISV for Mobile, Cloud, and Video Technologies and Software.

Syntax

The syntax of mCL is similar to Tcl that consists of variable, command, substitution and grouping.

A variable is represented as a string of case sensitive leters, numbers, and underscore bars. You can use a variable without declaring its type. You can also assign a value to a variable. Finally, you can get a variable value by substitution.

A command of mCL has the format

  command argument1 argument2 ... 

where command is a buildin or a defined procedure in the mCL. Spaces separate a command name and its arguments in a line. Newline and semicolons are command terminators. Each command has a return value. To evaluate a command, interprter substitutes command arguments from left to right, which makes a single passing substitution, and then executes the command. For example, the set command assigns a string "foo bar" to the variable var.

  set var "foo bar"

A command name could be a variable as well. Usually a variable command name used to represent an object. For example,

  set app [MCL::application]
  $app create
  $app run

where app is an application object of mCL. app is a variable to represent the object and $app gets the variable value. $app then creates an real D3D environment object and starts to run it.

There are variable and command substitution

Dollar sign $ enables variable substitution. It replaces the variable with its value. ${variable} will be useful to distinguish from other special characters.

  set x $var 

Square brackets [] enable command substitution. A command must be inside the brackets. After evaluation of the command, the return value will replace the square bracket string. The brackets maybe nested. Following command returns an expression value.

  [expr sin(x)*(a+b)] 

Backslash \ enables next character substitution. The next character or group after the backslash will be replaced by a new representation of the character. Usually backslash \ is widely used to quote a specific character. For example, the " inside a pair of "" should be substituted by \".

  "inside double quote \" "
  "newline \n and tab \t "

Grouping collects several items as one item

Double quote "" grouping enables inside string substitution. The " character inside the double quote must be disabled with the backslash \" quoting. The grouping value of double quotes is the string inside after substitution.

  "dobule quote enable variable substitution {$variable} 
   and command substitution [clock seconds]" 

Curly braces { } grouping disables substitution inside. All the characters include whitespace, double quotes, even nested curly braces (exclude outmost curly braces) are value of the group. When curly braces are inside the double quote, they will not work as grouping.

  {curly braces disable variable substitution {$variable} 
   and command substitution [clock seconds]}