-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogetto3par.cf
177 lines (138 loc) · 9.4 KB
/
progetto3par.cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
entrypoints S ;
rules Boolean ::= "true" | "false" | "True" | "False" ;
StartCode. S ::= STATEMENTS ;
ListStatements. STATEMENTS ::= STATEMENT STATEMENTS ;
EmptyStatement. STATEMENTS ::= {--empty--} ;
BlockStatement. B ::= "{" STATEMENTS "}" ;
Statement. STATEMENT ::= B ;
ExpressionStatement. STATEMENT ::= EXPRESSIONSTATEMENT ";" ;
AssignmentStatement. STATEMENT ::= LVALUEEXPRESSION ASSIGNOP EXPRESSION ";" ;
ConditionalStatement. STATEMENT ::= CONDITIONALSTATE ;
WhileDoStatement. STATEMENT ::= WHILESTATEMENT ;
DoWhileStatement. STATEMENT ::= DOSTATEMENT ;
ForStatement. STATEMENT ::= FORSTATEMENT ;
BreakStatement. STATEMENT ::= "break" ";" ;
ContinueStatement. STATEMENT ::= "continue" ";" ;
ReturnStatement. STATEMENT ::= RETURNSTATEMENT ";" ;
VariableDeclarationStatement. STATEMENT ::= VARIABLETYPE VARDECLIST ";" ;
ForAllStatement. STATEMENT ::= FORALLSTATEMENT ;
ProcedureStatement. STATEMENT ::= "proc" Ident "(" PARAMETERS ")" ":" "void" "{" STATEMENTS "}" ;
FunctionStatement. STATEMENT ::= "function" Ident "(" PARAMETERS ")" ":" PRIMITIVETYPE "{" STATEMENTS "}" ;
ParameterList. PARAMETERS ::= PARAMETER "," PARAMETERS ;
ParameterSingle. PARAMETERS ::= PARAMETER ;
ParameterEmpty. PARAMETERS ::= {--empty--} ;
Parameter. PARAMETER ::= Ident ":" PRIMITIVETYPE ;
AssignOperationEq. ASSIGNOP ::= "=" ;
AssignOperationEqPlus. ASSIGNOP ::= "+=" ;
AssignOperationEqMinus. ASSIGNOP ::= "-=" ;
AssignOperationEqProd. ASSIGNOP ::= "*=" ;
AssignOperationEqFract. ASSIGNOP ::= "/=" ;
AssignOperationEqPercent. ASSIGNOP ::= "%=" ;
AssignOperationEqPower. ASSIGNOP ::= "**=" ;
VariableTypeParam. VARIABLETYPE ::= "param" ;
VariableTypeConst. VARIABLETYPE ::= "const" ;
VariableTypeVar. VARIABLETYPE ::= "var" ;
VariableTypeRef. VARIABLETYPE ::= "ref" ;
VariableTypeConstRef. VARIABLETYPE ::= "const ref" ;
VariableDeclarationSingle. VARDECLIST ::= VARDECID ;
VariableDeclaration. VARDECID ::= IDENTLIST TYPEPART INITPART ;
IdentifierList. IDENTLIST ::= Ident "," IDENTLIST ;
IdentifierSingle. IDENTLIST ::= Ident ;
TypePart. TYPEPART ::= ":" TYPEEXPRESSION ;
InitializzationPart. INITPART ::= "=" EXPRESSION ;
InitializzationPartArray. INITPART ::= "=" "[" LISTELEMENTARRAY ;
InitializzationPartEmpty. INITPART ::= {--empty--} ;
ListElementsOfArray. LISTELEMENTARRAY ::= EXPRESSION "," LISTELEMENTARRAY ;
ListElementOfArray. LISTELEMENTARRAY ::= EXPRESSION "]" ;
TypeExpression. TYPEEXPRESSION ::= PRIMITIVETYPE ;
TypeExpressionArraySimple. TYPEEXPRESSION ::= "[" RANGEEXP "]" PRIMITIVETYPE ;
TypeExpressionArray. TYPEEXPRESSION ::= "[" "{" RANGEEXP "}" "]" PRIMITIVETYPE ;
TypeExpressionPointer. TYPEEXPRESSION ::= PRIMITIVETYPE POINTER ;
PointerSymbol. POINTER ::= POINTER "*" ;
PointerSymbolSingle. POINTER ::= "*" ;
RangeExpression. RANGEEXP ::= EXPRESSION ".." EXPRESSION "," RANGEEXP ;
RangeExpressionSingle. RANGEEXP ::= EXPRESSION ".." EXPRESSION ;
PrimitiveTypeVoid. PRIMITIVETYPE ::= "void" ;
PrimitiveTypeBool. PRIMITIVETYPE ::= "bool" ;
PrimitiveTypeInt. PRIMITIVETYPE ::= "int" ;
PrimitiveTypeReal. PRIMITIVETYPE ::= "real" ;
PrimitiveTypeString. PRIMITIVETYPE ::= "string" ;
PrimitiveTypeChar. PRIMITIVETYPE ::= "char" ;
TypeArray. PRIMITIVETYPE ::= "[" "]" PRIMITIVETYPE ;
ConditionalStatementSimpleThen. CONDITIONALSTATE ::= "if" EXPRESSION "then" STATEMENT ELSESTATEMENT ;
ConditionalStatementSimpleWThen. CONDITIONALSTATE ::= "if" EXPRESSION B ELSESTATEMENT ;
ConditionalStatementCtrlThen. CONDITIONALSTATE ::= "if" CTRLDECSTATEMENT "then" STATEMENT ELSESTATEMENT ;
ConditionalStatementCtrlWThen. CONDITIONALSTATE ::= "if" CTRLDECSTATEMENT B ELSESTATEMENT ;
WhileStateSimpleDo. WHILESTATEMENT ::= "while" EXPRESSION "do" STATEMENT ;
WhileStateSimpleWDo. WHILESTATEMENT ::= "while" EXPRESSION B ;
WhileStateCtrlDo. WHILESTATEMENT ::= "while" CTRLDECSTATEMENT "do" STATEMENT ;
WhileStateCtrlWDo. WHILESTATEMENT ::= "while" CTRLDECSTATEMENT B ;
DoWhileState. DOSTATEMENT ::= "do" STATEMENT "while" EXPRESSION ";" ;
ForStateIndexDo. FORSTATEMENT ::= "for" INDEXVARDEC "in" EXPRESSION "do" STATEMENT ;
ForStateIndexWDo. FORSTATEMENT ::= "for" INDEXVARDEC "in" EXPRESSION B ;
ForStateExprDo. FORSTATEMENT ::= "for" EXPRESSION "do" STATEMENT ;
ForStateExprWDo. FORSTATEMENT ::= "for" EXPRESSION B ;
ForAllStateIndexDo. FORALLSTATEMENT ::= "forall" INDEXVARDEC "in" EXPRESSION "do" STATEMENT ;
ForAllStateIndexWDo. FORALLSTATEMENT ::= "forall" INDEXVARDEC "in" EXPRESSION B ;
ForAllStateExprDo. FORALLSTATEMENT ::= "forall" EXPRESSION "do" STATEMENT ;
ForAllStateExprWDo. FORALLSTATEMENT ::= "forall" EXPRESSION B ;
IndexVarDeclaration. INDEXVARDEC ::= Ident ;
ElseStateEmpty. ELSESTATEMENT ::= {--empty--} ;
ElseState. ELSESTATEMENT ::= "else" STATEMENT ;
ReturnState. RETURNSTATEMENT ::= "return" EXPRESSION ;
ReturnStateEmpty. RETURNSTATEMENT ::= "return" ;
CtrlDecStateVar. CTRLDECSTATEMENT ::= "var" Ident "=" EXPRESSION ;
CtrlDecStateConst. CTRLDECSTATEMENT ::= "const" Ident "=" EXPRESSION ;
VariableExpression. EXPRESSIONSTATEMENT ::= Ident ;
CallExpression. EXPRESSIONSTATEMENT ::= CALLEXPRESSION ;
CallExpressionParentheses. CALLEXPRESSION ::= Ident "(" NAMEDEXPRESSIONLIST ")" ;
CallExpressionQuadre. CALLEXPRESSION ::= Ident "[" NAMEDEXPRESSIONLIST "]" ;
NamedExpressionList. NAMEDEXPRESSIONLIST ::= NAMEDEXPRESSION ;
NamedExpressionLists. NAMEDEXPRESSIONLIST ::= NAMEDEXPRESSION "," NAMEDEXPRESSIONLIST ;
NamedExpression. NAMEDEXPRESSION ::= EXPRESSION ;
NamedExpressionAssigned. NAMEDEXPRESSIONLIST ::= Ident "=" EXPRESSION ;
ExpressionIdent. EXPRESSION ::= Ident ARRAYINDEXELEMENT ;
ExpressionInteger. EXPRESSION ::= Integer ;
ExpressionReal. EXPRESSION ::= Double ;
ExpressionString. EXPRESSION ::= String ;
ExpressionChar. EXPRESSION ::= Char ;
ExpressionBoolean. EXPRESSION ::= Boolean ;
ExpressionBinary. EXPRESSION ::= DEFAULT BINARYOP EXPRESSION ;
ExpressionUnary. EXPRESSION ::= UNARYOP EXPRESSION ;
ExpressionCast. EXPRESSION ::= DEFAULT ":" PRIMITIVETYPE ;
ExpressionBracket. EXPRESSION ::= "(" EXPRESSION ")" ;
ExpressionIdentD. DEFAULT ::= Ident ARRAYINDEXELEMENT ;
ExpressionIntegerD. DEFAULT ::= Integer ;
ExpressionRealD. DEFAULT ::= Double ;
ExpressionStringD. DEFAULT ::= String ;
ExpressionCharD. DEFAULT ::= Char ;
ExpressionBooleanD. DEFAULT ::= Boolean ;
ExpressionBracketD. DEFAULT ::= "(" EXPRESSION ")" ;
UnaryOperationPositive. UNARYOP ::= "+" ;
UnaryOperationNegative. UNARYOP ::= "-" ;
UnaryOperationNot. UNARYOP ::= "!" ;
UnaryOperationPointer. UNARYOP ::= "&" ;
BinaryOperationPlus. BINARYOP ::= "+" ;
BinaryOperationMinus. BINARYOP ::= "-" ;
BinaryOperationProduct. BINARYOP ::= "*" ;
BinaryOperationDivision. BINARYOP ::= "/" ;
BinaryOperationModule. BINARYOP ::= "%" ;
BinaryOperationPower. BINARYOP ::= "**" ;
BinaryOperationAnd. BINARYOP ::= "&&" ;
BinaryOperationOr. BINARYOP ::= "||" ;
BinaryOperationEq. BINARYOP ::= "==" ;
BinaryOperationNotEq. BINARYOP ::= "!=" ;
BinaryOperationGratherEq. BINARYOP ::= ">=" ;
BinaryOperationGrather. BINARYOP ::= ">" ;
BinaryOperationLessEq. BINARYOP ::= "<=" ;
BinaryOperationLess. BINARYOP ::= "<" ;
LvalueExpressions. LVALUEEXPRESSION ::= Ident ARRAYINDEXELEMENT "," LVALUEEXPRESSION ;
LvalueExpression. LVALUEEXPRESSION ::= Ident ARRAYINDEXELEMENT ;
ArrayIndexElement. ARRAYINDEXELEMENT ::= "[" TYPEINDEX "]" ;
ArrayIndexElementEmpty. ARRAYINDEXELEMENT ::= {--empty--} ;
TypeOfIndexInt. TYPEINDEX ::= TYPEINDEX "," Integer ;
TypeOfIndexIntSingle. TYPEINDEX ::= Integer ;
TypeOfIndexVar. TYPEINDEX ::= TYPEINDEX "," Ident ;
TypeOfIndexVarSingle. TYPEINDEX ::= Ident ;
comment "//" ;
comment "/*" ;