Overview


GRIP Programs

GRIP programs consist of three main parts: declarations, statements, and termination.

Declarations consist of four specialized words (ENTITY, STRING, NUMBER, DATA) which are used to define variables and default values for use in the statement part of a program. These words reserve space where objects, numerical values, and characters can be stored when they are assigned to the defined variables. For example, if you want to define a variable to which you want to assign a string 30 characters long, you must declare the variable using the word STRING as follows:

STRING/STR(30)

The statements part of a program consists of the GRIP statements used to perform the program function(s). The most common use of GRIP is to create and manipulate geometry.

Example

The following example creates four lines to form a box. The program contains the declaration of the variables (LN1,LN2,LN3,LN4) that the created lines are assigned to, and the statements to create them.

This program creates the same box, no matter how many times it is run because the numerical values which define its shape are "hard coded" in the statements. You can use GRIP programming techniques to replace the hard coded values with variables. This would allow this program to create any shape of box based on the value of the variables.

ENTITY/LN1,LN2,LN3,LN4
LN1=LINE/0,0,0,2,0,0
LN2=LINE/2,0,0,2,2,0
LN3=LINE/2,2,0,0,2,0
LN4=LINE/0,2,0,0,0,0

HALT Statement

To complete the program, it must be properly terminated. Every GRIP program must contain the HALT statement.

ENTITY/LN1,LN2,LN3,LN4
LN1=LINE/0,0,0,2,0,0
LN2=LINE/2,0,0,2,2,0
LN3=LINE/2,2,0,0,2,0
LN4=LINE/0,2,0,0,0,0
HALT