MPL Documentation

Reserved Keywords

Every programming language has reserved keywords, these make the base grammar of the language. Tokens are the smallest meaningful units of text in a program. They are categorized as special symbols, identifiers, labels, numbers, and string constants. A Pascal program is made up of tokens and separators. A separator is either a blank or a comment. Two adjacent tokens must be separated by one or more separators if each token is a reserved word, an identifier, a label, or a number.

Directive Description
 and  (Logical) boolean operator requiring both conditions are true for the result to be true
 begin  start of a block of code
 break  exit a case statement, or a loop
 case  select a particular segment of code to execute based on a value
 class  A class can be seen as a pointer to an object, or a pointer to a record, with methods associated with it
 const  declare an identifier with a fixed value, or a variable with an initialized value
 continue  skips an iteration in a loop and starts execution at the beginning of the loop
 dispose  free dynamically allocated memory, allocated by new
 div  integer divide operator
 do  used to indicate start of a for/while loop
 downto  used in a for loop to indicate the index variable is decremented
 else  used in if statement to provide an execution path when the if test fails
 end  end of a block of code, or the end of a record or class construct
 except  exception handling block
 exit  exit current subroutine
 false  boolean value indicating a test failed; opposite of true
 file  external data structure, typically used for binary/block access
 finally  code ran if no exception occurs, or an exit command first executes all statements in the finally blocks before actually exiting
 for  loop used to increment or decrement a control variable
 forward  method declared without its implementation as the definition is needed before it can be implemented
 freemem  returns a previously requested chunk of memory to the operating system
 function  define a routine that returns a result value
 getmem  request a chunk of memory to be reserved for your application
 goto  used to exit a segment of code and jump to another point
 if  test a condition and perform a set of instructions based on the result
 in  identifies elements in a collection
 inherited  used to call the parent class' implementation of the virtual method
 inline  copy of this code is inserted directly into the calling routine
 label  defines the target jump point for a goto
 mod  operator used to return the remainder of an integer division
 new  dynamically allocate memory for variable, old days you needed heap allocation
 nil  pointer value indicating the pointer does not contain a value
 not  boolean operator that negates the result of a test
 of  defines the characteristics of a case variable
 or  boolean operator which allows either of two choices to be used
 out  declare variable parameter to ignores the original value and only push out the result
 procedure  define a routine that does not return a result value
 program  defines start of an application. This keyword is optional
 record  group a series of variables under a single name
 repeat  loop through a block of code to an until statement, repeating as long as the result of the until test is not true
 self  used in instance methods to refer to the object on which the currently executing method has been invoked
 set  group an enumerator collection
 text  used to read from and write to a text file
 then  indicates start of code in an if test
 to  indicates a for variable maximum value to be incremented
 true  boolean value indicating a test succeeded; opposite of false
 try  the following block of code is doing exception trapping handled by except and/or finally
 type  declares kinds of records or new classes of variables
 until  indicates end of a repeat statement, where the test condition is tested to allow the code to repeat again
 uses  lists built-in units this program refers to
 var  declare variables
 while  test condition and if true, loop through a section of code, until not true
 with  reference the internal variables within a record or class without having to refer to the record or class itself
 xor  boolean operator used to invert an or test

Unsupported Turbo Pascal Reserved Keywords

Directive Description
 absolute  Modern Pascal uses pointers instead of var type absolute
 asm  Modern Pascal does not support inline assembly
 assembler  Modern Pascal does not support inline assembly
 constructor  Modern Pascal uses the keyword Procedure instead of Constructor
 destructor  Modern Pascal uses the keyword Procedure instead of Destructor
 far  This is only required in 16bit DOS, which we do not support
 file of type  Modern Pascal supports binary files without "of type", just file
 near  This is only required in 16bit DOS, which we do not support