source: branches/Analyzátor gramatiky/grammer/Pascal.grm

Last change on this file was 10, checked in by george, 16 years ago

Přesunuto: analýza gramatiky do branches.
Přidáno: Hlavní větev překladač pascalu pro AVR.

File size: 6.2 KB
Line 
1
2actual_function= FUNCTION_NAME .
3actual_parameter_list= '(' actual_parameter { ',' actual_parameter } ')' .
4actual_parameter= actual_value | actual_variable | actual_procedure
5 | actual_function .
6actual_procedure= PROCEDURE_NAME .
7actual_value= expression .
8actual_variable= variable .
9addition_operator= '+' | '-' | OR .
10array_type= ARRAY '[' index_type { ',' index_type } ']' OF element_type .
11array_variable= variable .
12assignment_statement= ( variable | FUNCTION_NAME ) ':=' expression .
13base_type= type .
14block= declaration_part statement_part .
15bound_specification= NAME '..' NAME ':' ordinal_type_identifier .
16case_element= case_label_list ':' statement .
17case_label_list= constant { ',' constant } .
18case_statement= CASE expression OF case_element { ';' case_element } [ ';' ] END .
19component_variable= indexed_variable | field_designator | file_buffer .
20compound_statement= BEGIN statement_sequence END .
21conditional_statement= if_statement | case_statement .
22conformant_array_schema= packed_conformant_array_schema
23 | unpacked_conformant_array_schema .
24constant_definition_part= CONST constant_definition ';' { constant_definition ';' } .
25constant_definition= NAME '=' constant .
26constant= [ '+' | '-' ] ( CONSTANT_NAME | number ) | STRING .
27declaration_part= [ label_declaration_part ] [ constant_definition_part ]
28 [ type_definition_part ] [ variable_declaration_part ]
29directive= FORWARD .
30element_list= [ expression { ',' expression } ] .
31element_type= type .
32entire_variable= VARIABLE_NAME | FIELD_NAME .
33enumerated_type= '(' identifier_list ')' .
34expression_list= expression { ',' expression } .
35expression= simple_expression [ relational_operator simple_expression ] .
36factor= NUMBER | STRING | NIL | CONSTANT_NAME | set | variable
37 | function_designator | '(' expression ')' | NOT factor .
38field_designator= record_variable '.' FIELD_NAME .
39field_list= [ ( fixed_part [ ';' variant_part ] | variant_part ) [ ';' ] ] .
40field_width= expression .
41file_buffer= file_variable '^' .
42file_component_type= type .
43file_type= FILE OF file_component_type .
44file_variable= variable .
45final_expression= expression .
46fixed_part= record_section { ';' record_section } .
47for_statement= FOR VARIABLE_NAME ':=' initial_expression ( TO | DOWNTO )
48 final_expression DO statement .
49formal_parameter_list= '(' formal_parameter_section { ';' formal_parameter_section } ')' .
50formal_parameter_section= value_parameter_section | variable_parameter_section
51 | procedure_parameter_section | function_parameter_section .
52fraction_length= expression .
53function_declaration= function_heading ';' ( block | directive ) .
54function_designator= FUNCTION_NAME [ actual_parameter_list ] .
55function_heading= FUNCTION NAME [ formal_parameter_list ] ':' result_type .
56function_parameter_section= function_heading .
57goto_statement= GOTO label .
58identifier_list= NAME { ',' NAME } .
59if_statement= IF expression THEN statement [ ELSE statement ] .
60index_type= simple_type .
61indexed_variable= array_variable '[' expression_list ']' .
62initial_expression= expression .
63integer_number= NUMBER .
64label_declaration_part= LABEL label { ',' label } ';' .
65label= NUMBER .
66lower_bound= constant .
67multiplication_operator= '*' | '/' | DIV | MOD | AND .
68number= integer_number | real_number .
69ordinal_type_identifier= TYPE_NAME .
70output_list= output_value { ',' output_value } .
71output_value= expression [ ';' field_width [ ':' fraction_length ] ] .
72packed_conformant_array_schema= PACKED ARRAY '[' bound_specification ']' OF TYPE_NAME .
73parameter_type= TYPE_NAME | conformant_array_schema .
74pointer_type= '^' TYPE_NAME .
75pointer_variable= variable .
76procedure_and_function_declaration_part .
77procedure_and_function_declaration_part= { ( procedure_declaration
78 | function_declaration ) ';' } .
79procedure_declaration= procedure_heading ';' ( block | directive ) .
80procedure_heading= PROCEDURE NAME [ formal_parameter_list ] .
81procedure_parameter_section= procedure_heading .
82procedure_statement= PROCEDURE_NAME [ actual_parameter_list ] .
83program_heading= PROGRAM NAME '(' identifier_list ')' ';' .
84program= program_heading block '.' .
85real_number= NUMBER .
86record_section= identifier_list ':' type .
87record_type= RECORD field_list END .
88record_variable= variable .
89referenced_variable= pointer_variable '^' .
90relational_operator= '=' | '<>' | '<' | '<=' | '>' | '>=' | IN .
91repeat_statement= REPEAT statement_sequence UNTIL expression .
92repetitive_statement= while_statement | repeat_statement | for_statement .
93result_type= TYPE_NAME .
94set_type= SET OF base_type .
95set= '[' element_list ']' .
96simple_expression= [ '+' | '-' ] term { addition_operator term } .
97simple_statement= [ assignment_statement | procedure_statement | goto_statement ] .
98simple_type= subrange_type | enumerated_type .
99statement_part= BEGIN statement_sequence END .
100statement_sequence= statement { ';' statement } .
101statement= [ LABEL ':' ] ( simple_statement | structured_statement ) .
102structured_statement= compound_statement | repetitive_statement
103 | conditional_statement | with_statement .
104structured_type= [ PACKED ] unpacked_structured_type .
105subrange_type= lower_bound '..' upper_bound .
106tag_field= [ NAME ':' ] .
107term= factor { multiplication_operator factor } .
108type_definition_part= TYPE type_definition ';' { type_definition ';' } .
109type_definition= NAME '=' type .
110type= simple_type | structured_type | pointer_type | TYPE_NAME .
111unpacked_conformant_array_schema= ARRAY '[' bound_specification
112 { ';' bound_specification } ']' OF ( TYPE_NAME | conformant_array_schema ) .
113unpacked_structured_type= array_type | record_type | set_type | file_type .
114upper_bound= constant .
115value_parameter_section= identifier_list ':' parameter_type .
116variable_declaration_part= VAR variable_declaration ';' { variable_declaration ';' } .
117variable_declaration= identifier_list ':' type .
118variable_parameter_section= VAR identifier_list ':' parameter_type .
119variable= entire_variable | component_variable | referenced_variable .
120variant_part= CASE tag_field TYPE_NAME OF variant { ';' variant } .
121variant= case_label_list ':' '(' field_list ')' .
122while_statement= WHILE expression DO statement .
123with_statement= WITH record_variable { ',' record_variable } DO statement .
Note: See TracBrowser for help on using the repository browser.