What are statements?

The statements in a program are the executable part of the program (i.e. when executed they perform the program's actions). Currently, all programs created by Irie Pascal have a single thread of execution, so only one statement can be executed at a time. Usually, the statements in a program are executed in the order in which they occur in the text of the program However some statements can change the order in which the statements in a program are executed, cause some statements not to be executed at all, or cause some statements to be executed more than once.

Pascal programs always begin executing at the first statement in the main program block.

Statements can be grouped in a number of ways. For example statements can be separated into two groups, simple statement and structured statements, where simple statements are statements that do not contain other statements, while structured statements are statements that do contain other statements. Statements can also be grouped according to the kind of action they perform, such as conditional statements and repetitive statements. Conditional statements allow programs to make decisions (i.e. they test a particular condition and transfer program execution depending on the result). Repetitive statements allow the program to loop (i.e. transfer program execution to the same statement or statements repeatedly).

Labels can be placed in front of statements to mark them as targets for goto statements. As an extension to Standard Pascal, Irie Pascal allows labels to be identifiers as well as sequences of digits.

The statements are:


(NOTE: for clarity some parts of the syntax are omitted, see Irie Pascal Grammar for the full syntax):

   statement = [ label ':' ] ( simple-statement | structured-statement )

   actual-parameter = expression | variable-access |
       procedure-identifier | function-identifier

   actual-parameter-list = '(' actual-parameter { ',' actual-parameter } ')'

   assignment-statement = assignment-statement-lhs ':=' expression

   assignment-statement-lhs = variable-access | function-identifier | property-designator

   case-statement = 'case' case-index case-body [ ';' ] 'end'

   compound-statement = 'begin' statement-sequence 'end'

   conditional-statement = if-statement | case-statement

   else-part = 'else' statement

   empty-statement =

   for-statement = 'for' control-variable ':=' initial-value ( 'to' | 'downto' ) final-value
                  'do' statement

   goto-statement = 'goto' label

   if-statement = 'if' boolean-expression 'then' statement [ else-part ]

   label = digit-sequence | identifier

   procedure-identifier = identifier

   procedure-method-identifier = identifier

   procedure-method-specifier = object-variable '.' procedure-method-identifier

   procedure-method-statement = procedure-method-specifier [ actual-parameter-list ]

   procedure-statement = procedure-identifier (
         [ actual-parameter-list ] |
         read-parameter-list | readln-parameter-list |
         write-parameter-list | writeln-parameter-list

   repeat-statement = 'repeat' statement-sequence 'until' boolean-expression

   repetitive-statement = repeat-statement | while-statement | for-statement

   simple-statement = empty-statement | assignment-statement |
              procedure-statement | procedure-method-statement |

   statement-sequence = statement { ';' statement }

   structured-statement = compound-statement |
              conditional-statement |
              repetitive-statement |

   while-statement = 'while' boolean-expression 'do' statement

   with-statement = 'with' record-variable-list 'do' statement