Actions the Compiler Performs

Compiler Checks Spelling and Syntax

The compiler analyzes the program to determine if the statements conform to GRIP programming rules. The program must be syntactically and logically correct. All GRIP major and minor words must be spelled correctly. For example, the major word in the following statement is misspelled:

CR1=CRCLE/0,0,3

The syntax of the following LINE statement is incorrect. If you are defining a line by specifying the coordinates of its end points, you would receive a syntax error if you entered only three numerical values.

LN1=LINE/0,0,1

Compiler Also Checks Logic

The program must also be logically correct. For example, you must declare an object variable before you use it. If you attempt to use an undeclared object variable, or use an object variable which is out of the range of an object array, you receive an error in the compiler. In the following program, L(3) and CR1 are not declared:

ENTITY/L(2)
L(1)=LINE/0,0,1,0
L(2)=LINE/0,1,1,1
L(3)=LINE/1,1,2,3
CR1=CIRCLE/0,0,2

The compiler listing would resemble the following:

Sample Compiler Error Listing

You receive an error in the program above because L(3) is out of the range of the declared object array L(2). You also receive an error because CR1 is not declared as an object variable.

Be Sure to Use the Proper Commands and Symbols

Be careful when setting GPA values. For example, the following is correct and compiles:

&ERRMOD=&CONTIN

But if you incorrectly typed in:

&ERRMOD=&CONT

the compiler would not catch it, as &CONT is a GPA used in GRIP NC. If you had instead accidentally typed in

&ERRMOD=&CONGA

the compiler would catch the error, as &CONGA is not a valid GPA.