]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/m2/gm2-compiler/P3SymBuild.def
Update copyright years.
[thirdparty/gcc.git] / gcc / m2 / gm2-compiler / P3SymBuild.def
1 (* P3SymBuild.def pass 3 symbol creation.
2
3 Copyright (C) 2001-2024 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 P3SymBuild ;
23
24 (*
25 Title : P3SymBuild
26 Author : Gaius Mulley
27 Date : 24/6/87
28 LastEdit : 1/9/89
29 System : UNIX (GNU Modula-2)
30 Description: pass 3 symbol creation.
31 *)
32
33 (* StartBuildDefinitionModule, *)
34 (* EndBuildDefinitionModule, *)
35 (* StartBuildImplementationModule, *)
36 (* EndBuildImplementationModule, *)
37 (* StartBuildProgramModule, *)
38 (* EndBuildProgramModule, *)
39
40 EXPORT QUALIFIED P3StartBuildDefModule,
41 P3EndBuildDefModule,
42 P3StartBuildImpModule,
43 P3EndBuildImpModule,
44 P3StartBuildProgModule,
45 P3EndBuildProgModule,
46 StartBuildInnerModule,
47 EndBuildInnerModule,
48 CheckImportListOuterModule,
49 CheckCanBeImported,
50 BuildProcedureHeading,
51 StartBuildProcedure,
52 EndBuildProcedure,
53 BuildSubrange,
54 BuildNulName,
55 BuildConst,
56 BuildVarAtAddress,
57 BuildOptArgInitializer ;
58
59
60 (*
61 StartBuildDefinitionModule - Creates a definition module and starts
62 a new scope.
63
64 The Stack is expected:
65
66 Entry Exit
67
68 Ptr -> <- Ptr
69 +------------+ +-----------+
70 | NameStart | | NameStart |
71 |------------| |-----------|
72
73 *)
74
75 PROCEDURE P3StartBuildDefModule ;
76
77
78 (*
79 EndBuildDefinitionModule - Destroys the definition module scope and
80 checks for correct name.
81
82 The Stack is expected:
83
84 Entry Exit
85
86 Ptr ->
87 +------------+ +-----------+
88 | NameEnd | | |
89 |------------| |-----------|
90 | NameStart | | | <- Ptr
91 |------------| |-----------|
92 *)
93
94 PROCEDURE P3EndBuildDefModule ;
95
96
97 (*
98 StartBuildImplementationModule - Creates an implementation module and starts
99 a new scope.
100
101 The Stack is expected:
102
103 Entry Exit
104
105 Ptr -> <- Ptr
106 +------------+ +-----------+
107 | NameStart | | NameStart |
108 |------------| |-----------|
109
110 *)
111
112 PROCEDURE P3StartBuildImpModule ;
113
114
115 (*
116 EndBuildImplementationModule - Destroys the implementation module scope and
117 checks for correct name.
118
119 The Stack is expected:
120
121 Entry Exit
122
123 Ptr ->
124 +------------+ +-----------+
125 | NameEnd | | |
126 |------------| |-----------|
127 | NameStart | | | <- Ptr
128 |------------| |-----------|
129 *)
130
131 PROCEDURE P3EndBuildImpModule ;
132
133
134 (*
135 StartBuildProgramModule - Creates a program module and starts
136 a new scope.
137
138 The Stack is expected:
139
140 Entry Exit
141
142 Ptr -> <- Ptr
143 +------------+ +-----------+
144 | NameStart | | NameStart |
145 |------------| |-----------|
146
147 *)
148
149 PROCEDURE P3StartBuildProgModule ;
150
151
152 (*
153 EndBuildProgramModule - Destroys the program module scope and
154 checks for correct name.
155
156 The Stack is expected:
157
158 Entry Exit
159
160 Ptr ->
161 +------------+ +-----------+
162 | NameEnd | | |
163 |------------| |-----------|
164 | NameStart | | | <- Ptr
165 |------------| |-----------|
166 *)
167
168 PROCEDURE P3EndBuildProgModule ;
169
170
171 (*
172 CheckCanBeImported - checks to see that it is legal to import, Sym, from, ModSym.
173 *)
174
175 PROCEDURE CheckCanBeImported (ModSym, Sym: CARDINAL) ;
176
177
178 (*
179 StartBuildInnerModule - Creates an Inner module and starts
180 a new scope.
181
182 The Stack is expected:
183
184 Entry Exit
185
186 Ptr -> <- Ptr
187 +------------+ +-----------+
188 | NameStart | | NameStart |
189 |------------| |-----------|
190
191 *)
192
193 PROCEDURE StartBuildInnerModule ;
194
195
196 (*
197 EndBuildInnerModule - Destroys the Inner module scope and
198 checks for correct name.
199
200 The Stack is expected:
201
202 Entry Exit
203
204 Ptr ->
205 +------------+ +-----------+
206 | NameEnd | | |
207 |------------| |-----------|
208 | NameStart | | | <- Ptr
209 |------------| |-----------|
210 *)
211
212 PROCEDURE EndBuildInnerModule ;
213
214
215 (*
216 CheckImportListOuterModule - checks to see that all identifiers are
217 exported from the definition module.
218
219 The Stack is expected:
220
221 Entry OR Entry
222
223 Ptr -> Ptr ->
224 +------------+ +-----------+
225 | # | | # |
226 |------------| |-----------|
227 | Id1 | | Id1 |
228 |------------| |-----------|
229 . . . .
230 . . . .
231 . . . .
232 |------------| |-----------|
233 | Id# | | Id# |
234 |------------| |-----------|
235 | ImportTok | | Ident |
236 |------------| |-----------|
237
238 IMPORT Id1, .. Id# ; FROM Ident IMPORT Id1 .. Id# ;
239
240
241 Error Condition
242 Exit
243
244 All above stack discarded
245 *)
246
247 PROCEDURE CheckImportListOuterModule ;
248
249
250 (*
251 BuildProcedureHeading - Builds a procedure heading for the definition
252 module procedures.
253
254 Operation only performed if compiling a
255 definition module.
256
257 The Stack:
258
259 Entry Exit
260
261 Ptr ->
262 +------------+
263 | ProcSym | Empty
264 |------------|
265
266 *)
267
268 PROCEDURE BuildProcedureHeading ;
269
270
271 (*
272 StartBuildProcedure - Builds a Procedure.
273
274 The Stack:
275
276 Entry Exit
277
278 <- Ptr
279 +------------+
280 Ptr -> | ProcSym |
281 +------------+ |------------|
282 | Name | | Name |
283 |------------| |------------|
284 *)
285
286 PROCEDURE StartBuildProcedure ;
287
288
289 (*
290 EndBuildProcedure - Ends building a Procedure.
291 It checks the start procedure name matches the end
292 procedure name.
293
294 The Stack:
295
296
297 Entry Exit
298
299 Ptr ->
300 +------------+
301 | NameEnd |
302 |------------|
303 | ProcSym |
304 |------------|
305 | NameStart |
306 |------------|
307 Empty
308 *)
309
310 PROCEDURE EndBuildProcedure ;
311
312
313 (*
314 BuildSubrange - Builds a Subrange type Symbol.
315
316 Stack
317
318 Entry Exit
319
320 Ptr ->
321 +------------+
322 | High |
323 |------------|
324 | Low | <- Ptr
325 |------------|
326 *)
327
328 PROCEDURE BuildSubrange ;
329
330
331 (*
332 BuildNulName - Pushes a NulKey onto the top of the stack.
333 The Stack:
334
335
336 Entry Exit
337
338 <- Ptr
339 Empty +------------+
340 | NulKey |
341 |------------|
342 *)
343
344 PROCEDURE BuildNulName ;
345
346
347 (*
348 BuildConst - builds a constant.
349 Stack
350
351 Entry Exit
352
353 Ptr -> <- Ptr
354 +------------+ +------------+
355 | Name | | Sym |
356 |------------+ |------------|
357 *)
358
359 PROCEDURE BuildConst ;
360
361
362 (*
363 BuildVarAtAddress - updates the symbol table entry of, variable sym, to be declared
364 at address, address.
365
366 Stack
367
368 Entry Exit
369
370 Ptr ->
371 +--------------+
372 | Expr | EType | <- Ptr
373 |--------------+ +--------------+
374 | name | SType | | name | SType |
375 |--------------+ |--------------|
376 *)
377
378 PROCEDURE BuildVarAtAddress ;
379
380
381 (*
382 BuildOptArgInitializer - assigns the constant value symbol, const, to be the
383 initial value of the optional parameter should it be
384 absent.
385
386 Ptr ->
387 +------------+
388 | const |
389 |------------| <- Ptr
390 *)
391
392 PROCEDURE BuildOptArgInitializer ;
393
394
395 END P3SymBuild.