author | Mario de Sousa <msousa@fe.up.pt> |
Fri, 01 Apr 2011 10:06:19 +0100 | |
changeset 264 | 6facabd9c2cd |
parent 262 | 197ba42d78b2 |
child 267 | 0a1204bcc9af |
permissions | -rwxr-xr-x |
204 | 1 |
/* |
257 | 2 |
* (c) 2009 Mario de Sousa |
204 | 3 |
* |
4 |
* Offered to the public under the terms of the GNU General Public License |
|
5 |
* as published by the Free Software Foundation; either version 2 of the |
|
6 |
* License, or (at your option) any later version. |
|
7 |
* |
|
8 |
* This program is distributed in the hope that it will be useful, but |
|
9 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
11 |
* Public License for more details. |
|
12 |
* |
|
13 |
* This code is made available on the understanding that it will not be |
|
14 |
* used in safety-critical situations without a full and competent review. |
|
15 |
*/ |
|
16 |
||
17 |
/* |
|
18 |
* An IEC 61131-3 IL and ST compiler. |
|
19 |
* |
|
20 |
* Based on the |
|
21 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2009-04-24) |
|
22 |
* |
|
23 |
*/ |
|
24 |
||
25 |
#include "stage3.hh" |
|
26 |
||
27 |
int type_safety(symbol_c *tree_root){ |
|
28 |
visit_expression_type_c visit_expression_type(tree_root); |
|
29 |
||
30 |
(*tree_root).accept(visit_expression_type); |
|
31 |
||
262
197ba42d78b2
Do not crash when checking semantics of undeclared symbolic_variable.
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
32 |
if (visit_expression_type.get_error_found()) |
197ba42d78b2
Do not crash when checking semantics of undeclared symbolic_variable.
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
33 |
return -1; |
197ba42d78b2
Do not crash when checking semantics of undeclared symbolic_variable.
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
34 |
|
204 | 35 |
return 0; |
36 |
} |
|
37 |
||
38 |
int stage3(symbol_c *tree_root){ |
|
39 |
return type_safety(tree_root); |
|
40 |
} |