author | Mario de Sousa <msousa@fe.up.pt> |
Mon, 04 Apr 2011 14:32:21 +0100 | |
changeset 274 | 8d36d1f81170 |
parent 265 | 4d222f46f8cc |
child 279 | c0453b7f99df |
permissions | -rwxr-xr-x |
181 | 1 |
/* |
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
257
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:
257
diff
changeset
|
3 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
4 |
* Copyright (C) 2003-2011 Mario de Sousa (msousa@fe.up.pt) |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
5 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
6 |
* 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:
257
diff
changeset
|
7 |
* 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:
257
diff
changeset
|
8 |
* 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:
257
diff
changeset
|
9 |
* (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:
257
diff
changeset
|
10 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
11 |
* 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:
257
diff
changeset
|
12 |
* 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:
257
diff
changeset
|
13 |
* 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:
257
diff
changeset
|
14 |
* 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:
257
diff
changeset
|
15 |
* |
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
16 |
* 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:
257
diff
changeset
|
17 |
* 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:
257
diff
changeset
|
18 |
* |
181 | 19 |
* |
20 |
* This code is made available on the understanding that it will not be |
|
21 |
* used in safety-critical situations without a full and competent review. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
265
4d222f46f8cc
Updating license info (with Edouard's permission for relevant files).
Mario de Sousa <msousa@fe.up.pt>
parents:
257
diff
changeset
|
25 |
* An IEC 61131-3 compiler. |
181 | 26 |
* |
27 |
* Based on the |
|
28 |
* FINAL DRAFT - IEC 61131-3, 2nd Ed. (2001-12-10) |
|
29 |
* |
|
30 |
*/ |
|
31 |
||
32 |
/* Determine the data type on which another data type is based on. |
|
33 |
* If a new default initial value is given, we DO NOT consider it a |
|
34 |
* new base class, and continue looking further! |
|
35 |
* |
|
36 |
* E.g. TYPE new_int_t : INT; END_TYPE; |
|
37 |
* TYPE new_int2_t : INT = 2; END_TYPE; |
|
38 |
* TYPE new_subr_t : INT (4..5); END_TYPE; |
|
39 |
* |
|
40 |
* new_int_t is really an INT!! |
|
41 |
* new_int2_t is also really an INT!! |
|
42 |
* new_subr_t is also really an INT!! |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
43 |
* |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
44 |
* Note that a FB declaration is also considered a base type, as |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
45 |
* we may have FB instances declared of a specific FB type. |
181 | 46 |
*/ |
47 |
#include "absyntax_utils.hh" |
|
48 |
||
49 |
#define ERROR error_exit(__FILE__,__LINE__) |
|
50 |
/* function defined in main.cc */ |
|
51 |
extern void error_exit(const char *file_name, int line_no); |
|
52 |
||
53 |
||
54 |
||
55 |
search_base_type_c::search_base_type_c(void) {current_type_name = NULL;} |
|
56 |
||
57 |
void *search_base_type_c::visit(identifier_c *type_name) { |
|
58 |
this->current_type_name = type_name; |
|
59 |
/* look up the type declaration... */ |
|
60 |
symbol_c *type_decl = type_symtable.find_value(type_name); |
|
61 |
if (type_decl == type_symtable.end_value()) |
|
62 |
/* Type declaration not found!! */ |
|
63 |
ERROR; |
|
64 |
||
65 |
return type_decl->accept(*this); |
|
66 |
} |
|
67 |
||
68 |
bool search_base_type_c::type_is_subrange(symbol_c* type_decl) { |
|
69 |
this->is_subrange = false; |
|
70 |
type_decl->accept(*this); |
|
71 |
return this->is_subrange; |
|
72 |
} |
|
73 |
||
74 |
bool search_base_type_c::type_is_enumerated(symbol_c* type_decl) { |
|
75 |
this->is_enumerated = false; |
|
76 |
type_decl->accept(*this); |
|
77 |
return this->is_enumerated; |
|
78 |
} |
|
79 |
||
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
80 |
/*********************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
81 |
/* B 1.2 - Constants */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
82 |
/*********************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
83 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
84 |
/******************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
85 |
/* B 1.2.1 - Numeric Literals */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
86 |
/******************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
87 |
/* Numeric literals without any explicit type cast have unknown data type, |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
88 |
* so we continue considering them as their own basic data types until |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
89 |
* they can be resolved (for example, when using '30+x' where 'x' is a LINT variable, the |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
90 |
* numeric literal '30' must then be considered a LINT so the ADD function may be called |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
91 |
* with all inputs of the same data type. |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
92 |
* If 'x' were a SINT, then the '30' would have to be a SINT too! |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
93 |
*/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
94 |
void *search_base_type_c::visit(real_c *symbol) {return (void *)symbol;} |
257 | 95 |
void *search_base_type_c::visit(neg_real_c *symbol) {return (void *)symbol;} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
96 |
void *search_base_type_c::visit(integer_c *symbol) {return (void *)symbol;} |
257 | 97 |
void *search_base_type_c::visit(neg_integer_c *symbol) {return (void *)symbol;} |
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
98 |
void *search_base_type_c::visit(binary_integer_c *symbol) {return (void *)symbol;} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
99 |
void *search_base_type_c::visit(octal_integer_c *symbol) {return (void *)symbol;} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
100 |
void *search_base_type_c::visit(hex_integer_c *symbol) {return (void *)symbol;} |
257 | 101 |
void *search_base_type_c::visit(boolean_true_c *symbol) {return (void *)symbol;} |
102 |
void *search_base_type_c::visit(boolean_false_c *symbol) {return (void *)symbol;} |
|
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
103 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
104 |
|
181 | 105 |
/***********************************/ |
106 |
/* B 1.3.1 - Elementary Data Types */ |
|
107 |
/***********************************/ |
|
108 |
void *search_base_type_c::visit(time_type_name_c *symbol) {return (void *)symbol;} |
|
109 |
void *search_base_type_c::visit(bool_type_name_c *symbol) {return (void *)symbol;} |
|
110 |
void *search_base_type_c::visit(sint_type_name_c *symbol) {return (void *)symbol;} |
|
111 |
void *search_base_type_c::visit(int_type_name_c *symbol) {return (void *)symbol;} |
|
112 |
void *search_base_type_c::visit(dint_type_name_c *symbol) {return (void *)symbol;} |
|
113 |
void *search_base_type_c::visit(lint_type_name_c *symbol) {return (void *)symbol;} |
|
114 |
void *search_base_type_c::visit(usint_type_name_c *symbol) {return (void *)symbol;} |
|
115 |
void *search_base_type_c::visit(uint_type_name_c *symbol) {return (void *)symbol;} |
|
116 |
void *search_base_type_c::visit(udint_type_name_c *symbol) {return (void *)symbol;} |
|
117 |
void *search_base_type_c::visit(ulint_type_name_c *symbol) {return (void *)symbol;} |
|
118 |
void *search_base_type_c::visit(real_type_name_c *symbol) {return (void *)symbol;} |
|
119 |
void *search_base_type_c::visit(lreal_type_name_c *symbol) {return (void *)symbol;} |
|
120 |
void *search_base_type_c::visit(date_type_name_c *symbol) {return (void *)symbol;} |
|
121 |
void *search_base_type_c::visit(tod_type_name_c *symbol) {return (void *)symbol;} |
|
122 |
void *search_base_type_c::visit(dt_type_name_c *symbol) {return (void *)symbol;} |
|
123 |
void *search_base_type_c::visit(byte_type_name_c *symbol) {return (void *)symbol;} |
|
124 |
void *search_base_type_c::visit(word_type_name_c *symbol) {return (void *)symbol;} |
|
125 |
void *search_base_type_c::visit(dword_type_name_c *symbol) {return (void *)symbol;} |
|
126 |
void *search_base_type_c::visit(lword_type_name_c *symbol) {return (void *)symbol;} |
|
127 |
void *search_base_type_c::visit(string_type_name_c *symbol) {return (void *)symbol;} |
|
128 |
void *search_base_type_c::visit(wstring_type_name_c *symbol) {return (void *)symbol;} |
|
257 | 129 |
|
130 |
||
181 | 131 |
/******************************************************/ |
132 |
/* Extensions to the base standard as defined in */ |
|
133 |
/* "Safety Software Technical Specification, */ |
|
134 |
/* Part 1: Concepts and Function Blocks, */ |
|
135 |
/* Version 1.0 – Official Release" */ |
|
136 |
/* by PLCopen - Technical Committee 5 - 2006-01-31 */ |
|
137 |
/******************************************************/ |
|
257 | 138 |
|
139 |
void *search_base_type_c::visit(safetime_type_name_c *symbol) {return (void *)symbol;} |
|
140 |
void *search_base_type_c::visit(safebool_type_name_c *symbol) {return (void *)symbol;} |
|
141 |
void *search_base_type_c::visit(safesint_type_name_c *symbol) {return (void *)symbol;} |
|
142 |
void *search_base_type_c::visit(safeint_type_name_c *symbol) {return (void *)symbol;} |
|
143 |
void *search_base_type_c::visit(safedint_type_name_c *symbol) {return (void *)symbol;} |
|
144 |
void *search_base_type_c::visit(safelint_type_name_c *symbol) {return (void *)symbol;} |
|
145 |
void *search_base_type_c::visit(safeusint_type_name_c *symbol) {return (void *)symbol;} |
|
146 |
void *search_base_type_c::visit(safeuint_type_name_c *symbol) {return (void *)symbol;} |
|
147 |
void *search_base_type_c::visit(safeudint_type_name_c *symbol) {return (void *)symbol;} |
|
148 |
void *search_base_type_c::visit(safeulint_type_name_c *symbol) {return (void *)symbol;} |
|
149 |
void *search_base_type_c::visit(safereal_type_name_c *symbol) {return (void *)symbol;} |
|
150 |
void *search_base_type_c::visit(safelreal_type_name_c *symbol) {return (void *)symbol;} |
|
151 |
void *search_base_type_c::visit(safedate_type_name_c *symbol) {return (void *)symbol;} |
|
152 |
void *search_base_type_c::visit(safetod_type_name_c *symbol) {return (void *)symbol;} |
|
153 |
void *search_base_type_c::visit(safedt_type_name_c *symbol) {return (void *)symbol;} |
|
154 |
void *search_base_type_c::visit(safebyte_type_name_c *symbol) {return (void *)symbol;} |
|
155 |
void *search_base_type_c::visit(safeword_type_name_c *symbol) {return (void *)symbol;} |
|
156 |
void *search_base_type_c::visit(safedword_type_name_c *symbol) {return (void *)symbol;} |
|
157 |
void *search_base_type_c::visit(safelword_type_name_c *symbol) {return (void *)symbol;} |
|
158 |
void *search_base_type_c::visit(safestring_type_name_c *symbol) {return (void *)symbol;} |
|
159 |
void *search_base_type_c::visit(safewstring_type_name_c *symbol) {return (void *)symbol;} |
|
181 | 160 |
|
161 |
/********************************/ |
|
162 |
/* B 1.3.3 - Derived data types */ |
|
163 |
/********************************/ |
|
164 |
/* simple_type_name ':' simple_spec_init */ |
|
165 |
void *search_base_type_c::visit(simple_type_declaration_c *symbol) { |
|
166 |
return symbol->simple_spec_init->accept(*this); |
|
167 |
} |
|
168 |
/* simple_specification ASSIGN constant */ |
|
169 |
void *search_base_type_c::visit(simple_spec_init_c *symbol) { |
|
170 |
return symbol->simple_specification->accept(*this); |
|
171 |
} |
|
172 |
||
173 |
/* subrange_type_name ':' subrange_spec_init */ |
|
174 |
void *search_base_type_c::visit(subrange_type_declaration_c *symbol) { |
|
175 |
return symbol->subrange_spec_init->accept(*this); |
|
176 |
} |
|
177 |
||
178 |
/* subrange_specification ASSIGN signed_integer */ |
|
179 |
void *search_base_type_c::visit(subrange_spec_init_c *symbol) { |
|
180 |
this->is_subrange = true; |
|
181 |
return symbol->subrange_specification->accept(*this); |
|
182 |
} |
|
183 |
||
184 |
/* integer_type_name '(' subrange')' */ |
|
185 |
void *search_base_type_c::visit(subrange_specification_c *symbol) { |
|
186 |
return symbol->integer_type_name->accept(*this); |
|
187 |
} |
|
188 |
||
189 |
/* signed_integer DOTDOT signed_integer */ |
|
190 |
void *search_base_type_c::visit(subrange_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
191 |
||
192 |
/* enumerated_type_name ':' enumerated_spec_init */ |
|
193 |
void *search_base_type_c::visit(enumerated_type_declaration_c *symbol) { |
|
194 |
this->current_type_name = symbol->enumerated_type_name; |
|
195 |
return symbol->enumerated_spec_init->accept(*this); |
|
196 |
} |
|
197 |
||
198 |
/* enumerated_specification ASSIGN enumerated_value */ |
|
199 |
void *search_base_type_c::visit(enumerated_spec_init_c *symbol) { |
|
200 |
this->is_enumerated = true; |
|
201 |
return symbol->enumerated_specification->accept(*this); |
|
202 |
} |
|
203 |
||
204 |
/* helper symbol for enumerated_specification->enumerated_spec_init */ |
|
205 |
/* enumerated_value_list ',' enumerated_value */ |
|
206 |
void *search_base_type_c::visit(enumerated_value_list_c *symbol) { |
|
207 |
if (NULL == this->current_type_name) ERROR; |
|
208 |
return (void *)this->current_type_name; |
|
209 |
} |
|
210 |
||
211 |
/* enumerated_type_name '#' identifier */ |
|
212 |
// SYM_REF2(enumerated_value_c, type, value) |
|
213 |
void *search_base_type_c::visit(enumerated_value_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
214 |
||
215 |
/* identifier ':' array_spec_init */ |
|
216 |
void *search_base_type_c::visit(array_type_declaration_c *symbol) { |
|
217 |
this->current_type_name = symbol->identifier; |
|
218 |
return symbol->array_spec_init->accept(*this); |
|
219 |
} |
|
220 |
||
221 |
/* array_specification [ASSIGN array_initialization} */ |
|
222 |
/* array_initialization may be NULL ! */ |
|
223 |
void *search_base_type_c::visit(array_spec_init_c *symbol) { |
|
224 |
return symbol->array_specification->accept(*this); |
|
225 |
} |
|
226 |
||
227 |
/* ARRAY '[' array_subrange_list ']' OF non_generic_type_name */ |
|
228 |
void *search_base_type_c::visit(array_specification_c *symbol) { |
|
229 |
if (NULL == this->current_type_name) ERROR; |
|
230 |
return symbol->non_generic_type_name->accept(*this); |
|
231 |
} |
|
232 |
||
233 |
/* helper symbol for array_specification */ |
|
234 |
/* array_subrange_list ',' subrange */ |
|
235 |
void *search_base_type_c::visit(array_subrange_list_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
236 |
||
237 |
/* array_initialization: '[' array_initial_elements_list ']' */ |
|
238 |
/* helper symbol for array_initialization */ |
|
239 |
/* array_initial_elements_list ',' array_initial_elements */ |
|
240 |
void *search_base_type_c::visit(array_initial_elements_list_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
241 |
||
242 |
/* integer '(' [array_initial_element] ')' */ |
|
243 |
/* array_initial_element may be NULL ! */ |
|
244 |
void *search_base_type_c::visit(array_initial_elements_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
245 |
||
246 |
/* structure_type_name ':' structure_specification */ |
|
247 |
/* NOTE: structure_specification will point to either a |
|
248 |
* initialized_structure_c |
|
249 |
* OR A |
|
250 |
* structure_element_declaration_list_c |
|
251 |
*/ |
|
252 |
void *search_base_type_c::visit(structure_type_declaration_c *symbol) { |
|
253 |
this->current_type_name = symbol->structure_type_name; |
|
254 |
return symbol->structure_specification->accept(*this); |
|
255 |
} |
|
256 |
||
257 |
/* structure_type_name ASSIGN structure_initialization */ |
|
258 |
/* structure_initialization may be NULL ! */ |
|
259 |
void *search_base_type_c::visit(initialized_structure_c *symbol) { |
|
260 |
return symbol->structure_type_name->accept(*this); |
|
261 |
} |
|
262 |
||
263 |
/* helper symbol for structure_declaration */ |
|
264 |
/* structure_declaration: STRUCT structure_element_declaration_list END_STRUCT */ |
|
265 |
/* structure_element_declaration_list structure_element_declaration ';' */ |
|
266 |
void *search_base_type_c::visit(structure_element_declaration_list_c *symbol) { |
|
267 |
if (NULL == this->current_type_name) ERROR; |
|
268 |
return (void *)symbol; |
|
269 |
} |
|
270 |
||
271 |
/* structure_element_name ':' *_spec_init */ |
|
272 |
void *search_base_type_c::visit(structure_element_declaration_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
273 |
||
274 |
/* helper symbol for structure_initialization */ |
|
275 |
/* structure_initialization: '(' structure_element_initialization_list ')' */ |
|
276 |
/* structure_element_initialization_list ',' structure_element_initialization */ |
|
277 |
void *search_base_type_c::visit(structure_element_initialization_list_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
278 |
||
279 |
/* structure_element_name ASSIGN value */ |
|
280 |
void *search_base_type_c::visit(structure_element_initialization_c *symbol) {ERROR; return NULL;} /* should never get called... */ |
|
281 |
||
282 |
/* string_type_name ':' elementary_string_type_name string_type_declaration_size string_type_declaration_init */ |
|
283 |
/* |
|
284 |
SYM_REF4(string_type_declaration_c, string_type_name, |
|
285 |
elementary_string_type_name, |
|
286 |
string_type_declaration_size, |
|
287 |
string_type_declaration_init) // may be == NULL! |
|
288 |
*/ |
|
289 |
void *search_base_type_c::visit(string_type_declaration_c *symbol) {return symbol;} |
|
290 |
||
202
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
291 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
292 |
|
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
293 |
/*****************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
294 |
/* B 1.5.2 - Function Blocks */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
295 |
/*****************************/ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
296 |
/* FUNCTION_BLOCK derived_function_block_name io_OR_other_var_declarations function_block_body END_FUNCTION_BLOCK */ |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
297 |
// SYM_REF3(function_block_declaration_c, fblock_name, var_declarations, fblock_body) |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
298 |
void *search_base_type_c::visit(function_block_declaration_c *symbol) { |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
299 |
return symbol; |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
300 |
} |
da1a8186f86f
Initial (very rough) version of semantic checker (stage3)
Catarina Boucinha <ccb@fe.up.pt>
parents:
194
diff
changeset
|
301 |