]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-compiler/PCSymBuild.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-compiler / PCSymBuild.def
1 (* PCSymBuild.def pass C symbol creation.
2
3 Copyright (C) 2001-2023 Free Software Foundation, Inc.
4 Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
5
6 This file is part of GNU Modula-2.
7
8 GNU Modula-2 is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GNU Modula-2 is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GNU Modula-2; see the file COPYING3. If not see
20 <http://www.gnu.org/licenses/>. *)
21
22 DEFINITION MODULE PCSymBuild ;
23
24 (*
25 Title : PCSymBuild
26 Author : Gaius Mulley
27 System : UNIX (GNU Modula-2)
28 Description: provides scope mainstance for Pass C it also resolves
29 the import/export symbols and assigns types to constructors.
30 *)
31
32 EXPORT QUALIFIED PCStartBuildDefModule,
33 PCEndBuildDefModule,
34 PCStartBuildImpModule,
35 PCEndBuildImpModule,
36 PCStartBuildProgModule,
37 PCEndBuildProgModule,
38 PCStartBuildInnerModule,
39 PCEndBuildInnerModule,
40 PCBuildProcedureHeading,
41 PCStartBuildProcedure,
42 PCEndBuildProcedure,
43 BuildNulName,
44 BuildConst,
45 PCBuildImportOuterModule,
46 PCBuildImportInnerModule,
47 StartDesConst,
48 EndDesConst,
49 BuildRelationConst,
50 BuildUnaryConst,
51 BuildBinaryConst,
52 PushInConstructor,
53 PopInConstructor,
54 SkipConst,
55 PushConstType,
56 PushConstAttributeType,
57 PushConstAttributePairType,
58 PushConstructorCastType,
59 PushRType,
60 PushConstFunctionType,
61 PushIntegerType,
62 PushStringType,
63 ResolveConstTypes ;
64
65
66 (*
67 StartBuildDefinitionModule - Creates a definition module and starts
68 a new scope.
69
70 The Stack is expected:
71
72 Entry Exit
73
74 Ptr -> <- Ptr
75 +------------+ +-----------+
76 | NameStart | | NameStart |
77 |------------| |-----------|
78
79 *)
80
81 PROCEDURE PCStartBuildDefModule ;
82
83
84 (*
85 EndBuildDefinitionModule - Destroys the definition module scope and
86 checks for correct name.
87
88 The Stack is expected:
89
90 Entry Exit
91
92 Ptr ->
93 +------------+ +-----------+
94 | NameEnd | | |
95 |------------| |-----------|
96 | NameStart | | | <- Ptr
97 |------------| |-----------|
98 *)
99
100 PROCEDURE PCEndBuildDefModule ;
101
102
103 (*
104 StartBuildImplementationModule - Creates an implementation module and starts
105 a new scope.
106
107 The Stack is expected:
108
109 Entry Exit
110
111 Ptr -> <- Ptr
112 +------------+ +-----------+
113 | NameStart | | NameStart |
114 |------------| |-----------|
115
116 *)
117
118 PROCEDURE PCStartBuildImpModule ;
119
120
121 (*
122 EndBuildImplementationModule - Destroys the implementation module scope and
123 checks for correct name.
124
125 The Stack is expected:
126
127 Entry Exit
128
129 Ptr ->
130 +------------+ +-----------+
131 | NameEnd | | |
132 |------------| |-----------|
133 | NameStart | | | <- Ptr
134 |------------| |-----------|
135 *)
136
137 PROCEDURE PCEndBuildImpModule ;
138
139
140 (*
141 StartBuildProgramModule - Creates a program module and starts
142 a new scope.
143
144 The Stack is expected:
145
146 Entry Exit
147
148 Ptr -> <- Ptr
149 +------------+ +-----------+
150 | NameStart | | NameStart |
151 |------------| |-----------|
152
153 *)
154
155 PROCEDURE PCStartBuildProgModule ;
156
157
158 (*
159 EndBuildProgramModule - Destroys the program module scope and
160 checks for correct name.
161
162 The Stack is expected:
163
164 Entry Exit
165
166 Ptr ->
167 +------------+ +-----------+
168 | NameEnd | | |
169 |------------| |-----------|
170 | NameStart | | | <- Ptr
171 |------------| |-----------|
172 *)
173
174 PROCEDURE PCEndBuildProgModule ;
175
176
177 (*
178 StartBuildInnerModule - Creates an Inner module and starts
179 a new scope.
180
181 The Stack is expected:
182
183 Entry Exit
184
185 Ptr -> <- Ptr
186 +------------+ +-----------+
187 | NameStart | | NameStart |
188 |------------| |-----------|
189
190 *)
191
192 PROCEDURE PCStartBuildInnerModule ;
193
194
195 (*
196 EndBuildInnermModule - Destroys the Inner module scope and
197 checks for correct name.
198
199 The Stack is expected:
200
201 Entry Exit
202
203 Ptr ->
204 +------------+ +-----------+
205 | NameEnd | | |
206 |------------| |-----------|
207 | NameStart | | | <- Ptr
208 |------------| |-----------|
209 *)
210
211 PROCEDURE PCEndBuildInnerModule ;
212
213
214 (*
215 BuildProcedureHeading - Builds a procedure heading for the definition
216 module procedures.
217
218 Operation only performed if compiling a
219 definition module.
220
221 The Stack:
222
223 Entry Exit
224
225 Ptr ->
226 +------------+
227 | ProcSym | Empty
228 |------------|
229
230 *)
231
232 PROCEDURE PCBuildProcedureHeading ;
233
234
235 (*
236 StartBuildProcedure - Builds a Procedure.
237
238 The Stack:
239
240 Entry Exit
241
242 <- Ptr
243 +------------+
244 Ptr -> | ProcSym |
245 +------------+ |------------|
246 | Name | | Name |
247 |------------| |------------|
248 *)
249
250 PROCEDURE PCStartBuildProcedure ;
251
252
253 (*
254 EndBuildProcedure - Ends building a Procedure.
255 It checks the start procedure name matches the end
256 procedure name.
257
258 The Stack:
259
260
261 Entry Exit
262
263 Ptr ->
264 +------------+
265 | NameEnd |
266 |------------|
267 | ProcSym |
268 |------------|
269 | NameStart |
270 |------------|
271 Empty
272 *)
273
274 PROCEDURE PCEndBuildProcedure ;
275
276
277 (*
278 BuildImportOuterModule - Builds imported identifiers into an outer module
279 from a definition module.
280
281 The Stack is expected:
282
283 Entry OR Entry
284
285 Ptr -> Ptr ->
286 +------------+ +-----------+
287 | # | | # |
288 |------------| |-----------|
289 | Id1 | | Id1 |
290 |------------| |-----------|
291 . . . .
292 . . . .
293 . . . .
294 |------------| |-----------|
295 | Id# | | Id# |
296 |------------| |-----------|
297 | ImportTok | | Ident |
298 |------------| |-----------|
299
300 IMPORT Id1, .. Id# ; FROM Ident IMPORT Id1 .. Id# ;
301
302
303 Exit
304
305 All above stack discarded
306 *)
307
308 PROCEDURE PCBuildImportOuterModule ;
309
310
311 (*
312 BuildImportInnerModule - Builds imported identifiers into an inner module
313 from the last level of module.
314
315 The Stack is expected:
316
317 Entry OR Entry
318
319 Ptr -> Ptr ->
320 +------------+ +-----------+
321 | # | | # |
322 |------------| |-----------|
323 | Id1 | | Id1 |
324 |------------| |-----------|
325 . . . .
326 . . . .
327 . . . .
328 |------------| |-----------|
329 | Id# | | Id# |
330 |------------| |-----------|
331 | ImportTok | | Ident |
332 |------------| |-----------|
333
334 IMPORT Id1, .. Id# ; FROM Ident IMPORT Id1 .. Id# ;
335
336
337 Error Condition
338 Exit
339
340 All above stack discarded
341 *)
342
343 PROCEDURE PCBuildImportInnerModule ;
344
345
346 (*
347 BuildNulName - Pushes a NulKey onto the top of the stack.
348 The Stack:
349
350
351 Entry Exit
352
353 <- Ptr
354 Empty +------------+
355 | NulKey |
356 |------------|
357 *)
358
359 PROCEDURE BuildNulName ;
360
361
362 (*
363 BuildConst - builds a constant.
364 Stack
365
366 Entry Exit
367
368 Ptr -> <- Ptr
369 +------------+ +------------+
370 | Name | | Sym |
371 |------------+ |------------|
372 *)
373
374 PROCEDURE BuildConst ;
375
376
377 (*
378 StartDesConst -
379 *)
380
381 PROCEDURE StartDesConst ;
382
383
384 (*
385 EndDesConst -
386 *)
387
388 PROCEDURE EndDesConst ;
389
390
391 (*
392 BuildRelationConst - builds a relationship binary operation.
393 *)
394
395 PROCEDURE BuildRelationConst ;
396
397
398 (*
399 BuildUnaryConst - builds a unary operator node.
400 *)
401
402 PROCEDURE BuildUnaryConst ;
403
404
405 (*
406 BuildBinaryConst - builds a binary operator node.
407 *)
408
409 PROCEDURE BuildBinaryConst ;
410
411
412 (*
413 PushConstFunctionType -
414 *)
415
416 PROCEDURE PushConstFunctionType ;
417
418
419 (*
420 PushIntegerType - pushes a ztype or char leaf.
421 *)
422
423 PROCEDURE PushIntegerType ;
424
425
426 (*
427 PushRType -
428 *)
429
430 PROCEDURE PushRType ;
431
432
433 (*
434 PushStringType -
435 *)
436
437 PROCEDURE PushStringType ;
438
439
440 (*
441 SkipConst - returns an alias to constant, sym, if one exists.
442 Otherwise sym is returned.
443 *)
444
445 PROCEDURE SkipConst (sym: CARDINAL) : CARDINAL ;
446
447
448 (*
449 PushConstType - pushes a constant to the expression stack.
450 *)
451
452 PROCEDURE PushConstType ;
453
454
455 (*
456 PushConstAttributeType -
457 *)
458
459 PROCEDURE PushConstAttributeType ;
460
461
462 (*
463 PushConstAttributePairType -
464 *)
465
466 PROCEDURE PushConstAttributePairType ;
467
468
469 (*
470 PushConstructorCastType -
471 *)
472
473 PROCEDURE PushConstructorCastType ;
474
475
476 (*
477 PushInConstructor -
478 *)
479
480 PROCEDURE PushInConstructor ;
481
482
483 (*
484 PopInConstructor -
485 *)
486
487 PROCEDURE PopInConstructor ;
488
489
490 (*
491 ResolveConstTypes - resolves the types of all designator declared constants.
492 *)
493
494 PROCEDURE ResolveConstTypes ;
495
496
497 END PCSymBuild.