module => module_identifier module
declarations*
end module_identifier
declarations
=> constants
=> types
=> globals
=> internals
=> externals
constants => constant constant_definition*
types => type type_definition*
globals => global var_or_proc_declaration*
internals => internal var_or_proc_declaration*
externals => external restricted_var_or_proc_declaration*
constant_declaration => identifier
:= constant_expression
constant_expression => constant_term (add_op constant_term)*
constant_term => constant_factor (add_op constant_factor)*
constant_factor
=> ( constant_expression )
=> unary_op constant_expression
=> constant
constant
=> number
=> character_constant
=> constant_identifier
=> sizeof (static_variable
| type_identifier | constant_identifier)
character_constant => ' character_text
'
type_definition => identifier type
type
=> simple_type
=> structured_type
simple_type
=> byte
=> word
=> integer
=> short_integer
=> pointer_type
=> simple_type_identifier
pointer_type
=> ^ type
=> pointer_type_identifier
structured_type
=> array_type
=> record_type
array_type
=> array [ constant_expression+
type ]
=> array_type_identifier
record_type
=> record [ field_declaration+
]
=> record_type_identifier
field_declaration => identifier+ type
var_or_proc_declaration
=> variable_declaration
=> procedure_declaration
restricted_var_or_proc_declaration
=> identifier+ type
=> restricted_procedure_declaration
variable_declaration
=> identifier simple_type [:=
initial_value]
=> identifier identifier+ simple_type
:= [ initial_value* [...]
]]
=> identifier structured_type [:=
constructor]
=> identifier identifier+ structured_type
[:= [ constructor* [...]
]]
=> identifier array [ *
simple_type ] := ([
initial_value+ ] | text_constant+)
constructor => [ initial_component*
[...] ]
initial_component
=> initial_value
=> constructor
initial_value
=> type_converter initial_value
=> inc initial_value
=> dec initial_value
=> constant_expression
=> # (static_variable | text_constant)
=> nil
=> ?
text_constant => character_sequence
static_variable
=> simple_identifier
=> array_identifier
=> record_identifier
=> static_array_variable
=> static_record_variable
static_array_variable => static_array_designator
[ constant_expression+ ]
static_array_designator
=> array_identifier
=> static_array_variable
=> static_record_variable
static_record_variable => static_record_designator
. field_identifier
static_record_designator
=> record_identifier
=> static_array_variable
=> static_record_variable
procedure_declaration => procedure_identifier
procedure [formal_parm_list]
[returns formal_parm_list]
locals*
[entry statement*]
end procedure_identifier
formal_parm_list => ( formal_parm*
)
form_parm => identifier+ simple_type
locals => local (identifier+
type)*
restricted_procedure_declaration => procedure_identified
procedure [parameter_type_list]
[returns parameter_type_list]
parameter_type_list => ( restricted_parm*
)
restricted_parm => identifier* simple_type
statement
=> assignment_statement
=> if_statement
=> select_statement
=> loop_statement
=> exit_statement
=> repeat_statement
=> return_statement
=> procedure_statement
assignment_statement => variable assign_op arithmetic_expression
assign_op => := | +=
| -=
if_statement => if conditional_expression
then statement* [else statement*]
fi
select_statement => if arithmetic_expression
select_element [else statement*]
fi
select_element => case constant_expression+
then
loop_statement => [label] do
statement* od
label => identifier
exit_statement => exit [from
label]
repeat_statement => repeat
[from label]
return_statement => return
procedure_statement => [variable
variable+ :=] procedure_invocation
procedure_invocation => procedure_identifier [actual_parm_list]
actual_parm_list => ( parameter*
)
parameter => arithmetic_expression
conditional_expression => conditional_term
(orif conditional_term)*
conditional_term => conditional_factor
(andif conditional_factor)*
conditional_factor => arithmetic_expression [rel_op arithmetic_expression]
arithmetic_expression => arithmetic_term (add_op arithmetic_term)*
arithmetic_term => arithmetic_factor (mult_op arithmetic_factor)*
arithmetic_factor
=> unary_operator arithmetic_factor
=> constant
=> variable
=> # (variable | text_constant)
=> nil
=> ( conditional_expression )
rel_op => = | <>
| < | > | <= | >=
add_op => + | -
| or | xor
mult_op => * | /
| mod | and
unary_operator
=> unary_ops
=> type_converter
unary_op => + | -
| abs | not | inc | dec
type_converter => simple_type
variable
=> identifier
=> procedure_invocation
=> array_variable
=> record_variable
=> pointer_variable
array_variable => array_designator
[ arithmetic_expression ]
array_designator => variable
record_variable => record_designator
. field_identifier
record_designator => variable
pointer_variable => pointer_designator
^
pointer_designator => variable
PLZ_text => separator* [id_constant_text] (separator+ id_constant_text)*
id_constant_text
=> identifier
=> word_symbol
=> literal_constant
separator
=> delimeter_text
=> special_symbol
identifier => letter (letter
| digit | _ )
literal_constant
=> number
=> character_sequence
delimiter_text
=> delimiter
=> comment
number
=> integer
=> hex_number
integer => digit+
hex_number => % hex_digit+
character_sequence => ' character_text+
'
character_text
=> character
=> special_character_text
character => any_character_except_%_or_
special_character_text => %
(special_character | hex_digit hex_digit)
special_character => r | l
| t | p | q
comment => comment_initiator comment_char* comment_terminator
comment_char => any_character_except_comment_terminator
comment_initiator => !
comment_terminator => !
letter
=> A | B | ... | Z
=> a | b | ... | z
digit => 0 | 1
| ... | 9
hex_digit
=> digit
=> A | B | ... | F
=> a | b | ... | f
special_symbol
=> = | <> | < | >
| <= | >= | := | +=
| -= | ( | )
=> + | - | * | /
| . | , | ^ | [ | ]
| # | ? | ...
word_symbol
=> abs | and | andif | array
| byte | case | constant
=> dec | do | else
| from | global | if | inc
| integer
=> internal | local | mod
| module | nil | record
=> repeat | return | returns
| short_integer | sizeof
=> then | type | word |
xor
delimiter
=> , | ; | :
=> whitespace