The ZPL compiler does not currently support separate compilation, so all ZPL code must reside in a single file (files may be included using the C pre-processor--see Section 9.1), but the compiler sees a single source file). The ZPL source file has the following syntax.
program Identifier ;The program's name, Identifier, must be a legal ZPL identifier (see Section 2.4.1). Declarations represents the set of globally defined config variables, constants, types and variables, as well as the program's directions and regions, which can only be defined at the global level. Declarations consist of any number of the following items in any order, where curly braces indicate an item that may be repeated zero or more times.Declarations
Procedures
1231TProcedures represent procedure declarations and procedure prototypes. The general form of a procedure body is shown below. A procedure prototype consists of just the ProcedureHeader.config var 12¯{EIdentifierT :E ListT config var Identifier : Type = Expression; {Identifier : Type = Expression;}
constant Identifier : SequentialType = Expression;
{Identifier : Type = Expression;}
type Identifier = Type;
{Identifier = Type;}
direction Identifier = [Vector];
{Identifier = [Vector];}
region Identifier = [DimensionList];
{Identifier = [DimensionList];}
var IdentifierList: Type;
{IdentifierList: Type;}
procedure Identifier ( { {var} IdentifierList: Type}) {: Type };The local variables (LocalVars) of a procedure have the same form as the global variable declarations shown above, and the body is simply a ZPL statement (typically a compound statement using the begin and end construct). Note that only variables can be defined local to a procedure. Constants, tyes, directions, or regions definitions are not allowed to be defined local to a procedure.LocalVars
Statement
One procedure must have the same name as the program name. This procedure is the program's entry point.