QUELLE: http://www.fh-jena.de/contrib/fb/gw/gmueller/Kurs_halle/pas_extp.html

Programmiersprache Pascal

Syntax-Regeln von Extended Pascal

ISO/IEC 10206:1990

Metasprachliche Symbole

  Metasymbol        Meaning
  ---------------------------------------------------------
  =                 Shall be defined to be
  >                 Shall have as an alternative definition
  |                 Alternatively
  .                 End of definition
  [ x ]             0 or 1 instance of x
  { x }             0 or more instances of x
  ( x | y )         Grouping: either of x or y
  'xyz'             The terminal symbol xyz
  meta-identifier   A nonterminal symbol
  ---------------------------------------------------------
Definition der Nichtterminalsymbole
access-qualifier = 'qualified' . 

actual-discriminant-part = '(' discriminant-value { ',' discriminant-value } ')' . 

actual-parameter = expression | variable-access 
                 | procedure-name | function-name . 

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

adding-operator = '+' | '-' | '><' | 'or' | 'or_else' .

apostrophe-image = '''' . 

array-constant = constant-access . 

array-function = function-access . 

array-type = 'array' '[' index-type { ',' index-type } ']' 'of' component-type . 

array-type-name = type-name . 

array-value = '[' [ array-value-element { ';' array-value-element } [ ';' ] ] 
               [ array-value-completer [ ';' ] ] ']' . 

array-value-completer = 'otherwise' component-value . 

array-value-element = case-constant-list ':' component-value . 

array-variable = variable-access . 

assignment-statement = ( variable-access | function-identifier ) ':=' expression . 

base-type = ordinal-type . 

block = import-part 
        { label-declaration-part 
        | constant-definition-part 
        | type-definition-part 
        | variable-declaration-part 
        | procedure-and-function-declaration-part } 
        statement-part . 

Boolean-expression = expression . 

bound-identifier = identifier . 

buffer-variable = file-variable '''' . 

case-constant = constant-expression . 

case-constant-list = case-range { ',' case-range } . 

case-index = expression . 

case-list-element = case-constant-list ':' statement . 

case-range = case-constant [ '..' case-constant ] . 

case-statement = 'case' case-index 'of' 
                 ( case-list-element { ';' case-list-element } 
                 [ [ ';' ] case-statement-completer ] | case-statement-completer ) 
                 [ ';' ] 'end' . 

case-statement-completer = 'otherwise' statement-sequence . 

character-string = ''' { string-element } ''' . 

complex-type-name = type-name . 

component-function-access = indexed-function-access 
                          | record-function-access . 

component-type = type-denoter . 

component-value = expression | array-value | record-value . 

component-variable = indexed-variable | field-designator . 

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

conditional-statement = if-statement | case-statement . 

conformant-array-form = packed-conformant-array-form 
                      | unpacked-conformant-array-form . 

conformant-array-parameter-specification = 
      [ 'protected' ]( value-conformant-array-specification 
                     | variable-conformant-array-specification ) . 

constant-access = constant-access-component | constant-name . 

constant-access-component = indexed-constant 
                          | field-designated-constant 
                          | substring-constant . 

constant-definition = identifier '=' constant-expression . 

constant-definition-part = 'const' constant-definition ';' { constant-definition ';' } . 

constant-expression = expression . 

constant-field-identifier = identifier . 

constant-identifier = identifier . 

constant-name = [ imported-interface-identifier '.' ] constant-identifier . 

constant-tag-value = constant-expression . 

constituent-identifier = identifier . 

control-variable = entire-variable . 

digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' . 

digit-sequence = digit { digit } . 

directive = letter { [ underscore ] ( letter | digit ) } . 

discriminant-identifier = identifier . 

discriminant-specification = identifier-list ':' ordinal-type-name . 

discriminant-specifier = discriminant-identifier . 

discriminant-value = expression . 

discriminated-schema = schema-name actual-discriminant-part . 

domain-type = type-name | schema-name . 

else-part = 'else' statement . 

empty-statement = . 

entire-function-access = function-designator . 

entire-variable = variable-name . 

enumerated-type = '(' identifier-list ')' . 

exponentiating-operator = '**' | 'pow' . 

export-clause = exportable-name | export-renaming-clause . 

export-list = ( export-clause | export-range ) 
              { ',' ( export-clause | export-range ) } . 

export-part = identifier '=' '(' export-list ')' . 

export-range = first-constant-name '..' last-constant-name . 

export-renaming-clause = exportable-name '=?' identifier . 

exportable-name = constant-name 
                | type-name 
                | schema-name 
                | [ 'protected' ] variable-name 
                | procedure-name 
                | function-name . 

expression = simple-expression [ relational-operator simple-expression ] . 

extended-digit = digit | letter . 

extended-number = unsigned-integer '#' extended-digit { extended-digit } . 

factor = primary [ exponentiating-operator primary ] . 

field-designated-constant = record-constant '.' field-specifier 
                          | constant-field-identifier . 

field-designator = record-variable '.' field-specifier | field-designator-identifier . 

field-designator-identifier = identifier . 

field-identifier = identifier . 

field-list = [ ( fixed-part [ ';' variant-part ] | variant-part ) [ ';' ] ] . 

field-list-value = [ ( fixed-part-value [ ';' variant-part-value ] | variant-part-value ) [ ';' ] ] . 

field-specifier = field-identifier . 

field-value = field-identifier { ',' field-identifier } 
              ':' component-value . 

file-type = 'file' [ '[' index-type ']' ] 'of' component-type . 

file-type-name = type-name . 

file-variable = variable-access . 

final-value = expression . 

finalization-part = 'to' 'end' 'do' statement ';' . 

first-constant-name = constant-name . 

fixed-part = record-section { ';' record-section } . 

fixed-part-value = field-value { ';' field-value } . 

for-statement = 'for' control-variable iteration-clause 'do' statement . 

formal-discriminant-part = '(' discriminant-specification 
                           { ';' discriminant-specification } ')' . 

formal-parameter-list = '(' formal-parameter-section { ';' formal-parameter-section } ')' . 

formal-parameter-section > value-parameter-specification 
                         | variable-parameter-specification 
                         | procedural-parameter-specification 
                         | functional-parameter-specification . 

formal-parameter-section > conformant-array-parameter-specification . 

fractional-part = digit-sequence . 

function-access = entire-function-access 
                | component-function-access 
                | substring-function-access . 

function-block = block . 

function-declaration = function-heading ';' remote-directive 
                     | function-identification ';' function-block 
                     | function-heading ';' function-block . 

function-designator = function-name [ actual-parameter-list ] . 

function-heading = 'function' identifier [ formal-parameter-list ] 
                   [ result-variable-specification ] ':' result-type . 

function-identification = 'function' function-identifier . 

function-identified-variable = pointer-function '''' . 

function-identifier = identifier . 

function-name = [ imported-interface-identifier '.' ] function-identifier . 

functional-parameter-specification = function-heading . 

goto-statement = 'goto' label . 

identified-variable = pointer-variable '''' . 

identifier = letter { [ underscore ] ( letter | digit ) } . 

identifier-list = identifier { ',' identifier } . 

if-statement = 'if' Boolean-expression 'then' statement [ else-part ] . 

implementation-directive = directive . 

import-clause = constituent-identifier | import-renaming-clause . 

import-list = import-clause { ',' import-clause } . 

import-part = [ 'import' import-specification ';' { import-specification ';' } ] . 

import-qualifier = [ selective-import-option ] '(' import-list ')' . 

import-renaming-clause = constituent-identifier '=?' identifier . 

import-specification = interface-identifier [ access-qualifier ] 
                       [ import-qualifier ] . 

imported-interface-identifier = identifier . 

index-expression = expression . 

index-type = ordinal-type . 

index-type-specification = identifier '..' identifier ':' ordinal-type-name . 

indexed-constant = array-constant '[' index-expression { ',' index-expression } ']' 
                 | string-constant '[' index-expression ']' . 

indexed-function-access = array-function '[' index-expression { ',' index-expression } ']' 
                        | string-function '[' index-expression ']' . 

indexed-variable = array-variable '[' index-expression { ',' index-expression } ']' 
                 | string-variable '[' index-expression ']' . 

initial-state-specifier = 'value' component-value . 

initial-value = expression . 

initialization-part = 'to' 'begin' 'do' statement ';' . 

interface-directive = directive . 

interface-identifier = identifier . 

interface-specification-part = 'export' export-part ';' { export-part ';' } . 

iteration-clause = sequence-iteration | set-member-iteration . 

label = digit-sequence . 

label-declaration-part = 'label' label { ',' label } ';' . 

last-constant-name = constant-name . 

letter = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' 
       | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' 
       | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' . 

main-program-block = block . 

main-program-declaration = program-heading ';' main-program-block . 

member-designator = expression [ '..' expression ] . 

module-block = import-part 
               { constant-definition-part 
                | type-definition-part 
                | variable-declaration-part 
                | procedure-and-function-declaration-part } 
               [ initialization-part ] 
               [ finalization-part ] 
               'end' . 

module-declaration = module-heading [ ';' module-block ] 
                   | module-identification ';' module-block . 

module-heading = 'module' identifier [ interface-directive ] 
                 [ '(' module-parameter-list ')' ] ';' 
                 interface-specification-part 
                 import-part 
                  { constant-definition-part 
                  | type-definition-part 
                  | variable-declaration-part 
                  | procedure-and-function-heading-part } 
                 'end' . 

module-identification = 'module' module-identifier implementation-directive . 

module-identifier = identifier . 

module-parameter-list = identifier-list . 

multiplying-operator = '*' | '/' | 'div' | 'mod' | 'and' | 'and then' . 

new-ordinal-type = enumerated-type | subrange-type . 

new-pointer-type = '''' domain-type . 

new-structured-type = [ 'packed' ] unpacked-structured-type . 

new-type = new-ordinal-type 
         | new-structured-type 
         | new-pointer-type 
         | restricted-type . 

number = signed-number 
       | [ sign ] ( digit-sequence '.' | '.' fractional-part ) [ 'e' scale-factor ] . 

ordinal-type = new-ordinal-type | ordinal-type-name 
             | type-inquiry | discriminated-schema . 

ordinal-type-name = type-name . 

packed-conformant-array-form = 'packed' 'array' '[' index-type-specification ']' 'of' type-name . 

parameter-form = type-name | schema-name | type-inquiry . 

parameter-identifier = identifier . 

pointer-function = function-access . 

pointer-type = new-pointer-type | pointer-type-name . 

pointer-type-name = type-name . 

pointer-variable = variable-access . 

primary > variable-access | unsigned-constant | set-constructor 
        | function-access | '(' expression ')' | 'not' primary 
        | constant-access | schema-discriminant 
        | structured-value-constructor | discriminant-identifier . 

primary > bound-identifier . 

procedural-parameter-specification = procedure-heading . 

procedure-and-function-declaration-part = { ( procedure-declaration 
                                        | function-declaration ) ';' } . 

procedure-and-function-heading-part = ( procedure-heading | function-heading ) ';' . 

procedure-block = block . 

procedure-declaration = procedure-heading ';' remote-directive 
                      | procedure-identification ';' procedure-block 
                      | procedure-heading ';' procedure-block . 

procedure-heading = 'procedure' identifier [ formal-parameter-list ] . 

procedure-identification = 'procedure' procedure-identifier . 

procedure-identifier = identifier . 

procedure-name = [ imported-interface-identifier '.' ] procedure-identifier . 

procedure-statement = procedure-name ( [ actual-parameter-list ] 
                    | read-parameter-list | readln-parameter-list | readstr-parameter-list 
                    | write-parameter-list | writeln-parameter-list | writestr-parameter-list ) . 

program = program-block . 

program-block = program-component { program-component } . 

program-component = main-program-declaration '.' | module-declaration '.' . 

program-heading = 'program' identifier [ '(' program-parameter-list ')' ] . 

program-parameter-list = identifier-list . 

read-parameter-list = '(' [ file-variable ',' ] variable-access { ',' variable-access } ')' . 

readln-parameter-list = [ '(' ( file-variable | variable-access ) { ',' variable-access } ')' ] . 

readstr-parameter-list = '(' string-expression ',' variable-access { ',' variable-access } ')' . 

real-type-name = type-name . 

record-constant = constant-access . 

record-function = function-access . 

record-function-access = record-function '.' field-specifier . 

record-section = identifier-list ':' type-denoter . 

record-type = 'record' field-list 'end' . 

record-type-name = type-name . 

record-value = '[' field-list-value ']' . 

record-variable = variable-access . 

relational-operator = '=' | '!?' | '!' | '?' | '!=' | '?=' | 'in' . 

remote-directive = directive . 

repeat-statement = 'repeat' statement-sequence 'until' Boolean-expression . 

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

restricted-type = 'restricted' type-name . 

result-type = type-name . 

result-variable-specification = '=' identifier . 

scale-factor = [ sign ] digit-sequence . 

schema-definition = identifier '=' schema-name 
                  | identifier formal-discriminant-part '=' type-denoter . 

schema-discriminant = ( variable-access | constant-access ) '.' discriminant-specifier 
                    | schema-discriminant-identifier . 

schema-discriminant-identifier = identifier . 

schema-identifier = identifier . 

schema-name = [ imported-interface-identifier '.' ] schema-identifier . 

selective-import-option = 'only' . 

sequence-iteration = ':=' initial-value ( 'to' | 'downto' ) final-value . 

set-constructor = '[' [ member-designator { ',' member-designator } ] ']' . 

set-expression = expression . 

set-member-iteration = 'in' set-expression . 

set-type = 'set' 'of' base-type . 

set-type-name = type-name . 

set-value = set-constructor . 

sign = '+' | '-' .

signed-integer = [ sign ] unsigned-integer .

signed-number = signed-integer | signed-real .

signed-real = [ sign ] unsigned-real .

simple-statement = empty-statement | assignment-statement 
                 | procedure-statement | goto-statement . 

simple-type = ordinal-type | real-type-name | complex-type-name . 

simple-type-name = type-name . 

special-symbol = '+' | ' ?' | '[' | ']' 
               | '.' | ',' | ':' | ';' | '''' | '(' | ')' | '**' 
               | '<>' | '<=' | '>=' | ':=' | '..' | '><' | '=>' 
               | word-symbol . 

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

statement-part = compound-statement . 

statement-sequence = statement { ';' statement } . 

string-character = one-of-a-set-of-implementation-defined-characters . 

string-constant = constant-access . 

string-element = apostrophe-image | string-character . 

string-expression = expression . 

string-function = function-access . 

string-variable = variable-access . 

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

structured-type = new-structured-type | structured-type-name . 

structured-type-name = array-type-name 
                     | record-type-name 
                     | set-type-name 
                     | file-type-name . 

structured-value-constructor = array-type-name array-value 
                             | record-type-name record-value 
                             | set-type-name set-value . 

subrange-bound = expression . 

subrange-type = subrange-bound '..' subrange-bound . 

substring-constant = string-constant '[' index-expression '..' index-expression ']' . 

substring-function-access = string-function '[' index-expression '..' index-expression ']' . 

substring-variable = string-variable '[' index-expression '..' index-expression ']' . 

tag-field = identifier . 

tag-field-identifier = field-identifier . 

tag-type = ordinal-type-name . 

term = factor { multiplying-operator factor } . 

type-definition = identifier '=' type-denoter . 

type-definition-part = 'type' ( type-definition | schema-definition ) ';' 
                       { ( type-definition | schema-definition ) ';' } . 

type-denoter = [ 'bindable' ] ( type-name | new-type 
                | type-inquiry | discriminated-schema ) 
               [ initial-state-specifier ] . 

type-identifier = identifier . 

type-inquiry = 'type' 'of' type-inquiry-object . 

type-inquiry-object = variable-name | parameter-identifier . 

type-name = [ imported-interface-identifier '.' ] type-identifier . 

underscore = ' ' . 

unpacked-conformant-array-form = 
   'array' '[' index-type-specification { ';' index-type-specification } ']' 
   'of' ( type-name | conformant-array-form ) . 

unpacked-structured-type = array-type | record-type | set-type | file-type . 

unsigned-constant = unsigned-number | character-string | 'nil' | extended-number . 

unsigned-integer = digit-sequence . 

unsigned-number = unsigned-integer | unsigned-real . 

unsigned-real = digit-sequence '.' fractional-part [ 'e' scale-factor ] 
              | digit-sequence 'e' scale-factor . 

value-conformant-array-specification = identifier-list ':' conformant-array-form . 

value-parameter-specification = [ 'protected' ] identifier-list ':' parameter-form . 

variable-access = entire-variable | component-variable 
                | identified-variable | buffer-variable 
                | substring-variable | function-identified-variable . 

variable-conformant-array-specification = 'var' identifier-list ':' conformant-array-form . 

variable-declaration = identifier-list ':' type-denoter . 

variable-declaration-part = 'var' variable-declaration ';' { variable-declaration ';' } . 

variable-identifier = identifier . 

variable-name = [ imported-interface-identifier '.' ] variable-identifier . 

variable-parameter-specification = [ 'protected' ] 'var' identifier-list ':' parameter-form . 

variant-denoter = '(' field-list ')' . 

variant-list-element = case-constant-list ':' variant-denoter . 

variant-part = 'case' variant-selector 'of' 
               ( variant-list-element { ';' variant-list-element } 
                 [ [ ';' ] variant-part-completer ] 
                | variant-part-completer ) . 

variant-part-completer = 'otherwise' variant-denoter . 

variant-part-value = 'case' [ tag-field-identifier ':' ] 
                     constant-tag-value 'of' '[' field-list-value ']' . 

variant-selector = [ tag-field ':' ] tag-type | discriminant-identifier . 

while-statement = 'while' Boolean-expression 'do' statement . 

with-element = variable-access | constant-access . 

with-list = with-element { ',' with-element } . 

with-statement = 'with' with-list 'do' statement . 

word-symbol = 'and' | 'and then' | 'array' | 'begin' | 'bindable' | 'case' 
            | 'const' | 'div' | 'do' | 'downto' | 'else' | 'end' | 'export' 
            | 'file' | 'for' | 'function' | 'goto' | 'if' | 'import' 
            | 'in' | 'label' | 'mod' | 'module' | 'nil' | 'not' | 'of' 
            | 'only' | 'or' | 'or else' | 'otherwise' | 'packed' | 'pow' 
            | 'procedure' | 'program' | 'protected' | 'qualified' 
            | 'record' | 'repeat' | 'restricted' | 'set' | 'then' | 'to' 
            | 'type' | 'until' | 'value' | 'var' | 'while' | 'with' . 

write-parameter = expression [ ':' expression [ ':' expression ] ] . 

write-parameter-list = '(' [ file-variable ',' ] write-parameter { ',' write-parameter } ')' . 

writeln-parameter-list = [ '(' ( file-variable | write-parameter ) { ',' write-parameter } ')' ] . 

writestr-parameter-list = '(' string-variable ',' write-parameter { ',' write-parameter } ')' .