author | Edouard Tisserant |
Wed, 19 Feb 2014 22:27:11 +0100 | |
changeset 870 | 9c6c588fd708 |
parent 854 | 13d0b67de111 |
child 939 | 5074236fb3c4 |
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:
226
diff
changeset
|
2 |
* matiec - a compiler for the programming languages defined in IEC 61131-3 |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
3 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
4 |
* Copyright (C) 2003-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 |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
diff
changeset
|
6 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
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:
226
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:
226
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:
226
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:
226
diff
changeset
|
11 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
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:
226
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:
226
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:
226
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:
226
diff
changeset
|
16 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
226
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:
226
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:
226
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:
226
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 |
||
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
34 |
/* Search in a VAR* END_VAR declaration for the delcration of the specified variable instance. |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
35 |
* Will return: |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
36 |
* - the declaration itself (get_decl() ) |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
37 |
* - the type of declaration in which the variable was declared (get_vartype() ) |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
38 |
* |
181 | 39 |
* The variable instance may NOT be a member of a structure of a memeber |
40 |
* of a structure of an element of an array of ... |
|
41 |
* |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
42 |
* For example, considering the following 'variables': |
181 | 43 |
* window.points[1].coordinate.x |
44 |
* window.points[1].colour |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
45 |
* offset[99] |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
46 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
47 |
* passing a reference to 'points', 'points[1]', 'points[1].colour', 'colour' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
48 |
* ARE NOT ALLOWED! |
181 | 49 |
* |
50 |
* This class must only be passed the name of the variable that will appear |
|
51 |
* in the variable declaration. In the above examples, this would be |
|
504
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
52 |
* 'window.points[1].coordinate.x' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
53 |
* 'window.points[1].coordinate' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
54 |
* 'window.points[1]' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
55 |
* 'window' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
56 |
* 'window.points[1].colour' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
57 |
* 'offset' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
58 |
* 'offset[99]' |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
59 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
60 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
61 |
*/ |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
62 |
|
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
63 |
/* Note: |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
64 |
* Determining the declaration type of a specific variable instance (including |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
65 |
* function block instances) really means determining whether the variable was declared in a |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
66 |
* VAR_INPUT |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
67 |
* VAR_OUTPUT |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
68 |
* VAR_IN_OUT |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
69 |
* VAR |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
70 |
* VAR_TEMP |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
71 |
* VAR_EXTERNAL |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
72 |
* VAR_GLOBAL |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
73 |
* VAR <var_name> AT <location> -> Located variable! |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
74 |
* |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
75 |
*/ |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
76 |
|
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
77 |
/* Note: |
f8d422b98315
Fix bug by expanding permissible data input of search_var_instance_decl_c
Mario de Sousa <msousa@fe.up.pt>
parents:
417
diff
changeset
|
78 |
* The current_type_decl that this class returns may reference the |
181 | 79 |
* name of a type, or the type declaration itself! |
80 |
* For an example of the first, consider a variable declared as ... |
|
81 |
* x : AAA; |
|
82 |
* where the AAA type is previously declared as whatever. |
|
83 |
* For an example of the second, consider a variable declared as ... |
|
84 |
* x : array of int [10]; ----> is allowed |
|
85 |
* |
|
86 |
* If it is the first, we will return a reference to the name, if the second |
|
87 |
* we return a reference to the declaration!! |
|
88 |
*/ |
|
89 |
||
90 |
||
91 |
class search_var_instance_decl_c: public search_visitor_c { |
|
92 |
||
93 |
public: |
|
94 |
search_var_instance_decl_c(symbol_c *search_scope); |
|
95 |
||
96 |
public: |
|
536
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
97 |
typedef enum { |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
98 |
input_vt , // VAR_INPUT |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
99 |
output_vt , // VAR_OUTPUT |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
100 |
inoutput_vt, // VAR_IN_OUT |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
101 |
private_vt , // VAR |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
102 |
temp_vt , // VAR_TEMP |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
103 |
external_vt, // VAR_EXTERNAL |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
104 |
global_vt , // VAR_GLOBAL |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
105 |
located_vt , // VAR <var_name> AT <location> |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
106 |
none_vt |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
107 |
} vt_t; |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
108 |
|
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
109 |
typedef enum { |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
110 |
constant_opt , |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
111 |
retain_opt , |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
112 |
non_retain_opt, |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
113 |
none_opt |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
114 |
} opt_t; |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
115 |
#if 0 |
181 | 116 |
/* the types of variables that need to be processed... */ |
117 |
static const unsigned int none_vt = 0x0000; |
|
118 |
static const unsigned int input_vt = 0x0001; // VAR_INPUT |
|
119 |
static const unsigned int output_vt = 0x0002; // VAR_OUTPUT |
|
120 |
static const unsigned int inoutput_vt = 0x0004; // VAR_IN_OUT |
|
121 |
static const unsigned int private_vt = 0x0008; // VAR |
|
122 |
static const unsigned int temp_vt = 0x0010; // VAR_TEMP |
|
123 |
static const unsigned int external_vt = 0x0020; // VAR_EXTERNAL |
|
124 |
static const unsigned int global_vt = 0x0040; // VAR_GLOBAL |
|
125 |
static const unsigned int located_vt = 0x0080; // VAR <var_name> AT <location> |
|
126 |
||
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
127 |
static const unsigned int none_opt = 0x0000; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
128 |
static const unsigned int constant_opt = 0x0001; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
129 |
static const unsigned int retain_opt = 0x0002; |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
130 |
static const unsigned int non_retain_opt = 0x0003; |
536
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
131 |
#endif |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
132 |
|
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
133 |
symbol_c * get_decl (symbol_c *variable_instance_name); |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
134 |
vt_t get_vartype(symbol_c *variable_instance_name); |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
135 |
opt_t get_option (symbol_c *variable_instance_name); |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
136 |
|
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
137 |
private: |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
138 |
symbol_c *search_scope; |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
139 |
symbol_c *search_name; |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
140 |
symbol_c *current_type_decl; |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
141 |
/* variable used to store the type of variable currently being processed... */ |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
142 |
/* Will contain a single value of generate_c_vardecl_c::XXXX_vt */ |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
143 |
vt_t current_vartype; |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
144 |
opt_t current_option; |
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
145 |
|
563b013ec670
Change constants into enums.
Mario de Sousa <msousa@fe.up.pt>
parents:
533
diff
changeset
|
146 |
|
181 | 147 |
private: |
148 |
/***************************/ |
|
149 |
/* B 0 - Programming Model */ |
|
150 |
/***************************/ |
|
151 |
void *visit(library_c *symbol); |
|
152 |
||
153 |
/******************************************/ |
|
154 |
/* B 1.4.3 - Declaration & Initialisation */ |
|
155 |
/******************************************/ |
|
217
f5dfadf5de54
Adding support for declare, init, get and set macros
laurent
parents:
202
diff
changeset
|
156 |
|
181 | 157 |
/* edge -> The F_EDGE or R_EDGE directive */ |
158 |
// SYM_REF2(edge_declaration_c, edge, var1_list) |
|
159 |
// TODO |
|
507
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
160 |
void *visit(constant_option_c *symbol); |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
161 |
void *visit(retain_option_c *symbol); |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
162 |
void *visit(non_retain_option_c *symbol); |
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
163 |
|
30b31d8f6d0f
Determine the modifiers (CONST, REATAIN) used when declaring a variable.
manuele.conti@sirius-es.it
parents:
504
diff
changeset
|
164 |
|
181 | 165 |
void *visit(input_declarations_c *symbol); |
166 |
/* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */ |
|
167 |
/* option -> may be NULL ! */ |
|
168 |
void *visit(output_declarations_c *symbol); |
|
169 |
/* VAR_IN_OUT var_declaration_list END_VAR */ |
|
170 |
void *visit(input_output_declarations_c *symbol); |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
171 |
/* ENO : BOOL */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
181
diff
changeset
|
172 |
void *visit(eno_param_declaration_c *symbol); |
181 | 173 |
/* VAR [CONSTANT] var_init_decl_list END_VAR */ |
174 |
/* option -> may be NULL ! */ |
|
175 |
/* helper symbol for input_declarations */ |
|
176 |
void *visit(var_declarations_c *symbol); |
|
177 |
/* VAR RETAIN var_init_decl_list END_VAR */ |
|
178 |
void *visit(retentive_var_declarations_c *symbol); |
|
179 |
/* VAR [CONSTANT|RETAIN|NON_RETAIN] located_var_decl_list END_VAR */ |
|
180 |
/* option -> may be NULL ! */ |
|
181 |
//SYM_REF2(located_var_declarations_c, option, located_var_decl_list) |
|
182 |
void *visit(located_var_declarations_c *symbol); |
|
183 |
/*| VAR_EXTERNAL [CONSTANT] external_declaration_list END_VAR */ |
|
184 |
/* option -> may be NULL ! */ |
|
185 |
//SYM_REF2(external_var_declarations_c, option, external_declaration_list) |
|
186 |
void *visit(external_var_declarations_c *symbol); |
|
187 |
/*| VAR_GLOBAL [CONSTANT|RETAIN] global_var_decl_list END_VAR */ |
|
188 |
/* option -> may be NULL ! */ |
|
189 |
//SYM_REF2(global_var_declarations_c, option, global_var_decl_list) |
|
190 |
void *visit(global_var_declarations_c *symbol); |
|
191 |
/* var1_list is one of the following... |
|
192 |
* simple_spec_init_c * |
|
193 |
* subrange_spec_init_c * |
|
194 |
* enumerated_spec_init_c * |
|
195 |
*/ |
|
196 |
// SYM_REF2(var1_init_decl_c, var1_list, spec_init) |
|
197 |
void *visit(var1_init_decl_c *symbol); |
|
198 |
/* var1_list ',' variable_name */ |
|
199 |
// SYM_LIST(var1_list_c) |
|
200 |
void *visit(var1_list_c *symbol); |
|
201 |
/* name_list ':' function_block_type_name ASSIGN structure_initialization */ |
|
202 |
/* structure_initialization -> may be NULL ! */ |
|
203 |
void *visit(fb_name_decl_c *symbol); |
|
204 |
/* name_list ',' fb_name */ |
|
205 |
void *visit(fb_name_list_c *symbol); |
|
206 |
/* var1_list ':' array_spec_init */ |
|
207 |
// SYM_REF2(array_var_init_decl_c, var1_list, array_spec_init) |
|
208 |
void *visit(array_var_init_decl_c *symbol); |
|
209 |
/* var1_list ':' initialized_structure */ |
|
210 |
// SYM_REF2(structured_var_init_decl_c, var1_list, initialized_structure) |
|
211 |
void *visit(structured_var_init_decl_c *symbol); |
|
212 |
/* var1_list ':' array_specification */ |
|
213 |
// SYM_REF2(array_var_declaration_c, var1_list, array_specification) |
|
214 |
void *visit(array_var_declaration_c *symbol); |
|
215 |
/* var1_list ':' structure_type_name */ |
|
216 |
// SYM_REF2(structured_var_declaration_c, var1_list, structure_type_name) |
|
217 |
void *visit(structured_var_declaration_c *symbol); |
|
218 |
/* [variable_name] location ':' located_var_spec_init */ |
|
219 |
/* variable_name -> may be NULL ! */ |
|
220 |
// SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused) |
|
221 |
// TODO!! |
|
222 |
||
223 |
/* global_var_name ':' (simple_specification|subrange_specification|enumerated_specification|array_specification|prev_declared_structure_type_name|function_block_type_name */ |
|
224 |
// SYM_REF2(external_declaration_c, global_var_name, specification) |
|
225 |
void *visit(external_declaration_c *symbol); |
|
226 |
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */ |
|
227 |
/* type_specification ->may be NULL ! */ |
|
228 |
// SYM_REF2(global_var_decl_c, global_var_spec, type_specification) |
|
229 |
void *visit(global_var_decl_c *symbol); |
|
230 |
/*| global_var_name location */ |
|
231 |
//SYM_REF2(global_var_spec_c, global_var_name, location) |
|
232 |
void *visit(global_var_spec_c *symbol); |
|
233 |
/*| global_var_list ',' global_var_name */ |
|
234 |
//SYM_LIST(global_var_list_c) |
|
235 |
void *visit(global_var_list_c *symbol); |
|
236 |
/* [variable_name] location ':' located_var_spec_init */ |
|
237 |
/* variable_name -> may be NULL ! */ |
|
238 |
//SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused) |
|
239 |
void *visit(located_var_decl_c *symbol); |
|
240 |
/*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */ |
|
241 |
/* type_specification ->may be NULL ! */ |
|
242 |
// SYM_REF2(global_var_decl_c, global_var_spec, type_specification) |
|
243 |
// TODO!! |
|
244 |
/* AT direct_variable */ |
|
245 |
// SYM_REF2(location_c, direct_variable, unused) |
|
246 |
void *visit(location_c *symbol); |
|
247 |
/*| global_var_list ',' global_var_name */ |
|
248 |
// SYM_LIST(global_var_list_c) |
|
249 |
// TODO!! |
|
250 |
/* var1_list ':' single_byte_string_spec */ |
|
251 |
// SYM_REF2(single_byte_string_var_declaration_c, var1_list, single_byte_string_spec) |
|
252 |
void *visit(single_byte_string_var_declaration_c *symbol); |
|
253 |
/* STRING ['[' integer ']'] [ASSIGN single_byte_character_string] */ |
|
254 |
/* integer ->may be NULL ! */ |
|
255 |
/* single_byte_character_string ->may be NULL ! */ |
|
256 |
// SYM_REF2(single_byte_string_spec_c, integer, single_byte_character_string) |
|
257 |
// TODO!! |
|
258 |
||
259 |
/* var1_list ':' double_byte_string_spec */ |
|
260 |
// SYM_REF2(double_byte_string_var_declaration_c, var1_list, double_byte_string_spec) |
|
261 |
void *visit(double_byte_string_var_declaration_c *symbol); |
|
262 |
/* WSTRING ['[' integer ']'] [ASSIGN double_byte_character_string] */ |
|
263 |
/* integer ->may be NULL ! */ |
|
264 |
/* double_byte_character_string ->may be NULL ! */ |
|
265 |
// SYM_REF2(double_byte_string_spec_c, integer, double_byte_character_string) |
|
266 |
// TODO!! |
|
267 |
||
268 |
/* variable_name incompl_location ':' var_spec */ |
|
269 |
// SYM_REF4(incompl_located_var_decl_c, variable_name, incompl_location, var_spec, unused) |
|
270 |
// TODO!! |
|
271 |
||
272 |
/* AT incompl_location_token */ |
|
273 |
// SYM_TOKEN(incompl_location_c) |
|
274 |
// TODO!! |
|
275 |
||
276 |
||
277 |
/**************************************/ |
|
278 |
/* B.1.5 - Program organization units */ |
|
279 |
/**************************************/ |
|
280 |
/***********************/ |
|
281 |
/* B 1.5.1 - Functions */ |
|
282 |
/***********************/ |
|
283 |
// SYM_REF4(function_declaration_c, derived_function_name, type_name, var_declarations_list, function_body) |
|
284 |
void *visit(function_declaration_c *symbol); |
|
285 |
||
286 |
/*****************************/ |
|
287 |
/* B 1.5.2 - Function Blocks */ |
|
288 |
/*****************************/ |
|
289 |
void *visit(function_block_declaration_c *symbol); |
|
290 |
||
291 |
/**********************/ |
|
292 |
/* B 1.5.3 - Programs */ |
|
293 |
/**********************/ |
|
294 |
void *visit(program_declaration_c *symbol); |
|
295 |
||
619
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
296 |
/*********************************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
297 |
/* B.1.6 Sequential function chart elements */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
298 |
/*********************************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
299 |
/* | sequential_function_chart sfc_network */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
300 |
// SYM_LIST(sequential_function_chart_c) |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
301 |
/* search_var_instance_decl_c inherits from serach_visitor_c, so no need to implement the following method. */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
302 |
// void *visit(sequential_function_chart_c *symbol); |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
303 |
|
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
304 |
/* initial_step {step | transition | action} */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
305 |
// SYM_LIST(sfc_network_c) |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
306 |
/* search_var_instance_decl_c inherits from serach_visitor_c, so no need to implement the following method. */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
307 |
// void *visit(sfc_network_c *symbol); |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
308 |
|
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
309 |
|
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
310 |
/* INITIAL_STEP step_name ':' action_association_list END_STEP */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
311 |
// SYM_REF2(initial_step_c, step_name, action_association_list) |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
312 |
void *visit(initial_step_c *symbol); |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
313 |
|
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
314 |
/* STEP step_name ':' action_association_list END_STEP */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
315 |
// SYM_REF2(step_c, step_name, action_association_list) |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
316 |
void *visit(step_c *symbol); |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
317 |
|
181 | 318 |
/********************************/ |
319 |
/* B 1.7 Configuration elements */ |
|
320 |
/********************************/ |
|
321 |
||
322 |
/* |
|
323 |
CONFIGURATION configuration_name |
|
324 |
optional_global_var_declarations |
|
325 |
(resource_declaration_list | single_resource_declaration) |
|
326 |
optional_access_declarations |
|
327 |
optional_instance_specific_initializations |
|
328 |
END_CONFIGURATION |
|
329 |
*/ |
|
330 |
/* |
|
331 |
SYM_REF6(configuration_declaration_c, configuration_name, global_var_declarations, resource_declarations, access_declarations, instance_specific_initializations, unused) |
|
332 |
*/ |
|
333 |
void *visit(configuration_declaration_c *symbol); |
|
334 |
/* |
|
335 |
RESOURCE resource_name ON resource_type_name |
|
336 |
optional_global_var_declarations |
|
337 |
single_resource_declaration |
|
338 |
END_RESOURCE |
|
339 |
*/ |
|
340 |
// SYM_REF4(resource_declaration_c, resource_name, resource_type_name, global_var_declarations, resource_declaration) |
|
341 |
void *visit(resource_declaration_c *symbol); |
|
342 |
||
343 |
/* task_configuration_list program_configuration_list */ |
|
344 |
// SYM_REF2(single_resource_declaration_c, task_configuration_list, program_configuration_list) |
|
345 |
void *visit(single_resource_declaration_c *symbol); |
|
346 |
||
619
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
347 |
|
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
348 |
/****************************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
349 |
/* B.2 - Language IL (Instruction List) */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
350 |
/****************************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
351 |
/***********************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
352 |
/* B 2.1 Instructions and Operands */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
353 |
/***********************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
354 |
/*| instruction_list il_instruction */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
355 |
// SYM_LIST(instruction_list_c) |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
356 |
void *visit(instruction_list_c *symbol); |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
357 |
|
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
358 |
|
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
359 |
/***************************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
360 |
/* B.3 - Language ST (Structured Text) */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
361 |
/***************************************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
362 |
/********************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
363 |
/* B 3.2 Statements */ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
364 |
/********************/ |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
365 |
// SYM_LIST(statement_list_c) |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
366 |
void *visit(statement_list_c *symbol); |
f8c9ac5c529a
Support for data types of STEP.T and STEP.X in SFCs
Mario de Sousa <msousa@fe.up.pt>
parents:
536
diff
changeset
|
367 |
|
181 | 368 |
}; // search_var_instance_decl_c |
369 |