author | Mario de Sousa <msousa@fe.up.pt> |
Tue, 04 Apr 2017 15:24:28 +0100 | |
changeset 1044 | 519a30dbf96c |
parent 972 | bc90dd4bbf4f |
permissions | -rw-r--r-- |
181 | 1 |
/* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
181 | 3 |
* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
4 |
* Copyright (C) 2009-2011 Mario de Sousa (msousa@fe.up.pt) |
279
c0453b7f99df
Re-generated std lib related code, with updated headers, updated all forgotten headers
Edouard Tisserant
parents:
265
diff
changeset
|
5 |
* Copyright (C) 2007-2011 Laurent Bessard and Edouard Tisserant |
181 | 6 |
* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
7 |
* This program is free software: you can redistribute it and/or modify |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
8 |
* it under the terms of the GNU General Public License as published by |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
9 |
* the Free Software Foundation, either version 3 of the License, or |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
10 |
* (at your option) any later version. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
11 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
12 |
* This program is distributed in the hope that it will be useful, |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
15 |
* GNU General Public License for more details. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
16 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
18 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
19 |
* |
181 | 20 |
* |
21 |
* This code is made available on the understanding that it will not be |
|
22 |
* used in safety-critical situations without a full and competent review. |
|
23 |
*/ |
|
24 |
||
25 |
/* |
|
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
202
diff
changeset
|
26 |
* An IEC 61131-3 compiler. |
181 | 27 |
* |
28 |
* Based on the |
|
29 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
30 |
* |
|
31 |
*/ |
|
32 |
||
33 |
||
34 |
/* |
|
35 |
* This is the main stage 3a file. |
|
36 |
* |
|
37 |
* In stage 3a some helpful symbol tables are instanciated and populated. |
|
38 |
* These symbol tables wll then be used by stage3b and atage4 code generators. |
|
39 |
*/ |
|
40 |
||
41 |
||
42 |
||
43 |
||
44 |
#ifndef _SEARCH_UTILS_HH |
|
45 |
#define _SEARCH_UTILS_HH |
|
46 |
||
47 |
// #include <stdio.h> /* required for NULL */ |
|
48 |
#include "../util/symtable.hh" |
|
49 |
#include "../util/dsymtable.hh" |
|
50 |
#include "../absyntax/absyntax.hh" |
|
51 |
#include "../absyntax/visitor.hh" |
|
52 |
||
53 |
||
54 |
||
55 |
/* returns 0 if the names are equal!! Case is ignored. */ |
|
56 |
int compare_identifiers(symbol_c *ident1, symbol_c *ident2); |
|
57 |
||
58 |
/* A symbol table with all globally declared functions... */ |
|
972
bc90dd4bbf4f
Change dsymbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
971
diff
changeset
|
59 |
typedef dsymtable_c<function_declaration_c *> function_symtable_t; |
350
2c3c4dc34979
Support for semantic verification of calls to standard functions.
Mario de Sousa <msousa@fe.up.pt>
parents:
338
diff
changeset
|
60 |
extern function_symtable_t function_symtable; |
181 | 61 |
|
62 |
/* A symbol table with all globally declared functions block types... */ |
|
971
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
719
diff
changeset
|
63 |
typedef symtable_c<function_block_declaration_c *> function_block_type_symtable_t; |
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
719
diff
changeset
|
64 |
extern function_block_type_symtable_t function_block_type_symtable; |
181 | 65 |
|
66 |
/* A symbol table with all globally declared program types... */ |
|
971
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
719
diff
changeset
|
67 |
typedef symtable_c<program_declaration_c *> program_type_symtable_t; |
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
719
diff
changeset
|
68 |
extern program_type_symtable_t program_type_symtable; |
181 | 69 |
|
70 |
/* A symbol table with all user declared type definitions... */ |
|
71 |
/* Note that function block types and program types have their |
|
72 |
* own symbol tables, so do not get placed in this symbol table! |
|
338
3037bb7e8a82
Adding some comments, and removing a check for a semantic error in code being compiled.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
73 |
* |
3037bb7e8a82
Adding some comments, and removing a check for a semantic error in code being compiled.
Mario de Sousa <msousa@fe.up.pt>
parents:
328
diff
changeset
|
74 |
* The symbol_c * associated to the value will point to the data type declaration. |
181 | 75 |
*/ |
971
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
719
diff
changeset
|
76 |
typedef symtable_c<symbol_c *> type_symtable_t; |
8aee27d46208
Change symbtable_c -> use design pattern used by C++ standard library (STL)
mjsousa
parents:
719
diff
changeset
|
77 |
extern type_symtable_t type_symtable; |
181 | 78 |
|
79 |
||
80 |
/***********************************************************************/ |
|
81 |
/***********************************************************************/ |
|
82 |
/***********************************************************************/ |
|
83 |
/***********************************************************************/ |
|
84 |
||
85 |
#include "spec_init_separator.hh" |
|
377
60b012b7793f
Adding support for compiling direct array specification inside variable declaration
laurent
parents:
375
diff
changeset
|
86 |
#include "array_dimension_iterator.hh" |
347
44ff2a6fcadc
Fix case statement in ST, adding support for enumerated types
laurent
parents:
338
diff
changeset
|
87 |
#include "case_element_iterator.hh" |
181 | 88 |
#include "function_param_iterator.hh" |
89 |
#include "function_call_iterator.hh" |
|
90 |
#include "function_call_param_iterator.hh" |
|
91 |
#include "type_initial_value.hh" |
|
92 |
#include "search_fb_instance_decl.hh" |
|
93 |
#include "search_fb_typedecl.hh" |
|
94 |
#include "search_base_type.hh" |
|
95 |
#include "search_var_instance_decl.hh" |
|
96 |
#include "decompose_var_instance_name.hh" |
|
97 |
#include "search_varfb_instance_type.hh" |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
98 |
#include "add_en_eno_param_decl.hh" |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
99 |
#include "get_sizeof_datatype.hh" |
459
01f6664bf8c5
Continue adding support for semantic verification of JMP and RET.
Mario de Sousa <msousa@fe.up.pt>
parents:
377
diff
changeset
|
100 |
#include "search_il_label.hh" |
511
b22ae67d8003
Moving get_var_name_c into its own file.
Mario de Sousa <msousa@fe.up.pt>
parents:
459
diff
changeset
|
101 |
#include "get_var_name.hh" |
666
8ba9ec4bae50
Add new get_datatype_info_c (preparing to remove search_expression_type_c)
Mario de Sousa <msousa@fe.up.pt>
parents:
596
diff
changeset
|
102 |
#include "get_datatype_info.hh" |
678
01e33dc2a255
Add classes to print status of AST (use only for debugging!)
Mario de Sousa <msousa@fe.up.pt>
parents:
671
diff
changeset
|
103 |
#include "debug_ast.hh" |
181 | 104 |
|
105 |
/***********************************************************************/ |
|
106 |
/***********************************************************************/ |
|
107 |
/***********************************************************************/ |
|
108 |
/***********************************************************************/ |
|
109 |
/***********************************************************************/ |
|
110 |
||
111 |
||
112 |
||
113 |
||
114 |
void absyntax_utils_init(symbol_c *tree_root); |
|
115 |
||
116 |
||
117 |
#endif /* _SEARCH_UTILS_HH */ |