Supported types

Language reference ››
Parent Previous Next

See also: the $INITIALIZE directive, EEPROM memory allocation, Records


PMP supports the following variable types (types after a | sign are aliases):


Note 1: Strings are always implemented as an array of bytes; the first byte at index 0 contains the effective length of the string, while next bytes contains the characters of the string.

Note 2: The standard IEEE 64-bit DOUBLE format is not supported.

NEW! (V2.1): In extended syntax mode, an initialized ARRAY variable may be declared without bounds, as for a constant array. The actual bounds will be 0..(<number-of-elements> - 1).


PMP is a single pass compiler. Variables must be declared prior to their use.

Variables declared within procedures or functions are local.

Variables declared in a unit interface section are global to other units and to the main program.

Variables declared in the main program are local to the main program.

By default variables without an explicit initial value are NOT initialized by PMP; this task is left to the programmer (see the CLR - Clear a variable built-in procedure). Nevertheless a special directive may be used to force variables initialization at startup, see the $INITIALIZE directive.


Some examples:



CONST
 AnArrayMax = 2;

VAR
 AnArray: ARRAY[-2 .. AnArrayMax] OF BYTE; { boundaries may be negative }
 {$SPACE EEPROM} // next in EEPROM
 EE_BYTE_1, EE_BYTE_2: BYTE;
 EE_BYTE_3: BYTE = 123; { EE simple variable with an initial value }
 EEArray: ARRAY[1 .. 2] OF BYTE = (100, 200); { EE arrays may have initial values }
 {$SPACE RAM} // next in RAM
 RAMArray1: ARRAY[1 .. 2] OF BYTE = (100, 200); { New in V2: RAM variables may have initial values }
 RAMArray2: ARRAY OF BYTE = (100, 200); { New in V2.1: RAM array variables with initial values may be declared without bounds }
 MyString: STRING; { defaults to 16 characters wide (see $STRINGS), so it uses 17 bytes }
 MyString2: STRING[4]; { 4 characters string, using 5 bytes. }
 EE_BYTE_4: EEPROM BYTE; { Single EE simple variable: the EEPROM keyword overrides the $SPACE RAM }

TYPE
 tMyRecord = RECORD
   X, Y: BYTE;
   B1, B2: BOOLEAN;
 END;

VAR
 MyRecord: tMyRecord;