SLIDE Basic Syntax

White Space

Spaces, tabs, and new lines are all considered white space in a SLIDE file. One or more white space characters are used to separate tokens in a SLIDE file.

Comments

There are two ways of specifying comments in a SLIDE file. The first type is a simple line comment which is designated by the # symbol. When this character is encountered by the parser, all characters which follow it until the next new line will be ignored. For example:


# This is a line comment

The other type of comment is a region comment which is similar to comments in C. These comments regions are demarked by (* *). Unlike the C language, SLIDE region comments can be arbitrarily nested. The following are correct examples of region comments:


(* This is 
a region
comment *)

(* These (* are (* nested *) *) (* region *) comments *)

(* This will (* cause a nesting ERROR *)

Data Types

Type Examples BNF
Integers 10
$SLF_ON
$SLF_FRAME
[0-9]+
Floats 1
1.0
-1e-1
1.0E5
$SLF_PI
$SLF_TIME
[-]?([0-9]*[.])?[0-9]+([eE][-+]?[0-9]+)?
Tcl Macro Values %{ expr sin($SLF_PI/6) }% %{ <Tcl expr> }%
Tcl Dynamic Values { expr sin($SLF_TIME) } { <Tcl expr> }
Pairs 1.0 { expr 2.0 } float float
Triples { expr 1.0 } 2.0 %{ expr 3.0 }% float float float
Strings "This is sphere: \"s29\"" ["]([\]["]|.)*["]
Identifiers gLeft_Arm_3 [A-Za-z_][A-Za-z_0-9]*
Id Lists p0 p1 p2 id*
Paths cam
gCam.iCam.cam
gBody.iHead.iLeftEye.cam
(node_id[.](inst_id[.])+)?node_id

Integers

Integers are used for the enumerated values of the SLIDE flag types. Integers are also used as values for specific fields like the zslices field of the sphere primitive.

Floats

Most fields take floating point precision values. SLIDE follows the C conventions for representing floating point numbers.

Tcl Macro Values

Tcl macro values are abitrary Tcl expressions demarked by %{ }%. These values are computed exactly once during initialization and can be treated as floating point or integer constants.

Tcl Dynamic Values

Tcl dynamic values are abitrary Tcl expressions demarked by { }. These values are computed once per frame and can be treated as varying floating point or integer values.

Pairs

2D primitives, like windows and viewports, have fields which take a pair of floating point values separated by white space, like the size field.

Triples

3D primitives have fields which take a vector valued triple of floating point values separated by white space. An example is the coordinate vector of a SLIDE point.

Strings

Certain fields can take on C style string constant values. These string constants are contained within double quotation marks ("") where back-slashes (\) are used to escape special characters.

Identifiers

Most SLIDE primitives are given identifiers, so that other primitives can refer to them. These identifiers are defined by the same rules as C variable identifiers, where the name must begin with a letter or an underscore followed by zero or more letters, numbers, or underscores.

Id Lists

In SLIDE, references to other entities are usually made in identifier lists. This is simply a list of identifiers separated by white space. An example is the point id list in the face construct.

Paths

Paths are used to refer to a particular instance within a scene graph. It is not possible to use a single identifier because entities can be instanced multiple times. The only way to uniquely refer to a particular instance is by defining a traversal pathway down the directed acyclic graph (DAG) which is the scene graph. A path can be a single node identifier like cam. A path can also be the identifier of a node at which to begin the traversal followed by one or more instance identifiers which tell which branches to take along the traversal and terminated with the primitive's node identifier which can be used to verify the path (gBody.iHead.iLeftEye.cam).