]> gcc.gnu.org Git - gcc.git/blob - gcc/m2/gm2-compiler/P2SymBuild.def
109120d82b2c1c29bbf03b554332035a35ca5990
[gcc.git] / gcc / m2 / gm2-compiler / P2SymBuild.def
1 (* P2SymBuild.def pass 2 symbol creation.
2
3 Copyright (C) 2001-2021 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 P2SymBuild ;
23
24 (*
25 Title : P2SymBuild
26 Author : Gaius Mulley
27 Date : 24/6/87
28 LastEdit : Sat Dec 9 11:10:57 EST 1989
29 System : UNIX (GNU Modula-2)
30 Description: pass 2 symbol creation.
31 *)
32
33 EXPORT QUALIFIED P2StartBuildDefModule,
34 P2EndBuildDefModule,
35 P2StartBuildImplementationModule,
36 P2EndBuildImplementationModule,
37 P2StartBuildProgramModule,
38 P2EndBuildProgramModule,
39 StartBuildInnerModule,
40 EndBuildInnerModule,
41 BuildImportOuterModule,
42 BuildExportOuterModule,
43 BuildImportInnerModule,
44 BuildExportInnerModule,
45 BuildNumber,
46 BuildString,
47 BuildConst,
48 BuildSubrange, BuildAligned,
49 BuildTypeAlignment, BuildVarAlignment,
50 P2BuildDefaultFieldAlignment, BuildPragmaConst,
51 BuildVariable,
52 StartBuildEnumeration,
53 BuildType,
54 StartBuildFormalParameters,
55 EndBuildFormalParameters,
56 BuildProcedureHeading,
57 BuildFPSection,
58 BuildVarArgs,
59 BuildFormalVarArgs,
60 BuildOptArg,
61 StartBuildProcedure,
62 EndBuildProcedure,
63 BuildFunction,
64 BuildOptFunction,
65 BuildPointerType,
66 BuildSetType,
67 BuildRecord,
68 BuildFieldRecord,
69 StartBuildVarient,
70 EndBuildVarient,
71 BuildVarientSelector,
72 StartBuildVarientFieldRecord,
73 EndBuildVarientFieldRecord,
74 BuildNulName,
75 BuildTypeEnd,
76 StartBuildArray, BuildArrayComma,
77 EndBuildArray,
78 BuildFieldArray,
79 BuildProcedureType,
80 BuildFormalType,
81 SeenCast,
82 SeenSet,
83 SeenArray,
84 SeenConstructor,
85 SeenUnknown,
86 SeenString,
87 SeenBoolean,
88 SeenCType, SeenRType, SeenZType,
89 DetermineType, PushType, PopType,
90 PushRememberConstant,
91 PopRememberConstant,
92 RememberConstant ;
93
94
95 (*
96 StartBuildDefinitionModule - Creates a definition module and starts
97 a new scope.
98
99 The Stack is expected:
100
101 Entry Exit
102
103 Ptr -> <- Ptr
104 +------------+ +-----------+
105 | NameStart | | NameStart |
106 |------------| |-----------|
107
108 *)
109
110 PROCEDURE P2StartBuildDefModule ;
111
112
113 (*
114 EndBuildDefinitionModule - Destroys the definition module scope and
115 checks for correct name.
116
117 The Stack is expected:
118
119 Entry Exit
120
121 Ptr ->
122 +------------+ +-----------+
123 | NameEnd | | |
124 |------------| |-----------|
125 | NameStart | | | <- Ptr
126 |------------| |-----------|
127 *)
128
129 PROCEDURE P2EndBuildDefModule ;
130
131
132 (*
133 StartBuildImplementationModule - Creates an implementation module and starts
134 a new scope.
135
136 The Stack is expected:
137
138 Entry Exit
139
140 Ptr -> <- Ptr
141 +------------+ +-----------+
142 | NameStart | | NameStart |
143 |------------| |-----------|
144
145 *)
146
147 PROCEDURE P2StartBuildImplementationModule ;
148
149
150 (*
151 EndBuildImplementationModule - Destroys the implementation module scope and
152 checks for correct name.
153
154 The Stack is expected:
155
156 Entry Exit
157
158 Ptr ->
159 +------------+ +-----------+
160 | NameEnd | | |
161 |------------| |-----------|
162 | NameStart | | | <- Ptr
163 |------------| |-----------|
164 *)
165
166 PROCEDURE P2EndBuildImplementationModule ;
167
168
169 (*
170 StartBuildProgramModule - Creates a program module and starts
171 a new scope.
172
173 The Stack is expected:
174
175 Entry Exit
176
177 Ptr -> <- Ptr
178 +------------+ +-----------+
179 | NameStart | | NameStart |
180 |------------| |-----------|
181
182 *)
183
184 PROCEDURE P2StartBuildProgramModule ;
185
186
187 (*
188 EndBuildProgramModule - Destroys the program module scope and
189 checks for correct name.
190
191 The Stack is expected:
192
193 Entry Exit
194
195 Ptr ->
196 +------------+ +-----------+
197 | NameEnd | | |
198 |------------| |-----------|
199 | NameStart | | | <- Ptr
200 |------------| |-----------|
201 *)
202
203 PROCEDURE P2EndBuildProgramModule ;
204
205
206 (*
207 StartBuildInnerModule - Creates an Inner module and starts
208 a new scope.
209
210 The Stack is expected:
211
212 Entry Exit
213
214 Ptr -> <- Ptr
215 +------------+ +-----------+
216 | NameStart | | NameStart |
217 |------------| |-----------|
218
219 *)
220
221 PROCEDURE StartBuildInnerModule ;
222
223
224 (*
225 EndBuildInnerModule - Destroys the Inner module scope and
226 checks for correct name.
227
228 The Stack is expected:
229
230 Entry Exit
231
232 Ptr ->
233 +------------+ +-----------+
234 | NameEnd | | |
235 |------------| |-----------|
236 | NameStart | | | <- Ptr
237 |------------| |-----------|
238 *)
239
240 PROCEDURE EndBuildInnerModule ;
241
242
243 (*
244 BuildImportOuterModule - Builds imported identifiers into an outer module
245 from a definition module.
246
247 The Stack is expected:
248
249 Entry OR Entry
250
251 Ptr -> Ptr ->
252 +------------+ +-----------+
253 | # | | # |
254 |------------| |-----------|
255 | Id1 | | Id1 |
256 |------------| |-----------|
257 . . . .
258 . . . .
259 . . . .
260 |------------| |-----------|
261 | Id# | | Id# |
262 |------------| |-----------|
263 | ImportTok | | Ident |
264 |------------| |-----------|
265
266 IMPORT Id1, .. Id# ; FROM Ident IMPORT Id1 .. Id# ;
267
268
269 Error Condition
270 Exit
271
272 All above stack discarded
273 *)
274
275 PROCEDURE BuildImportOuterModule ;
276
277
278 (*
279 BuildExportOuterModule - Builds exported identifiers from an outer module
280 to the outside world of library modules.
281
282 The Stack is expected:
283
284 Entry OR Entry
285
286 Ptr -> Ptr ->
287 +------------+ +--------------+
288 | # | | # |
289 |------------| |--------------|
290 | Id1 | | Id1 |
291 |------------| |--------------|
292 . . . .
293 . . . .
294 . . . .
295 |------------| |--------------|
296 | Id# | | Id# |
297 |------------| |--------------|
298 | ExportTok | | QualifiedTok |
299 |------------| |--------------|
300
301 EXPORT Id1, .. Id# ; EXPORT QUALIFIED Id1 .. Id# ;
302
303 Error Condition
304
305
306 Exit
307
308 All above stack discarded
309 *)
310
311 PROCEDURE BuildExportOuterModule ;
312
313
314 (*
315 BuildImportInnerModule - Builds imported identifiers into an inner module
316 from the last level of module.
317
318 The Stack is expected:
319
320 Entry OR Entry
321
322 Ptr -> Ptr ->
323 +------------+ +-----------+
324 | # | | # |
325 |------------| |-----------|
326 | Id1 | | Id1 |
327 |------------| |-----------|
328 . . . .
329 . . . .
330 . . . .
331 |------------| |-----------|
332 | Id# | | Id# |
333 |------------| |-----------|
334 | ImportTok | | Ident |
335 |------------| |-----------|
336
337 IMPORT Id1, .. Id# ; FROM Ident IMPORT Id1 .. Id# ;
338
339
340 Error Condition
341 Exit
342
343 All above stack discarded
344 *)
345
346 PROCEDURE BuildImportInnerModule ;
347
348
349 (*
350 BuildExportInnerModule - Builds exported identifiers from an inner module
351 to the next layer module.
352
353 The Stack is expected:
354
355 Entry OR Entry
356
357 Ptr -> Ptr ->
358 +------------+ +--------------+
359 | # | | # |
360 |------------| |--------------|
361 | Id1 | | Id1 |
362 |------------| |--------------|
363 . . . .
364 . . . .
365 . . . .
366 |------------| |--------------|
367 | Id# | | Id# |
368 |------------| |--------------|
369 | ExportTok | | QualifiedTok |
370 |------------| |--------------|
371
372 EXPORT Id1, .. Id# ; EXPORT QUALIFIED Id1 .. Id# ;
373
374
375 Exit
376
377 All above stack discarded
378 *)
379
380 PROCEDURE BuildExportInnerModule ;
381
382
383 (*
384 BuildNumber - Converts a number into a symbol.
385
386
387 Stack
388
389 Entry Exit
390
391 Ptr -> <- Ptr
392 +------------+ +------------+
393 | Name | | Sym |
394 |------------+ |------------|
395 *)
396
397 PROCEDURE BuildNumber ;
398
399
400 (*
401 BuildString - Converts a string into a symbol.
402
403
404 Stack
405
406 Entry Exit
407
408 Ptr -> <- Ptr
409 +------------+ +------------+
410 | Name | | Sym |
411 |------------+ |------------|
412 *)
413
414 PROCEDURE BuildString ;
415
416
417 (*
418 BuildConst - builds a constant.
419 Stack
420
421 Entry Exit
422
423 Ptr ->
424 +------------+
425 | Name |
426 |------------+ <- Ptr
427 *)
428
429 PROCEDURE BuildConst ;
430
431
432 (*
433 StartBuildEnumeration - Builds an Enumeration type Type.
434
435
436 Stack
437
438 Entry Exit
439
440 Ptr ->
441 +------------+
442 | # |
443 |------------|
444 | en 1 |
445 |------------|
446 | en 2 |
447 |------------|
448 . .
449 . .
450 . . <- Ptr
451 |------------| +------------+
452 | en # | | Type |
453 |------------| |------------|
454 | Name | | Name |
455 |------------| |------------|
456 *)
457
458 PROCEDURE StartBuildEnumeration ;
459
460
461 (*
462 BuildSubrange - Builds a Subrange type Symbol, the base type can also be
463 supplied if known.
464
465 Stack
466
467 Entry Exit
468
469
470 <- Ptr
471 +------------+
472 Ptr -> | Type |
473 +------------+ |------------|
474 | Name | | Name |
475 |------------| |------------|
476 *)
477
478 PROCEDURE BuildSubrange (Base: CARDINAL) ;
479
480
481 (*
482 BuildAligned - builds an alignment constant symbol which is placed onto
483 the stack. It expects the ident ALIGNED to be on the
484 stack.
485
486 Stack
487
488 Entry Exit
489
490
491 Ptr -> <- Ptr
492 +---------------+ +-----------------+
493 | bytealignment | | AlignmentConst |
494 +---------------+ |-----------------|
495 *)
496
497 PROCEDURE BuildAligned ;
498
499
500 (*
501 BuildVarAlignment - the AlignmentConst is either a temporary or NulSym.
502 A type may only have one alignment value and
503 error checking is performed.
504
505 Stack
506
507 Entry Exit
508
509
510 Ptr ->
511 +-----------------+
512 | AlignmentConst | <- Ptr
513 |-----------------| +------------------+
514 | Type | | Type | TypeName |
515 |-----------------| |------------------|
516 *)
517
518 PROCEDURE BuildVarAlignment ;
519
520
521 (*
522 BuildTypeAlignment - the AlignmentConst is either a temporary or NulSym.
523 A type may only have one alignment value and
524 error checking is performed.
525
526 Stack
527
528 Entry Exit
529
530
531 Ptr ->
532 +-----------------+
533 | AlignmentConst |
534 |-----------------|
535 | Type | Empty
536 |-----------------|
537 *)
538
539 PROCEDURE BuildTypeAlignment ;
540
541
542 (*
543 BuildDefaultFieldAlignment -
544
545 The Stack:
546
547 Entry Exit
548 ===== ====
549
550
551 Ptr ->
552 +-----------+
553 | Alignment |
554 |-----------| +-----------+
555 | RecordSym | | RecordSym |
556 |-----------| |-----------|
557 | Name | | Name |
558 |-----------| |-----------|
559
560 *)
561
562 PROCEDURE P2BuildDefaultFieldAlignment ;
563
564
565 (*
566 BuildPragmaConst - pushes a constant to the stack and stores it away into the
567 const fifo queue ready for pass 3.
568 *)
569
570 PROCEDURE BuildPragmaConst ;
571
572
573 (*
574 BuildVariable - Builds variables listed in an IdentList with a Type.
575
576 Stack
577
578 Entry Exit
579
580 Ptr ->
581 +------------+ +------------+
582 | Type | Name| | |
583 |------------| |------------|
584 | # | | |
585 |------------| |------------|
586 | Ident 1 | | |
587 |------------| |------------|
588 | Ident 2 | | |
589 |------------| |------------|
590 . . . .
591 . . . .
592 . . . .
593 |------------| |------------|
594 | Ident # | | | <- Ptr
595 |------------| |------------|
596
597 Empty
598 *)
599
600 PROCEDURE BuildVariable ;
601
602
603 (*
604 BuildType - Builds a Type.
605
606
607 Stack
608
609 Entry Exit
610
611 Ptr ->
612 +------------+
613 | Type | <- Ptr
614 |------------| +---------------+
615 | Name | | Type | Name |
616 |------------| |---------------|
617
618 Empty
619 *)
620
621 PROCEDURE BuildType ;
622
623
624 (*
625 StartBuildFormalParameters - Initialises the quadruple stack for
626 Formal Parameters.
627
628 The Stack:
629
630 Entry Exit
631
632 <- Ptr
633 +------------+
634 Empty | 0 |
635 |------------|
636 *)
637
638 PROCEDURE StartBuildFormalParameters ;
639
640
641 (*
642 EndBuildFormalParameters - Resets the quadruple stack after building
643 Formal Parameters.
644
645 The Stack:
646
647 Entry Exit
648
649 Ptr ->
650 +------------+
651 | NoOfParam | <- Ptr
652 |------------| +------------+
653 | ProcSym | | ProcSym |
654 |------------| |------------|
655 *)
656
657 PROCEDURE EndBuildFormalParameters ;
658
659
660 (*
661 BuildProcedureHeading - Builds a procedure heading for the definition
662 module procedures.
663
664 Operation only performed if compiling a
665 definition module.
666
667 The Stack:
668
669 Entry Exit
670
671 Ptr ->
672 +------------+
673 | ProcSym | Empty
674 |------------|
675
676 *)
677
678 PROCEDURE BuildProcedureHeading ;
679
680
681 (*
682 BuildFunction - Builds a procedures return type.
683 Procedure becomes a function.
684
685 The Stack:
686
687 Entry Exit
688
689 Ptr ->
690 +------------+
691 | TypeSym | <- Ptr
692 |------------| +------------+
693 | ProcSym | | ProcSym |
694 |------------| |------------|
695 *)
696
697 PROCEDURE BuildFunction ;
698
699
700 (*
701 BuildOptFunction - Builds a procedures optional return type.
702 Procedure becomes a function and the user
703 can either call it as a function or a procedure.
704
705 The Stack:
706
707 Entry Exit
708
709 Ptr ->
710 +------------+
711 | TypeSym | <- Ptr
712 |------------| +------------+
713 | ProcSym | | ProcSym |
714 |------------| |------------|
715 *)
716
717 PROCEDURE BuildOptFunction ;
718
719
720 (*
721 BuildFPSection - Builds a Formal Parameter in a procedure.
722
723 The Stack:
724
725 Entry Exit
726
727 Ptr ->
728 +------------+
729 | ParamTotal |
730 |------------|
731 | TypeName |
732 |------------|
733 | Array/Nul |
734 |------------|
735 | NoOfIds |
736 |------------|
737 | Id 1 |
738 |------------|
739 . .
740 . .
741 . .
742 |------------|
743 | Id n | <- Ptr
744 |------------| +------------+
745 | Var / Nul | | ParamTotal |
746 |------------| |------------|
747 | ProcSym | | ProcSym |
748 |------------| |------------|
749 *)
750
751 PROCEDURE BuildFPSection ;
752
753
754 (*
755 BuildVarArgs - indicates that the ProcSym takes varargs
756 after ParamTotal.
757 <- Ptr
758 +------------+ +------------+
759 | ParamTotal | | ParamTotal |
760 |------------| |------------|
761 | ProcSym | | ProcSym |
762 |------------| |------------|
763
764 *)
765
766 PROCEDURE BuildVarArgs ;
767
768
769 (*
770 BuildFormalVarArgs - indicates that the procedure type takes varargs.
771 <- Ptr
772 +------------+ +------------+
773 | ProcSym | | ProcSym |
774 |------------| |------------|
775
776 *)
777
778 PROCEDURE BuildFormalVarArgs ;
779
780
781 (*
782 BuildOptArg - indicates that the ProcSym takes a single optarg
783 after ParamTotal.
784
785 <- Ptr
786 +------------+ +------------+
787 | ParamTotal | | ParamTotal |
788 |------------| |------------|
789 | ProcSym | | ProcSym |
790 |------------| |------------|
791 *)
792
793 PROCEDURE BuildOptArg ;
794
795
796 (*
797 StartBuildProcedure - Builds a Procedure.
798
799 The Stack:
800
801 Entry Exit
802
803 <- Ptr
804 +------------+
805 Ptr -> | ProcSym |
806 +------------+ |------------|
807 | Name | | Name |
808 |------------| |------------|
809 *)
810
811 PROCEDURE StartBuildProcedure ;
812
813
814 (*
815 EndBuildProcedure - Ends building a Procedure.
816 It checks the start procedure name matches the end
817 procedure name.
818
819 The Stack:
820
821
822 Entry Exit
823
824 Ptr ->
825 +------------+
826 | NameEnd |
827 |------------|
828 | ProcSym |
829 |------------|
830 | NameStart |
831 |------------|
832 Empty
833 *)
834
835 PROCEDURE EndBuildProcedure ;
836
837
838 (*
839 BuildPointerType - builds a pointer type.
840 The Stack:
841
842 Entry Exit
843 ===== ====
844
845
846 Ptr -> <- Ptr
847 +------------+ +-------------+
848 | Type | | PointerType |
849 |------------| |-------------|
850 | Name | | Name |
851 |------------| |-------------|
852 *)
853
854 PROCEDURE BuildPointerType ;
855
856
857 (*
858 BuildSetType - builds a set type.
859 The Stack:
860
861 Entry Exit
862 ===== ====
863
864
865 Ptr -> <- Ptr
866 +------------+ +-------------+
867 | Type | | SetType |
868 |------------| |-------------|
869 | Name | | Name |
870 |------------| |-------------|
871 *)
872
873 PROCEDURE BuildSetType (ispacked: BOOLEAN) ;
874
875
876 (*
877 BuildRecord - Builds a record type.
878 The Stack:
879
880 Entry Exit
881 ===== ====
882
883 <- Ptr
884 +-----------+
885 Ptr -> | RecordSym |
886 +------------+ |-----------|
887 | Name | | Name |
888 |------------| |-----------|
889 *)
890
891 PROCEDURE BuildRecord ;
892
893
894 (*
895 BuildFieldRecord - Builds a field into a record sym.
896 The Stack:
897
898
899 Entry Exit
900 ===== ====
901
902 Ptr ->
903 +-------------+
904 | Alignment |
905 |-------------|
906 | Type | Name |
907 |-------------|
908 | n |
909 |-------------|
910 | Id 1 |
911 |-------------|
912 . .
913 . .
914 . .
915 |-------------|
916 | Id n | <- Ptr
917 |-------------| +-------------+
918 | RecordSym | | RecordSym |
919 |-------------| |-------------|
920 | RecordName | | RecordName |
921 |-------------| |-------------|
922 *)
923
924 PROCEDURE BuildFieldRecord ;
925
926
927 (*
928 StartBuildVarient - Builds a varient symbol on top of a record sym.
929 The Stack:
930
931
932 Entry Exit
933 ===== ====
934
935 <- Ptr
936 +-------------+
937 Ptr -> | VarientSym |
938 +-------------+ |-------------|
939 | RecordSym | | RecordSym |
940 |-------------| |-------------|
941 | RecordName | | RecordName |
942 |-------------| |-------------|
943 *)
944
945 PROCEDURE StartBuildVarient ;
946
947
948 (*
949 EndBuildVarient - Removes the varient symbol from the stack.
950 The Stack:
951
952 Entry Exit
953 ===== ====
954
955 Ptr ->
956 +-------------+
957 | VarientSym | <- Ptr
958 |-------------| +-------------+
959 | RecordSym | | RecordSym |
960 |-------------| |-------------|
961 | RecordName | | RecordName |
962 |-------------| |-------------|
963 *)
964
965 PROCEDURE EndBuildVarient ;
966
967
968 (*
969 BuildVarientSelector - Builds a field into a record sym.
970 The Stack:
971
972
973 Entry Exit
974 ===== ====
975
976 Ptr ->
977 +-------------+
978 | Qualident |
979 |-------------|
980 | Ident | <- Ptr
981 |-------------| +-------------+
982 | RecordSym | | RecordSym |
983 |-------------| |-------------|
984 *)
985
986 PROCEDURE BuildVarientSelector ;
987
988
989 (*
990 StartBuildVarientFieldRecord - Builds a varient field into a varient sym.
991 The Stack:
992
993
994 Entry Exit
995 ===== ====
996
997 <- Ptr
998 +-------------+
999 Ptr -> | VarientField|
1000 +-------------+ |-------------|
1001 | VarientSym | | RecordSym |
1002 |-------------| |-------------|
1003 *)
1004
1005 PROCEDURE StartBuildVarientFieldRecord ;
1006
1007
1008 (*
1009 EndBuildVarientFieldRecord - Removes a varient field from the stack.
1010 The Stack:
1011
1012
1013 Entry Exit
1014 ===== ====
1015
1016 Ptr ->
1017 +-------------+
1018 | VarientField| <- Ptr
1019 |-------------| +-------------+
1020 | VarientSym | | VarientSym |
1021 |-------------| |-------------|
1022 *)
1023
1024 PROCEDURE EndBuildVarientFieldRecord ;
1025
1026
1027 (*
1028 BuildNulName - Pushes a NulKey onto the top of the stack.
1029 The Stack:
1030
1031
1032 Entry Exit
1033
1034 <- Ptr
1035 Empty +------------+
1036 | NulKey |
1037 |------------|
1038 *)
1039
1040 PROCEDURE BuildNulName ;
1041
1042
1043 (*
1044 BuildTypeEnd - Pops the type Type and Name.
1045 The Stack:
1046
1047
1048 Entry Exit
1049
1050
1051 Ptr ->
1052 +-------------+
1053 | Type | Name | Empty
1054 |-------------|
1055 *)
1056
1057 PROCEDURE BuildTypeEnd ;
1058
1059
1060 (*
1061 StartBuildArray - Builds an array type.
1062 The Stack:
1063
1064 Entry Exit
1065 ===== ====
1066
1067 <- Ptr
1068 +-----------+
1069 Ptr -> | ArraySym |
1070 +------------+ |-----------|
1071 | Name | | Name |
1072 |------------| |-----------|
1073 *)
1074
1075 PROCEDURE StartBuildArray ;
1076
1077
1078 (*
1079 EndBuildArray - Builds an array type.
1080 The Stack:
1081
1082 Entry Exit
1083 ===== ====
1084
1085 Ptr ->
1086 +------------+
1087 | TypeSym | <- Ptr
1088 |------------| +------------+
1089 | ArraySym | | ArraySym |
1090 |------------| |------------|
1091 | Name | | Name |
1092 |------------| |------------|
1093 *)
1094
1095 PROCEDURE EndBuildArray ;
1096
1097
1098 (*
1099 BuildFieldArray - Builds a field into an array sym.
1100 The Stack:
1101
1102
1103 Entry Exit
1104 ===== ====
1105
1106 Ptr ->
1107 +-------------+
1108 | Type | Name | <- Ptr
1109 |-------------| +-------------+
1110 | ArraySym | | ArraySym |
1111 |-------------| |-------------|
1112 | ArrayName | | ArrayName |
1113 |-------------| |-------------|
1114 *)
1115
1116 PROCEDURE BuildFieldArray ;
1117
1118
1119 (*
1120 BuildArrayComma - converts ARRAY [..], [..] OF into ARRAY [..] OF ARRAY [..]
1121
1122
1123 Ptr -> <- Ptr
1124 +-------------+ +-------------+
1125 | ArraySym1 | | ArraySym2 |
1126 |-------------| |-------------|
1127 | ArrayName | | ArrayName |
1128 |-------------| |-------------|
1129 *)
1130
1131 PROCEDURE BuildArrayComma ;
1132
1133
1134 (*
1135 BuildProcedureType - builds a procedure type symbol.
1136 The Stack:
1137
1138
1139 <- Ptr
1140 +-------------+
1141 Ptr -> | ProcTypeSym |
1142 +-------------+ |-------------|
1143 | Name | | Name |
1144 |-------------| |-------------|
1145 *)
1146
1147 PROCEDURE BuildProcedureType ;
1148
1149
1150 (*
1151 BuildFormalType - Builds a Formal Parameter in a procedure type.
1152
1153 The Stack:
1154
1155 Entry Exit
1156
1157 Ptr ->
1158 +------------+
1159 | TypeSym |
1160 |------------|
1161 | Array/Nul |
1162 |------------|
1163 | Var / Nul | <- Ptr
1164 |------------| +--------------+
1165 | ProcTypeSym| | ProcTypeSym |
1166 |------------| |--------------|
1167 *)
1168
1169 PROCEDURE BuildFormalType ;
1170
1171
1172
1173 (*
1174 SeenUnknown - sets the operand type to unknown.
1175 *)
1176
1177 PROCEDURE SeenUnknown ;
1178
1179
1180 (*
1181 SeenCast - sets the operand type to cast.
1182 *)
1183
1184 PROCEDURE SeenCast (sym: CARDINAL) ;
1185
1186
1187 (*
1188 SeenSet - sets the operand type to set.
1189 *)
1190
1191 PROCEDURE SeenSet ;
1192
1193
1194 (*
1195 SeenConstructor - sets the operand type to constructor.
1196 *)
1197
1198 PROCEDURE SeenConstructor ;
1199
1200
1201 (*
1202 SeenArray - sets the operand type to array.
1203 *)
1204
1205 PROCEDURE SeenArray ;
1206
1207
1208 (*
1209 SeenString - sets the operand type to string.
1210 *)
1211
1212 PROCEDURE SeenString ;
1213
1214
1215 (*
1216 SeenBoolean - sets the operand type to a BOOLEAN.
1217 *)
1218
1219 PROCEDURE SeenBoolean ;
1220
1221
1222 (*
1223 SeenZType - sets the operand type to a Z type.
1224 *)
1225
1226 PROCEDURE SeenZType ;
1227
1228
1229 (*
1230 SeenRType - sets the operand type to a R type.
1231 *)
1232
1233 PROCEDURE SeenRType ;
1234
1235
1236 (*
1237 SeenCType - sets the operand type to a C type.
1238 *)
1239
1240 PROCEDURE SeenCType ;
1241
1242
1243 (*
1244 DetermineType - assigns the top of stack symbol with the type of
1245 constant expression, if known.
1246 *)
1247
1248 PROCEDURE DetermineType ;
1249
1250
1251 (*
1252 PushType - pushes the current constant type.
1253 *)
1254
1255 PROCEDURE PushType ;
1256
1257
1258 (*
1259 PopType - pops the stacked type.
1260 *)
1261
1262 PROCEDURE PopType ;
1263
1264
1265 (*
1266 PushRememberConstant -
1267 *)
1268
1269 PROCEDURE PushRememberConstant ;
1270
1271
1272 (*
1273 PopRememberConstant -
1274 *)
1275
1276 PROCEDURE PopRememberConstant ;
1277
1278
1279 (*
1280 RememberConstant -
1281 *)
1282
1283 PROCEDURE RememberConstant (sym: CARDINAL) ;
1284
1285
1286 END P2SymBuild.
This page took 0.14473 seconds and 4 git commands to generate.