Chapter1.runoff 08/09/74 1158.7rew 08/09/74 1158.2 57519 .m1 6 .m2 0 .m3 4 .m4 6 .ms 1 .ad .ar .fo 1 "DRAFT: SUBJECT TO CHANGE"%sec%-%"order number" .sr sec 1 .sp 7 .ce 1 SECTION I .sp 2 .ce 1 INTRODUCTION .sp 4 A_N__O_V_E_R_V_I_E_W__O_F__T_H_E__C_O_M_P_I_L_E_R_ .sp 2 The PL/1 compiler translates a source program written in the PL/1 language into an equivalent Multics standard object segment. This compiler represents an implementation of the PL/1 language as defined in the PL/1 Language Manual (Order No. AG94). The entire compiler is written in the same language, and therefore, is self reproduceable. .sp 2 The compiler is organized into five phases: Syntactic Translation, Declaration Processing, Semantic Translation, Optimization, and Code Generation. Each phase is a set of procedures grouped together to perform a major logical function. .sp 2 The internal representation of the program being compiled serves as the interface between phases of the compiler. To have a thorough understanding of how the compiler works requires an in depth knowledge of the internal representation scheme adopted by this implementation. .bp T_H_E__C_O_M_M_A_N_D__P_R_O_G_R_A_M_ .sp 2 This pl1 command program is the interface between the user and the compiler. It is also the interface between the compiler and the Multics operating system. All calls to Multics system subroutines are made in this command program. .* .bp .in 0 NAME: pl1 .sp 3 Function: .sp 2 .in 4 .un 4 1. It initializes the various static variables of the compiler. .sp 1 .un 4 2. It processes all the options to the command: .in 10 check .br list .br time .br .map .br source .br brief .br symbols .br assembly .br severity .br cpdcls .br debug .br optimize .br table .br brief_table .br parse .br profile .br link .sp 1 .in 4 .un 4 3. It gets the pointer to the source segment. .sp 1 .un 4 4. It makes the object segment and the listing segment if required. .sp 1 .un 4 5. It calls the multi-segment-file manager if the listing requires more than one segment. .sp 1 .un 4 6. It sets up a default handler. .sp 1 .un 4 7. It sets up a cleanup handler, in case a compiler should abort in the middle of a compilation. .sp 1 .un 4 8. It invokes the various phases of the compiler: .in 10 parse .br semantic_translator .br optimizer .br code_generator .br prepare_symbol_map_ .sp 3 .in 0 Entry: .sp 2 pl1, v2pl1 .sp 3 Usage: .sp 2 pl1 pathname -control_arg1_ ... -control_arg_n .sp 1 .in 30 .un 30 1. pathname is the path name of a PL/1 source segment to be translated by the PL/1 compiler. If the source segment does not have a suffix of .pl1, then one is assumed. .sp 1 .un 30 2. control_arg_i can be chosen from a list of options. Refer to the Multics Programmers' Manual 'pl1' command for details. .sp 3 .in 0 Entry: .sp 2 pl1$times, v2pl1$times .sp 2 This entry, when called after a compilation, will print out a table giving the time, the number of page faults, and the amount of storage used by each phase of the compiler. The phases include setup, parse, semantics, optimizer, code generator, and the lister. .sp 3 Usage: .sp 2 pl1$times .sp 3 Entry: .sp 2 pl1$epilogue, v2pl1$epilogue pl1$clean_up, v2pl1$clean_up .sp 2 These entries are called after an aborted compilation, so that cleanup jobs will be done. .sp 3 Usage: .sp 2 pl1$epilogue pl1$clean_up .sp 3 Entry: .sp 2 pl1$blast, v2pl1$blast .sp 2 This entry is called to turn on the blast message, to turn off the blast message, or to rewrite the blast message. .sp 2 If the blast message is on, the blast message will be given at the start of the first compilation in the process. .sp 3 Usage: .sp 2 pl1$blast -on .br pl1$blast -off .br pl1$blast -set blast_message .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 cg_static_$debug .br cg_static_$stop_id .br cg_static_$support .br error_table_$badopt .br error_table_$entlong .br error_table_$noarg .br error_table_$translation_failed .br error_table_$zero_length_seg .br pl1_blast_$blast_message .br pl1_blast_$blast_on .br pl1_blast_$blast_time .br pl1_stat_$abort_label .br pl1_stat_$brief_error_mode .br pl1_stat_$char_pos .br pl1_stat_$compiler_name .br pl1_stat_$constant_list .br pl1_stat_$debug_semant .br pl1_stat_$dummy_block .br pl1_stat_$error_messages .br pl1_stat_$error_width .br pl1_stat_$generate_symtab .br pl1_stat_$greatest_severity .br pl1_stat_$index .br pl1_stat_$line_count .br pl1_stat_$list_ptr .br pl1_stat_$listing_on .br pl1_stat_$max_list_size .br pl1_stat_$max_node_type .br pl1_stat_$node_name .br pl1_stat_$node_size .br pl1_stat_$node_uses .br pl1_stat_$ok_list .br pl1_stat_$optimize .br pl1_stat_$options .br pl1_stat_$pathname .br pl1_stat_$phase .br pl1_stat_$print_cp_dcl .br pl1_stat_$profile_length .br pl1_stat_$root .br pl1_stat_$seg_name .br pl1_stat_$severity_plateau .br pl1_stat_$source_index .br pl1_stat_$source_ptr .br pl1_stat_$stop_id .br pl1_stat_$table .br pl1_stat_$temporary_list .br pl1_stat_$tree_vec_index .br pl1_stat_$user_id .br pl1_stat_$validate_proc .br tree_$ .br v2pl1$ .br xeq_tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 bindec .br clock_ .br code_gen_ .br code_gen_$return_bit_count .br com_err_ .br cu_$arg_ptr .br cv_dec_ .br date_time_ .br db .br default_handler_$set .br error_$finish .br establish_cleanup_proc_ .br expand_path_ .br get_group_id_ .br get_wdir_ .br hcs_$get_max_length_seg .br hcs_$get_usage_values .br hcs_$initiate_count .br hcs_$make_ptr .br hcs_$truncate_seg .br hmu .br ioa_ .br ioa_$nnl .br ios_$changemode .br lex$scan_token_table .br lex$terminate_source .br msf_manager_$get_ptr .br optimizer .br parse .br pl1_print$non_varying .br pl1_print$non_varying_nl .br pl1_print$varying_nl .br pl1_signal_catcher .br pl1_symbol_print .br prepare_symbol_map_ .br prepare_symbol_table .br record_command_usage_$enter .br record_command_usage_$exit .br revert_cleanup_proc_ .br semantic_translator .br tree_manager$init .br tree_manager$truncate .br tssi_$clean_up_file .br tssi_$clean_up_segment .br tssi_$finish_file .br tssi_$finish_segment .br tssi_$get_file .br tssi_$get_segment .br v2pl1$epilogue .sp 3 Include Files used: .sp 2 none .sp 3 Errors Diagnosed: .sp 2 Errors diagnosed by this program are not errors in the source program, but rather errors found in the use of the command pl1.  Chapter2.runoff 09/06/74 1227.5rew 09/06/74 1227.5 870804 .m1 6 .m2 0 .m3 4 .m4 6 .fo 1 "DRAFT: SUBJECT TO CHANGE"2-%"AN54" .sp 7 .ce 2 SECTION II .sp 2 INTERNAL REPRESENTATION .sp 4 .sr N1 "O_V_E_R_V_I_E_W_" .sr P1 % .ur %N1% .sp 2 The internal representation of the program being compiled serves as the interface between phases of the compiler. The internal representation is organized into a modified tree structure (the program tree) consisting of nodes which represent the component parts of the program, such as blocks, statements, operators, operands, and declarations. Each node may be logically connected to any number of other nodes by the use of pointers. .sp 2 Each source program block is represented in the program tree by a block node which has two lists connected to it: a statement list and a declaration list. The elements of the declaration list are symbol table nodes representing declarations of identifiers within that block. The elements of the statement list are nodes representing the source statements of that block. Each statement node contains the root of a computation tree which represents the action to be performed by that statement. This computation tree consists of operator nodes and reference nodes. .sp 2 The operators of the internal representation are n-operand operators whose meaning closely parallels that of the PL/I source operators. References are represented by reference nodes which point to a declaration of some variable or constant. Each reference also serves as the root of a computation tree which describes the computations necessary to locate the item at run time. .sp 2 Except for some fields of the reference node used only by the code generator, this internal representation is machine independent in that it does not reflect the instruction set, the addressing properties, or the register arrangement of the target machine (645 or 6180). All phases of the compiler, except the code generator, are also machine independent since they deal only with this machine independent internal representation. Figure 2-1 shows the internal representation of a simple program. .sp 3 .sr N2 "B_L_O_C_K__S_T_R_U_C_T_U_R_E_" .sr P2 % .ur %N2% .sp 2 Each begin block, procedure, or on-unit is represented by a block node. The entire tree is found via the external static pointer "root". The outside or external environment of the outermost procedure is represented by a block node whose type is "root_block" and which contains the block which represents the external procedure. See Figure 2-2. .sp 2 .na Format: .sp 2 dcl 1 block based aligned, 2 node_type bit(9) unaligned, 2 source_id structure unaligned, 3 file_number bit(8), 3 line_number bit(14), 3 statement_number bit(5), 2 father ptr unaligned, 2 brother ptr unaligned, 2 son ptr unaligned, 2 declaration ptr unaligned, 2 end_declaration ptr unaligned, 2 default ptr unaligned, 2 end_default ptr unaligned, 2 context ptr unaligned, 2 prologue ptr unaligned, 2 end_prologue ptr unaligned, 2 main ptr unaligned, 2 end_main ptr unaligned, 2 return_values ptr unaligned, 2 return_count ptr unaligned, 2 plio_ps ptr unaligned, 2 plio_fa ptr unaligned, 2 plio_ffsb ptr unaligned, 2 plio_ssl ptr unaligned, 2 plio_fab2 ptr unaligned, 2 block_type bit(9) unaligned, 2 prefix bit(12) unaligned, 2 like_attribute bit(1) unaligned, 2 no_stack bit(1) unaligned, 2 get_data bit(1) unaligned, 2 flush_at_call bit(1) unaligned, 2 processed bit(1) unaligned, 2 skip bit(1) unaligned, 2 number fixed bin(8) unaligned, 2 free_temps dimension(3) ptr, 2 temp_list ptr, 2 entry_list ptr, 2 o_and_s ptr, 2 max_display_steps fixed(17), 2 display_vector fixed(17), 2 number_of_entries fixed(17), 2 level fixed(17), 2 last_auto_loc fixed(17), 2 symbol_block fixed(17), 2 entry_info fixed(18), 2 enter structure unaligned, 3 start fixed(17), 3 end fixed(17), 2 leave structure unaligned, 3 start fixed(17), 3 end fixed(17); .ad .sp 2 .ad .in 10 .un 10 node_type - has a value of "000000001"b which identifies this as a block node. .sp 2 .un 10 source_id - (treated as a triple of numbers) .in 34 .sp 2 .un 10 .un 19 file_number - 0 for main source file, and indexes include files in sequential order of inclusion. Any include file may be included more than once; each occurrence will have a distinct file_number. .sp 2 .un 10 .un 19 line_number - line number within source file (see file_number) of line on which statement begins. .sp 2 .sp 2 .un 10 .un 19 statement_number - 1 + number of statements that finish ahead of the current statement on the line on which the current statement begins. .in 10 .sp 2 .un 10 father - points to the immediately containing block. This pointer is null for the root block. .sp 2 .un 10 brother - points to the next block at this nesting level that has the same father. .sp 2 .un 10 son - points to the first contained block. .sp 2 .un 10 declaration - points to the first symbol or label node declared in this block. .sp 2 .un 10 end_declaration - points to the last symbol or label node declared in this block. .sp 2 .un 10 default - points to a uni-directional chain of default nodes each representing a default statement in this block. The default nodes are used only during declaration processing and are of no interest to the code generator. .sp 2 .un 10 end_default - points to the last default node in this block. .sp 2 .un 10 context - used by the parse and declaration processor and is ignored by the code generator. .sp 2 .un 10 prologue - points to the first statement node of the prologue statement sequence. .sp 2 .un 10 end_prologue - points to the last statement node of the prologue statement sequence. .sp 2 .un 10 main - points to the first statement node of the main statement sequence. .sp 2 .un 10 end_main - points to the last statement node of the main statement sequence. .sp 2 .un 10 return_values - points to a chain of list nodes each of which points to a symbol node representing a unique kind of value returned by the return statements of this procedure. .sp 2 .un 10 return_count - if this procedure returns more than one kind of value, this points to a declaration of an integer declared in the block which is used to determine what kind of value is to be returned. This information as well as the list of return values is not used by the code generator; it is created and used by the semantic translator. .sp 2 .un 10 plio_ps - if non-null, points to the symbol-node for PS, the storage block used in I/O statements. If non-null, the code generator will compile code in the block prologue to set PS.stack_frame_p, stack.psp, and, if there is to be a runtime symbol table, PS.ST_top_p and PS.ST_block_p. .sp 2 .un 10 plio_fa - if non-null, points to the symbol-node for the format-area, used by edit-directed get- and put-statements. If non-null, the code generator will compile code in the block prologue to set PS.format_area_p to its address. .sp 2 .un 10 plio_ffsb - if non-null, points to the symbol-node for "fake FSB", a pseudo-file-control-block used for get- and put-statements with string option. .sp 2 .un 10 plio_ssl - if non-null, points to the symbol-node for ss_list, storage used for the put data statement. If non-null, the code generator will cause its address to be stored in PS.ss_list_p during block prologue. .sp 2 .un 10 plio_fab2 - points to the symbol-node for FAB2, storage used by the open statement to record file options, linesize, and pagesize. .sp 2 .un 10 block_type - defines the kind of block this node represents. The codes used in this field are given in the appendix. .sp 2 .un 10 .ur prefix - the condition prefix of the block. See "Statement Nodes" on page 2-%P41% for a definition of each bit. .sp 2 .un 10 like_attribute - indicates that some declaration occurs in this block with a like attribute. .sp 1 .un 10 no_stack - this block shares its stack frame with its containing or brother block and can be called with a non-recursive call. .sp 2 .un 10 get_data - used by get-data to indicate that a full runtime symbol table is required for this block. .sp 2 .un 10 flush_at_call - indicates that some son of this block is assigned to an external static entry variable. Hence, any call may invoke it and change any automatic variable in this block. .sp 2 .un 10 processed - used and set by the code generator only. .sp 2 .un 10 skip - a filler. .sp 2 .un 10 number - this field is used to sequentially number all blocks. it is used by the part of the semantic translator which determines the set of blocks requiring stack frames. .sp 2 .un 10 free_temps - points to lists of free temporaries. (used and set only by the code generator). .sp 2 .un 10 temp_list - points to a list of allocated temporaries. (set and used only by the code generator). .sp 2 .un 10 entry_list - points to a list of all entry statements in this block. .sp 2 .un 10 o_and_s - used by the code generator to keep track of offset and size expressions. .sp 2 .un 10 max_display_steps - indicates the maximum number of environment pointers needed to reference automatic variables or label constants, etc., declared in outer blocks. .sp 2 .un 10 display_vector - used by the code generator to remember the location of the environment (display) pointers. (not used or set outside the code generator). .sp 2 .un 10 number_of_entries - the number of procedure and entry statements in this block. .sp 2 .un 10 level - set and used only by the code generator. "level" is the nesting level of this block in terms of stack-frame nesting depth. The "level" of a quick block is thus equal to the "level" of the block in which its automatic storage has been placed. The level of the root block is 0. The level of the external procedure block is 1. .sp 2 .un 10 last_auto_loc - used by the storage allocator as a location counter for allocating automatic storage. .sp 2 .un 10 symbol_block - holds the offset within the run-time symbol table of the runtime block node that corresponds to this block; used and set only by the code generator. .sp 2 .un 10 entry_info - used and set only by the code generator. .sp 2 .un 10 enter - used and set only by the code generator. .sp 2 .un 10 leave - used and set only by the code generator. .in 0 .sp 3 .sr N3 "R_E_P_R_E_S_E_N_T_A_T_I_O_N_ _O_F_ _D_E_C_L_A_R_A_T_I_O_N_S_" .sr P3 % .ur %N3% .sp 2 Two data structures are used to represent declarations: the token table and the symbol table. The token table contains an entry for each unique token (operator, delimiter, identifier, constant) in the source program. It does not reflect the block structure of the program and can be considered a vector. The symbol table consists of lists of symbol and label nodes attached to block nodes. Each block node contains a uni-directional list of symbol and label nodes which represent the declarations made in that block. .sp 3 .sr N31 "T_o_k_e_n_ _T_a_b_l_e_" .sr P31 % .ur %N31% .sp 2 Each token table entry represents a unique token found in the source program or generated by the compiler. .sp 2 .na Format: .sp 2 dcl 1 token based aligned, 2 node_type bit(9) unaligned, 2 type bit(9) unaligned, 2 loc bit(18) unaligned, 2 declaration ptr unaligned, 2 next ptr unaligned, 2 size fixed(9), 2 string char(n refer(token.size)); .sp 2 .ad .in 10 .un 10 node_type - has a value of "000000101"b which identifies this node as a token table entry. .sp 2 .un 10 type - has one of the values listed in the appendix. This value describes the kind of token represented by this node. .sp 2 .un 10 loc - Position in runtime symbol table of this token. Used and set by the code generator only. .sp 2 .un 10 declaration - points to a uni-directional chain of symbol and label nodes which describe the declarations of this token. This pointer is null for tokens other than identifiers. .sp 2 .un 10 next - points to the next entry in the token table. .sp 2 .un 10 size - is the length of the token, "token.string". .sp 2 .un 10 string - is the character string representation of the token. In the case of a character-string token, "string" is the string value. In the case of a bit-string token, "string" is the character-string obtained from the bit string by replacing "1"b with "1", "0"b with "0", and adding a final "b". .in 0 .sp 3 .sr N32 "S_y_m_b_o_l_ _T_a_b_l_e_" .sr P32 % .ur %N32% .sp 2 The symbol table consists of lists of symbol and label nodes attached to block nodes. Each block node contains a pointer to a uni-directional chain of symbol and label nodes, each of which represents a declaration in the block. .sp 3 .sr N321 "LABEL NODES" .sr P321 % .ur %N321% .sp 2 A label node represents the declaration of a statement label constant. It may be a scalar or array. Entry labels are represented by symbol nodes, not label nodes. Format statements have labels, but these are removed from the statement by io_statement_parse and changed into symbols with the initial pointer pointing at the format statement. The fields of the label node generally match the corresponding fields of the symbol node. .sp 2 .na Format: .sp 2 .un 10 dcl 1 label based aligned, 2 node_type bit(9) unaligned, 2 source_id structure unaligned, 3 file_number bit(8), 3 line_number bit(14), 3 statement_number bit(5), 2 location fixed(17) unaligned, 2 allocated bit(1) unaligned, 2 dcl_type bit(3) unaligned, 2 reserved bit(29) unaligned, 2 array bit(1) unaligned, 2 used_as_format bit(1) unaligned, 2 used_in_goto bit(1) unaligned, 2 symbol_table bit(18) unaligned, 2 low_bound fixed(17) unaligned, 2 high_bound fixed(17) unaligned, 2 block_node ptr unaligned, 2 token ptr unaligned, 2 next ptr unaligned, 2 multi_use ptr unaligned, 2 cross_reference ptr unaligned, 2 statement ptr unaligned; .ad .sp 2 .in 10 .un 10 node_type - has a value of "000001111"b which identifies this node as a label node. .sp 2 .un 10 source_id - describes the statement on which this label appeared. For label arrays it identifies the first statement on which one of the array elements appeared. .ur (For further detail, see description in "Block Structure" on page 2-%P2%.) .sp 2 .un 10 location - the address assigned to this label. .sp 2 .un 10 allocated - indicates that the storage allocator has assigned an actual location in the object program for this label. .sp 2 .un 10 dcl_type - describes the manner in which the label was declared. The declare_types include file listed in the appendix defines the values used in this field. .sp 2 .un 10 array - identifies this as a constant label array. .sp 2 .un 10 used_as_format - used by FORTRAN to distinguish labels and format identifiers. .sp 2 .un 10 used_in_goto - used by FORTRAN to distinguish labels and format identifiers. .sp 2 .un 10 symbol_table - used and set by the code generator only. Records the location in the runtime symbol table of the runtime label node corresponding to this label. .sp 2 .un 10 low_bound - the observed lower bound of the array. .sp 2 .un 10 high_bound - the observed high bound of the array. .sp 2 .un 10 block_node - points to the block node which owns this declaration. .sp 2 .un 10 token - points to the token table entry for this identifier. .sp 2 .un 10 next - points to the next symbol or label node in this block. .sp 2 .un 10 multi_use - points to the next declaration of this identifier (in any block). .sp 2 .un 10 cross_reference - points to a uni-directional chain of cross reference nodes, each of which contains a statement-id of a statement which references this label or label array. .sp 2 .un 10 statement - points to the statement node representing the statement on which this label appeared. For label arrays this points to the first statement on which one of the array elements appeared as a label prefix. .in 0 .sp 3 .sr N322 "SYMBOL NODES" .sr P322 % .ur %N322% .sp 2 A symbol node represents the declaration of a variable or constant (other than label constants). All scalar and aggregate values are represented in a uniform manner. Variables, constants, entry names, file names, condition names, and temporaries are represented by symbol nodes with the proper storage class and type attributes. .sp 2 .na Format: .sp 2 dcl 1 symbol based aligned, 2 node_type bit(9) unaligned, 2 source_id structure unaligned, 3 file_number bit(8), 3 line_number bit(14), 3 statement_number bit(5), 2 location fixed(17) unaligned, 2 allocated bit(1) unaligned, 2 dcl_type bit(3) unaligned, 2 reserved bit(6) unaligned, 2 pix structure unaligned, 3 pic_fixed bit(1) unaligned, 3 pic_float bit(1) unaligned, 3 pic_char bit(1) unaligned, 3 pic_scale fixed(7) unaligned, 3 pic_size fixed(7) unaligned, 2 level fixed(8) unaligned, 2 boundary fixed(3) unaligned, 2 size_units fixed(3) unaligned, 2 scale fixed(7) unaligned, 2 runtime bit(18) unaligned, 2 runtime_offset bit(18) unaligned, 2 block_node ptr unaligned, 2 token ptr unaligned, 2 next ptr unaligned, 2 multi_use ptr unaligned, 2 cross_references ptr unaligned, 2 initial ptr unaligned, 2 array ptr unaligned, 2 descriptor ptr unaligned, 2 equivalence ptr unaligned, 2 reference ptr unaligned, 2 general ptr unaligned, 2 father ptr unaligned, 2 brother ptr unaligned, 2 son ptr unaligned, 2 word_size ptr unaligned, 2 bit_size ptr unaligned, 2 dcl_size ptr unaligned, 2 symtab_size ptr unaligned, 2 c_word_size fixed(24), 2 c_bit_size fixed(24), 2 c_dcl_size fixed(24), .sp 2 .un 10 2 attributes structure aligned, 3 data_type structure unaligned, 4 structure bit(1) , 4 fixed bit(1), 4 float bit(1), 4 bit bit(1), 4 char bit(1), 4 ptr bit(1), 4 offset bit(1), 4 area bit(1), 4 label bit(1), 4 entry bit(1), 4 file bit(1), 4 arg_descriptor bit(1), 4 storage_block bit(1), 4 lock bit(1), 4 condition bit(1), 4 format bit(1), 4 builtin bit(1), 4 generic bit(1), 4 picture bit(1), .sp 2 .un 10 3 misc_attributes structure unaligned, 4 dimensioned bit(1), 4 initialed bit(1), 4 aligned bit(1), 4 unaligned bit(1), 4 connected bit(1), 4 precision bit(1), 4 varying bit(1), 4 local bit(1), 4 decimal bit(1), 4 binary bit(1), 4 real bit(1), 4 complex bit(1), 4 variable bit(1), 4 reducible bit(1), 4 irreducible bit(1), 4 returns bit(1), 4 position bit(1), 4 internal bit(1), 4 external bit(1), 4 like bit(1), 4 member bit(1), .sp 2 .un 10 3 storage_class structure unaligned, 4 auto bit(1), 4 based bit(1), 4 static bit(1), 4 controlled bit(1), 4 defined bit(1), 4 parameter bit(1), 4 param_desc bit(1), 4 constant bit(1), 4 temporary bit(1), 4 return_value bit(1), .sp 2 .un 10 3 file_attributes structure unaligned, 4 print bit(1), 4 input bit(1), 4 output bit(1), 4 update bit(1), 4 stream bit(1), 4 reserved_1 bit(1), 4 record bit(1), 4 sequential bit(1), 4 direct bit(1), 4 interactive bit(1), 4 reserved_2 bit(1), 4 forwards bit(1), 4 backwards bit(1), 4 keyed bit(1), 4 reserved_3 bit(1), 4 environment bit(1), .sp 2 .un 10 3 compiler_developed structure unaligned, 4 abnormal bit(1), 4 packed bit(1), 4 passed_as_arg bit(1), 4 allocate bit(1), 4 set bit(1), 4 exp_extents bit(1), 4 refer_extents bit(1), 4 star_extents bit(1), 4 variable_arg_list bit(1), 4 non_varying bit(1), 4 isub bit(1), 4 put_in_symtab bit(1), 4 contiguous bit(1), 4 put_data bit(1), 4 overlayed bit(1), 4 error bit(1), 4 symtab_processed bit(1); .ad .sp 2 .in 10 .un 10 node_type - has a value of "000000110"b which identifies this as a symbol node. .sp 2 .un 10 source_id - identifies the statement which declared this value. .ur (For further detail, see description in "Block Structure" on page 2-%P2%.) .sp 2 .un 10 location - the address given to this item by the storage allocator. If this item is a parameter, "location" is the position of the parameter in first entry statement in which it appears (i.e., first entry statement processed by declare). .ur (See "Parameter" on page 2-%P3256%). If this item is controlled, location is the offset of a 3-pointer structure .ur serving to identify the current generation of the variable. (See "Controlled" on page 2-%P3254%). .sp 2 .un 10 allocated - indicates that storage has been allocated for this variable. .ur Set in the case of a parameter appearing in more than one parameter position (see "Parameter" on page 2-%P3256%). .sp 2 .un 10 dcl_type - indicates how the declaration was established. The values of this field are defined in the "declare_types" include file listed in the appendix. .sp 2 .un 10 pix - the fields of pix record facts about a picture deduced from inspection of the picture. .sp 2 .un 10 .in 20 .un 10 pic_fixed - set if the picture is a numeric picture, not floating. .sp 2 .un 10 pic_float - set if the picture is numeric, floating. .sp 2 .un 10 pic_char - set if the picture is a character picture. .sp 2 .un 10 pic_scale - the scale of the (fixed) associated variable: the number of digits after the "v" in the picture, if one appears, (or zero), less the value of the picture's scale factor, if any. If the symbol is a generic arg_selector for an arithmetic argument, pic_scale is used to hold the upper limit of the scale. .sp 2 .un 10 pic_size - the precision for a numeric picture, the length for a character picture. If the symbol is a generic arg_selector for an arithmetic argument, pic_size is used to hold the upper limit of the precision. .sp 2 .un 10 .in 10 .un 10 level - the level number adjusted so that the level number of a member is one greater than its containing structure. Non-structure level-one variables have a level number of zero. .sp 2 .un 10 boundary - the storage boundary required by this item. The valid codes are given in the appendix. .sp 2 .un 10 size_units - used and set by the code generator only. used to keep track of the units in which the item's size is expressed. .sp 2 .un 10 scale - the arithmetic scale factor. If the symbol is a generic arg_selector for an arithmetic argument, scale is used to hold the lower limit of the scale. .sp 2 .un 10 runtime - used and set by the code generator only. Holds offset within runtime symbol table of the runtime symbol node corresponding to this symbol node. .sp 2 .un 10 runtime_offset - NOT USED. .sp 2 .un 10 block_node - points to the block_node that owns this declaration. .sp 2 .un 10 token - points to the token table entry for this identifier. .sp 2 .un 10 next - points to the next symbol or label node in this block. .sp 2 .un 10 multi_use - if this declaration is a literal constant, this points to the next literal constant in the program. If this declaration is a temporary this points to the next temporary in the program. If this is a variable or named constant this points to another declaration of the same name. .sp 2 .un 10 cross_reference - points to a uni-directional chain of cross reference nodes each of which contains the source-id of a statement which references this declaration. (Items without names have a null value for this pointer.) .sp 2 .un 10 initial - if this item is an internal entry constant this points to the entry statement on which the entry name appeared. If this item is an initialized variable this points to a list node or tree of list nodes which represents the initial attribute. If this item is a literal constant this points to the binary representation of the constant's value. If this is a level-1 "defined" variable with position attribute this points to the position expression template. In the case of a format constant, "initial" points to the format statement node. (_S_e_e_ _X_._X_._X_._X_._X_)_ .sp 2 .un 10 array - points to an array node which describes the number of dimensions, the .ur bounds, and the multipliers of this array. See "Array and Bound Nodes" on page 2-%P323%. .sp 2 .un 10 descriptor - points to a reference_node which points to a symbol node whose type is arg_descriptor and whose storage class is automatic, constant, controlled, temporary, or param_desc. If it is a constant it will appear in the constant list, otherwise it will be in the same block as the declaration which it describes. The semantic translator creates declarations of descriptors when it processes function references and calls. It generates assignment statements to assign the proper values to the descriptor - in the prologue, in the allocate statement for a controlled variable, or immediately before the statement containing the call. If this is an array, the descriptor describes the entire array and the element descriptor is found in the array node. .sp 2 .un 10 equivalence - points to the parse of the reference given in the defined attribute or to .ur the base constant of a group of equivalenced constants. (See "Storage Classes" on page 2-%P325%.) .sp 2 .un 10 reference - points to a reference node which describes how to access this value at run-time. For arrays this reference node describes how to access the entire array. .sp 2 .un 10 general - A general purpose pointer whose meaning depends on other attributes. .sp 2 .un 10 .in 15 .un 10 1. offset data - points to the area reference given in the offset attribute. .sp 1 .un 10 2. pictured data - points to the token table entry representing the picture. .sp 1 .un 10 3. entry - points to a uni-directional chain of list nodes each of which points to a symbol node describing a parameter of the entry. .sp 1 .un 10 4. generic - points to a uni-directional chain of list nodes each of which points to a symbol node describing an entry descriptor, and to an entry reference. .sp 1 .un 10 5. structure - points to the reference given with the like attribute. .sp 1 .un 10 6. file constant - points to the declaration of the file block used at run-time. .sp 2 .in 10 .un 10 father - points to the symbol node of the immediately containing structure. .sp 2 .un 10 brother - points to the symbol node of the next structure member at this level. .sp 2 .un 10 son - points to the first member of this structure (null for non-structures). .sp 2 .un 10 word_size - points to an expression giving the size of this item in words (rounded if necessary). If the size is constant this field is null. If this is a member of a packed structure neither this field nor its constant counterpart have any meaning, although they may contain non-empty values. .sp 2 .un 10 bit_size - points to an expression giving the size of this item in bits. If the size is constant this field is null. (Both bit and word size of dimensioned data are the total array size, not the element size). .sp 2 .un 10 dcl_size - points to an expression giving the declared size of areas or the declared length of strings. If the data-type is entry this field points to the symbol node that describes the return value of the entry. In the case of a controlled variable, dcl_size points to an expression which references the runtime descriptor of the controlled variable. .sp 2 .un 10 symtab_size - in the case of controlled variables, set by declare_descriptor to the original (parsed only) contents of dcl_size if this is not constant. Points to an expression giving the declared size of the item. This expression is obtained by semantically translating the dcl_size expression. This pointer is null if a runtime symbol table entry is not required. .sp 2 .un 10 c_word_size - constant size in words (rounded if necessary). .sp 2 .un 10 c_bit_size - constant size in bits. .sp 2 .un 10 c_dcl_size - constant area size, string length, or arithmetic precision. If the symbol is a generic arg_selector for an arithmetic argument, c_dcl_size is used to hold the lower limit of the arithmetic precision. In the case of a pictured item, the length of the pictured string. .ne 12 .sp 3 .in 10 .ll 50 .un 6 The bits of the symbol node are generally self explanatory and are derived from the declare statement and default rules of the language. The compiler-created attributes are described below: .in 10 .ll 65 .sp 2 .un 10 abnormal - the value of this variable may change without any explicit indication in this program. A variable is abnormal if: .sp 2 .in 15 .na .un 4 1. it is based, parameter, external, defined or the base of a defined variable; .sp 1 .un 4 2. it is used in an addr built-in function or appears in the string option of a put statement, an into or set option of a read statement, or a set option of a locate statement; .sp 1 .un 4 3. it is a member of an abnormal structure or is a structure containing abnormal values; .sp 1 .un 4 4. it is passed as an argument by reference and is static or controlled. .in 10 .sp 2 .un 10 packed - this value is: .sp 2 1. An unaligned aggregate of packed data; .sp 1 2. unaligned arithmetic data; .sp 1 3. unaligned non-varying string data; .sp 1 4. unaligned pointer data. .sp 2 .un 10 .ad passed_as_arg - set in semantics, tested by the code generator; indicates that spare bits may have been written into by the procedure called. Also set for an argument of the unspec pseudo-variable. .ur See padded_ref in "Reference Nodes" on page 2-%P42%. .sp 2 .un 10 allocate - indicates that the item has been referenced; indicates that any required allocation of space may not be ommitted; inspected during preparation of the listing. .sp 2 .un 10 set - this item appears on the left side of an assignment, in a get list, a set() option, a keyto() option, the string() option of a put-statement, suitably as an argument to a pseudovariable operator, in an in() option, a read into() statement, or as an argument passed by reference. Defined items, and items which are the bases of defined items, are abnormal (see above) but do not inherit each other's set attribute. .sp 2 .un 10 exp_extents - this item has non-constant extents. .sp 2 .un 10 refer_extents - this item has refer extents or belongs to a structure which has refer extents. .sp 2 .un 10 star_extents - this item has asterisk extents. .sp 2 .un 10 variable_arg_list - represents the source program construction "options(variable)". .sp 2 .un 10 non_varying - indicates that the item is a nonvarying character or bit string. .sp 2 .un 10 isub - indicates that the item is isub-defined. .sp 2 .un 10 put_in_symtab - this declaration must be placed in the run-time symbol table. .sp 2 .un 10 contiguous - used and set only by the code generator. Indicates of a string array that no element crosses a word boundary. .sp 2 .un 10 put_data - NOT USED .sp 2 .un 10 overlayed - indicates that the item is a string overlayed item. .sp 2 .un 10 error - would flag an inconsistent declaration: NOT USED. .sp 2 .un 10 symtab_processed - flag used by prepare_symbol_table. Indicates that the semantic processing needed to generate the runtime symbol table entry has already been done. .in 0 .sp 3 .sr N323 "ARRAY AND BOUND NODES" .sr P323 % .ur %N323% .sp 2 The array node and its associated chain of bound pairs serve to describe the elements of an array and provide pre-computed multipliers for use by the subscript processor module of the semantic translator. .sp 3 .sr N3231 "Array Nodes" .sr P3231 % .ur %N3231% .sp 2 .un 10 .na Format: .sp 2 .un 10 dcl 1 array based aligned, 2 node_type bit(9) unaligned, 2 reserved bit(34) unaligned, 2 number_of_dimensions fixed(7) unaligned, 2 own_number_of_dimensions fixed(7) unaligned, 2 element_boundary fixed(3) unaligned, 2 size_units fixed(3) unaligned, 2 offset_units fixed(3) unaligned, 2 interleaved bit(1) unaligned, 2 c_element_size fixed(24), 2 c_element_size_bits fixed(24), 2 c_virtual_origin fixed(24), 2 element_size ptr unaligned, 2 element_size_bits ptr unaligned, 2 virtual_origin ptr unaligned, 2 symtab_virtual_origin ptr unaligned, 2 symtab_element_size ptr unaligned, 2 bounds ptr unaligned, 2 element_descriptor ptr unaligned; .ad .sp 6 .in 10 .un 10 node_type - has a value of "000001000"b which identifies this node as an array node. .sp 2 .un 10 number_of_dimensions - the number of declared dimensions, plus all dimensions inherited from containing structures. .sp 2 .un 10 own_number_of_dimensions - The number of dimensions declared on this item. .sp 2 .un 10 element_boundary - the storage boundary required by the elements of this array. .sp 2 .un 10 size_units - used and set by the code generator only. The units in which the element_size is expressed. See array.element_size and symbol.size_units. .sp 2 .un 10 offset_units - indicates the units of the multipliers. The permitted values are defined by the boundary include file listed in the appendix. Note: descriptor multipliers are always in bits if the item is packed, words if it is not. .sp 2 .un 10 interleaved - This array is interleaved. .sp 2 .un 10 c_element_size - constant element size in words (rounded if necessary). See "size_units" above. .sp 2 .un 10 c_element_size_bits - constant element size in bits. .sp 2 .un 10 c_virtual_origin - if "virtual_origin" is null, the constant virtual origin: a virtual origin is the value (constant or variable) that must be added to the sum of the products of an item's subscripts with its multipliers to yield a correct offset relative to the beginning of the containing level-1 aggregate. .sp 2 .un 10 element_size - points to an expression giving the element size in words. .sp 2 .un 10 element_size_bits - points to an expression giving the element size in bits. .sp 2 .un 10 virtual_origin - if non-null, points to an expression for the virtual origin (see c_virtual_origin). .sp 2 .un 10 symtab_virtual_origin - points to an expression giving the virtual origin of the array. This expression is obtained by semantic translation of the "virtual_origin" expression. This pointer is null if a runtime symbol table entry is not required. .sp 2 .un 10 symtab_element_size - see "symtab_virtual_origin": replace "virtual_origin" by "element_size". .sp 2 .un 10 bounds - points to a uni-directional chain of bounds nodes each of which gives a lower bound, an upper bound, and a multiplier. These multipliers are measured in the units indicated by offset_units. The descriptor bounds are measured in bits if the item is packed, otherwise they are measured in words. .sp 2 .un 10 element_descriptor - points to a symbol node whose type is arg_descriptor. That descriptor describes the elements of this array and is used when one of those elements is passed as an argument to any entry which requires descriptors. .in 0 .sp 3 .sr N3232 "Bound Nodes" .sr P3232 % .ur %N3232% .sp 2 .na Format: .sp 2 dcl 1 bound based aligned, 2 node_type bit(9), 2 c_lower fixed(24), 2 c_upper fixed(24), 2 c_multiplier fixed(24), 2 c_desc_multiplier fixed(24), 2 lower ptr unaligned, 2 upper ptr unaligned, 2 multiplier ptr unaligned, 2 desc_multiplier ptr unaligned, 2 symtab_lower ptr unaligned, 2 symtab_upper ptr unaligned, 2 symtab_multiplier ptr unaligned, 2 next ptr unaligned; .ad .sp 6 .in 10 .un 10 node_type - has a value of "000001001"b which identifies this node as a bound node. .sp 2 .un 10 c_lower - constant lower bound if "lower" is null. Used in bounds checking, to compute the range (upper-lower+1) of this dimension, and to compute multipliers for contained bound nodes. .sp 2 .un 10 c_upper - upper bound if "upper" is null. See "c_lower". .sp 2 .un 10 c_multiplier - multiplier for computing offset from subscript if "multiplier" is null. The multiplier for a bound with N contained bounds is the N+1-fold product of the ranges (upper-lower+1) of those bounds with the element size of the terminal, unsubscripted element. .sp 2 .un 10 c_desc_multiplier - constant descriptor multiplier if "desc_multiplier" is null. The multipliers in array descriptors, desc_multiplier's, serve the same purpose as the more generally used multipliers, but follow different rules due to the necessity to continue the practice of EPL. The units in which desc_multiplier is expressed is bits in the case of a packed array and words in the case of an unpacked array. .sp 2 .un 10 lower - points to lower-bound expression tree if non-null. See "c_lower". In the case of a controlled array, points to an expression which references the runtime descriptor of the controlled variable. .sp 2 .un 10 upper - points to upper-bound expression tree if non-null. See "c_upper". .sp 2 .un 10 multiplier - points to multiplier expression tree if non-null. See "c_multiplier". .sp 2 .un 10 desc_multiplier - points to descriptor-multiplier expression tree if non-null. See "c_desc_multiplier". .sp 2 .un 10 symtab_lower - set by declare_descriptor for controlled arrays: contains the original (parsed only) tree for bound.lower if the lower bound is not constant. Otherwise used and set by the code generator only. points to an expression giving the lower bound of this dimension of the array. The expression is obtained by semantic translation of the "lower" expression. This pointer will be null if a runtime symbol table entry is not required. .sp 2 .un 10 symtab_upper - set by declare_descriptor in the case of controlled arrays: contains the original (parsed only) bound.upper if the upper bound is not constant. See "symtab_lower"; replace "lower" with "upper". .sp 2 .un 10 symtab_multiplier - set by get_array_size in the case of controlled arrays: contains the original (parsed only) bound.multiplier if the multiplier is not constant. See "symtab_lower"; replace "lower" with "multiplier". .sp 2 .un 10 next - if non-null, points to the immediately containing bound node. Note well that the chain of bound nodes, like most lists relating to subscripts, is kept in reversed order. Thus, "next" for a sub-array points to the bound node for the containing array. .in 0 .sp 3 .sr N324 "INITIAL ATTRIBUTES" .sr P324 % .ur %N324% .sp 2 The initial attribute of PL/I is a list of initial items each with a repetition factor or implied repetition factor of one. Each initial item is either an expression, an asterisk, or another initial list. .sp 2 .un 10 The parse of an initial attribute is a uni-directional chain of list nodes each representing a single initial item. The nesting of the initial attribute is reflected in the parse as shown in Figure 2-5. .sp 2 .un 10 The repetition factor is an expression. The initial value is either an expression, a token table entry for an asterisk, or another chain of list nodes representing the parse of the nested initial list. .sp 3 .sr N325 "STORAGE CLASSES" .sr P325 % .ur %N325% .sp 2 The storage mechanism used to contain a value at run-time is defined by the storage class bits of the symbol node. .sp 3 .ne 4 .sr N3251 "Automatic" .sr P3251 % .ur %N3251% .sp 2 .un 10 If the size (extents) of the value are variable the prologue will contain a statement explicitly allocating the value using an "allot_auto" operator. This operator returns a pointer value which is used to qualify all references to the variable. The code generator does not allocate such variables and it assumes that all necessary pointer qualification has been done by the semantic translator. .sp 2 .un 10 Constant size automatic values are allocated by the storage allocator module of the code generator. It only allocates this value if the "allocate" bit is on and the cross_references field in the symbol node is non-null (indicating one or more references to the variable). Having allocated the value, it sets the "allocated" bit and fills in the "location" field of the symbol node. The location field contains the stack offset of the value. The code generator will add this stack offset to any address it prepares for the value. .sp 2 .un 10 The code generator always creates accessing code with the proper block qualification (or display) pointers. The block qualification is not explicitly described in the internal representation. But, the block node contains a number, max_display_steps, which is the maximum number of display (environment) pointers needed by the block; it is obtained from the level numbers of the block in which the reference occurs and the block in which the variable is declared. .sp 3 .br .ne 4 .sr N3252 "Based" .sr P3252 % .ur %N3252% .sp 2 .un 10 The code generator does not allocate based values. It computes their addresses by evaluating the offset and qualifier expressions found in the reference node used to access the value. .sp 3 .br .ne 4 .sr N3253 "Static" .sr P3253 % .ur %N3253% .sp 2 .un 10 Internal static values are allocated by the storage allocator module of the code generator. If the set bit is on, the value is placed in internal static storage (the linkage section) and the "allocated" bit is turned on. The location field is set to contain the offset of the value within the linkage section. This offset is added to any address developed by the code generator. .sp 2 .un 10 If the value is not set but is referenced (the "allocate" bit is on) and does not have an initial attribute the storage allocator issues a diagnostic warning the user that the value is used but not set. If the value is used, not set, and is initialized the value has its storage class changed to constant and is allocated within the text of the object program by the code generator. .sp 2 .un 10 Internal static values are initialized by the storage allocator and do not result in the creation of initialization code in the object program. .sp 2 .un 10 External static values result in the generation of a link (symbolic reference) in the linkage section of the object program. The storage allocator creates the link and sets the "allocated" bit on. The "location" field is set to contain the offset of this link. All addresses developed by the code generator are effectively indirect references through the link. .sp 2 .un 10 If the name of the variable has no $, the link contains information used by the linker which allocates and initializes the variable in stat_ the first time it is referenced in the process. The initial value is compiled into the text of the object program. If the name contains a $, the link also includes initialization or dynamic allocation information, but the variable is allocated in the segment "name$". If the segment does not exist, it is created in the process directory. .sp 3 .br .ne 4 .sr N3254 "Controlled" .sr P3254 % .ur %N3254% .sp 2 .un 10 Controlled storage is explicitly allocated by the program at runtime. For internal controlled storage, the code generator allocates a 3-pointer block in internal static whose offset is contained in symbol.location. The first pointer points to the most recent generation of storage for the variable, the second points to the most recent generation of storage for the descriptor if the variable has expression extents, and the third points to a 3-pointer block representing the previous generation of storage. For external controlled variables, symbol.location is the offset of a link to a similar 3-pointer block in external static. .sp 3 .br .ne 4 .sr N3255 "Defined" .sr P3255 % .ur %N3255% .sp 2 .un 10 No storage is allocated for the value. The code generator develops addresses for defined references by combining the offset of the defined reference with the offset of the base reference. The qualifier field of the defined reference node points to the base-reference. The locator qualification of the base is used as the locator qualification of the defined reference. .sp 3 .br .ne 4 .sr N3256 "Parameter" .sr P3256 % .ur %N3256% .sp 2 .un 10 Two methods are used to access a parameter and its descriptor: A reference to a parameter is always effectively qualified by a param_ptr operator. If a parameter appears in the same position within all entries in which it appears, the param_ptr operator will appear explicitly in each reference to it. Otherwise, the parameter reference is qualified by a unique automatic pointer whose value is set (via a suitable param_ptr operator) in the entry sequence of each entry in which the parameter appears. .sp 2 .un 10 (In the parameter's symbol node, the "location" field gives the position of the parameter within the first entry statement processed by declare. If declare finds that the parameter appears in any other position in any other entry statement, declare sets the "allocated" bit in the parameter's symbol. This all occurs in the processing of declarations in the block containing the entry labels, that is, the block father to the block containing the entry statements. .sp 2 .un 10 Thus, when declare processes the parameters themselves, it sets the "qualifier" field to a unique automatic pointer if "allocated" is set, or to a param_ptr expression if it is not. When the entry statements themselves are processed, the "allocated" bit may thus be inspected and suitable preparatory code inserted, if required. .ur Refer to "Call, Save, and Return Operators" on page 2-%P456%. .sp 3 .br .ne 4 .sr N3257 "Parameter-Descriptor" .sr P3257 % .ur %N3257% .sp 2 .un 10 This storage class is used for parameter descriptors and functions exactly like the parameter storage class. The compiler may create additional declarations of this storage class for entry(), returns(), and generic() attributes. Such declarations have no meaning after semantic translation and have no effect on the code generator since it never finds any references to them. .sp 3 .br .ne 4 .sr N3258 "Constants" .sr P3258 % .ur %N3258% .sp 2 .un 10 Named constants such as entry and file constants are represented by symbol nodes whose storage class is constant and whose type bits are file or entry. They are not part of the pooling mechanism used for literal constants. .sp 2 .un 10 Literal constants may result from source program constants or may be compiler-created. They have compiler generated unique names and refer to the token table entry for their name just like other declarations. Each declaration of a constant consists of a symbol node and associated reference node. All such declarations are threaded on a uni-directional chain beginning with the external static pointer "constant_list", and are linked together through the "multi_use" pointer of the symbol node. Each symbol node contains attributes which describe a value. The binary internal representation of the value is referenced by the "initial" field of the symbol node. .sp 2 .un 10 The chain of literal constant declarations is maintained in order of increasing size of the constant's value. More than one declaration may refer to the same value. Such groups of constants are said to be equivalenced. All declarations which have been equivalenced to another have their equivalence pointer set to refer to the symbol node of the constant to which they are equivalenced. A constant which is the base of other equivalenced constants is itself never equivalenced. The allocate bit of the base constant is on, and the allocate bits of all other equivalenced constants is off. See Figure 2-3. .br .sp 3 .ne 4 .sr N3259 "Temporary Values" .sr P3259 % .ur %N3259% .sp 2 .un 10 The compiler has need of a means to represent values which need not, and do not, correspond to generations of storage at run time. Temporaries fill this need. When a temporary generation of storage, as distinct from a temporary value, is required, an automatic variable must be declared. .sp 2 .un 10 The result of each operator is represented by a declaration of a temporary value. Each declaration consists of a symbol node and associated reference node. The symbol node contains all the attributes of the value and has a storage class of "temporary" or "return_value". .sp 2 .un 10 All such temporaries are threaded on a uni-directional chain beginning with the external static pointer "temporary_list" and are linked together through the "multi_use" pointer of the symbol nodes. The procedure "declare_temporary" does its best to pool temporary declarations to minimize the amount of compiler storage needed to represent these declarations. .sp 2 .un 10 Values which are never referenced except at the moment of evaluation in the program have a storage class of "temporary", and the "shared" bit is on in the reference node for the temporary. A shared temporary is used solely to indicate the output attributes of an operator. They are allocated and freed by the code generator at its discretion. .sp 2 .un 10 Values which must be maintained for an extended period of time because they are referenced elsewhere within the same region of the program have a storage class of "temporary" and a zero "shared" bit. The "ref_count" field of the reference node indicates the number of references to this value. .sp 2 .un 10 Values returned by functions whose return attribute contains asterisks (returns(char(*))) are represented by declarations whose storage class is "return_value". These temporaries are allocated by the called program but exist in the caller's stack. They continue to exist until a statement having a "free_temps" attribute is executed by the caller. .sp 3 .sr N4 "R_E_P_R_E_S_E_N_T_A_T_I_O_N_ _O_F_ _E_X_E_C_U_T_A_B_L_E_ _S_T_A_T_E_M_E_N_T_S_" .sr P4 % .ur %N4% .sp 2 The executable statements of a block are represented by two bi-directional chains of statement nodes attached to the block node. One chain represents the prologue statements generated by the compiler, the other represents the statements written by the programmer or generated from statements written by the programmer. .sp 3 .br .ne 4 .sr N41 "S_t_a_t_e_m_e_n_t_ _N_o_d_e_s_" .sr P41 % .ur %N41% .sp 2 .un 10 Each statement is represented by a statement node. .sp 2 .na Format: .sp 2 .un 10 dcl 1 statement based aligned, 2 node_type bit(9) unaligned, 2 source_id structure unaligned, 3 file_number bit(8), 3 line_number bit(14), 3 statement_number bit(5), 2 next ptr unaligned, 2 back ptr unaligned, 2 root ptr unaligned, 2 labels ptr unaligned, 2 reference_list ptr unaligned, 2 state_list ptr unaligned, 2 reference_count fixed(17) unaligned, 2 ref_count_copy fixed(17) unaligned, 2 object structure unaligned, 3 start fixed(17), 3 finish fixed(17), 2 source structure unaligned, 3 segment fixed(11), 3 start fixed(23), 3 length fixed(11), 2 prefix bit(12) unaligned, 2 optimized bit(1) unaligned, 2 free_temps bit(1) unaligned, 2 LHS_in_RHS bit(1) unaligned, 2 statement_type bit(9) unaligned, 2 processed bit(1) unaligned, 2 put_in_profile bit(1) unaligned, 2 generated bit(1) unaligned; .sp 2 .un 10 .ad .sp 2 .in 10 .un 10 node_type - has a value of "000000001"b which identifies this as a statement node. .sp 2 .un 10 source_id - identifies the original statement in the source text. Compiler-generated statements will carry the source_id of the original statement from which they were generated, the field will be zero if no original exists. .ur (For further detail, see description in "Block Structure" on page 2-%P2%.) .sp 2 .un 10 next - points to the next statement node in this block. .sp 2 .un 10 back - points to the previous statement node in this block. .sp 2 .un 10 root - points to the computation tree which represents the operators and operands of this statement. .sp 2 .un 10 labels - points to a uni-directional chain of list nodes, each of which points to a label node representing the declaration of a label that appeared on this statement. Subscripted labels are represented by a reference node which points to a label node. The offset field of the reference node indicates which element of the label array appeared as a label on this statement. .sp 2 .un 10 reference_list - used by the optimizer to collect a list of values which are known to be available when control reaches this statement. .sp 2 .un 10 state_list - used by the code generator. When the code generator processes a jump operator which references a statement not yet compiled by the code generator, it attaches a copy of the current machine state record to the state_list of the statement node referenced by the jump. If all references to a statement have been processed, the machine state available at the statement is the intersection of all of the machine states on the state_list. .sp 2 .un 10 reference_count - contains a count of all references to any of the labels that appeared in the label prefix of this statement. A labelled statement with no other references to its label has a count of one. .sp 2 .un 10 ref_count_copy - a copy of reference_count used by the optimizer and reduced by it to zero. .sp 2 .un 10 object - used by the code generator and the listing procedure to record the starting and finishing locations of the object code generated for the statement. .sp 2 .un 10 source - used by offset testing programs to locate the source text of this statement. procedure that produces the object code listing) .sp 2 .un 10 prefix - describes the condition prefix found on this source statement or inherited from the block. A value of "1"b means the condition is enabled. .sp 2 Bit Meaning .sp 2 1 underflow 2 overflow 3 zerodivide 4 fixedoverflow 5 conversion 6 size 7 subscriptrange 8 stringrange 9 stringsize 10-12 unused .sp 2 .un 10 optimized - this bit is set on by the optimizer when it first attaches a list of available values to the reference list. .sp 2 .un 10 free_temps - when the code generator encounters a statement node with this attribute it releases all variable-size temporaries and return values. .sp 2 .un 10 LHS_in_RHS - used in semantics to warn that portions of an aggregate target of an assignment statement are referenced in computing the right hand side and may not be changed until the whole right hand side has been computed. .sp 2 .un 10 statement_type - identifies the kind of statement. Its value is one of the values defined by the "statement_types" include file listed in the appendix. .sp 2 .un 10 processed - set by semantic_translator to indicate that the statement has already been processed, so avoiding an erroneous re-processing. It may be noted that completely processed statements are created during the semantic translation, by do_semantics and io_semantics for example, and the newly created statements may be inserted after the statement currently being processed. .sp 2 .un 10 put_in_profile - set for the first statement among those which realize a given source language statement. If the profile option is in effect, the code generator will compile special profile code for each marked statement. .sp 2 .un 10 generated - this bit is set on if the statement was generated by the compiler. .sp 3 .br .in 0 .ne 4 .sr N42 "R_e_f_e_r_e_n_c_e_ _N_o_d_e_s_" .sr P42 % .ur %N42% .sp 2 .un 10 All values (except scalar label constants) are accessed via a reference node. This node contains the offset, length, and other attributes which may be unique for each reference. .sp 2 .un 10 The declaration processor constructs a reference node for each symbol node. This reference node contains the offset and locator qualifier necessary to locate the value at run-time. Each subscripted reference or substr reference results in a unique offset and a unique reference. Each locator qualified reference results in a unique reference node with its own qualifier expression. References without subscripts or locator qualification are represented by unique instances of the reference node originaly created by the declaration processor. .sp 2 .un 10 If the "shared" bit of a reference node is on, it indicates to the code generator and optimizer that this reference node appears as a node within more than one computation tree, and that each occurrence of this node may represent a reference to a unique value. If the "shared" bit is off, each reference to the node _m_u_s_t represent a reference to the same value, and the "ref_count" of the reference node must indicate how many times this reference node is referenced in the tree. The optimizer transforms the representation of the program to maximize the number of reference nodes whose shared bit is zero. .sp 2 .na Format: .sp 2 .un 10 dcl 1 reference based aligned, 2 node_type bit(9) unaligned, 2 array_ref bit(1) unaligned, 2 varying_ref bit(1) unaligned, 2 shared bit(1) unaligned, 2 put_data_sw bit(1) unaligned, 2 processed bit(1) unaligned, 2 units fixed(3) unaligned, 2 ref_count fixed(17) unaligned, 2 c_offset fixed(24), 2 c_length fixed(24), 2 symbol ptr unaligned, 2 qualifier ptr unaligned, 2 offset ptr unaligned, 2 length ptr unaligned, 2 subscript_list ptr unaligned, .sp 2 .un 10 2 address structure unaligned, 3 base bit(3), 3 offset bit(15), 3 op bit(9), 3 no_address bit(1), 3 inhibit bit(1), 3 ext_base bit(1), 3 tag bit(6), 2 info structure unaligned, 3 address_in structure, 4 b dimension(0:7) bit(1), 4 storage bit(1), 3 value_in structure, 4 a bit(1), 4 q bit(1), 4 aq bit(1), 4 string_aq bit(1), 4 complex_aq bit(1), 4 decimal_aq bit(1), 4 b dimension(0:7) bit(1), 4 storage bit(1), 4 indicators bit(1), 4 x dimension(0:7) bit(1), 3 skip bit(3), 2 data_type fixed(5) unaligned, 2 bits structure unaligned, 3 padded_ref bit(1), 3 aligned_ref bit(1), 3 long_ref bit(1), 3 forward_ref bit(1), 3 ic_ref bit(1), 3 temp_ref bit(1), 3 defined_ref bit(1), 3 evaluated bit(1), 3 allocate bit(1), 3 allocated bit(1), 3 abnormal bit(1), 3 even bit(1), 3 perm_address bit(1), 3 aggregate bit(1), 3 hit_zero bit(1), 3 dont_save bit(1), 3 reserved bit(2), 2 relocation bit(12) unaligned, 2 last_usage bit(18) unaligned, 2 store_ins bit(18) unaligned; .sp 2 .un 10 .ad .sp 2 .un 10 .sp 2 .in 10 .un 10 node_type - has a value of "000000100"b which identifies this as a reference node. .sp 2 .un 10 array_ref - indicates that this is an array reference, not an array element reference. .sp 2 .un 10 varying_ref - indicates that this is a reference to a varying string. (This is unique because substr(x,i,j) = y results in a non-varying reference to x even when x is varying). .sp 2 .un 10 shared - indicates a reference node used (potentially) in many parts of the program tree, refering to a generation of storage rather than to a value. The reference node that hangs from the symbol node has the shared bit set if there are no locator qualifier, variable length, or subscript fields needed to complete the reference. References to such items are usually made by pointing to the symbol node's shared reference. If a reference node appears in the executable tree and has qualifier, length, or offset expressions, then it does not have the shared bit on; for a change to any such expression effectively alters the reference, and the compiler does not test for such changes. .sp 2 .un 10 put_data_sw - set by expression semantics when pre-processing the argument of a put_data_trans operator. It causes the subscripter to create a list of the subscripts of the scalar items and attach it at reference.subscript_list. This list is later attached to the put_data_trans operator and, ultimately, transmitted to the runtime I/O machinery. .sp 2 .un 10 processed - set by expression_semantics to indicate that the reference has been fully processed, so to avoid an erroneous re-processing. .sp 2 .un 10 units - indicates the units of the offset (bits, bytes, half_words, words). .sp 2 .un 10 ref_count - indicates that the reference is to a value which is referenced ref_count times (not necessarily in the current statement) without possibility of changing. (The ref_count is the number of pointers in the tree that point to this reference except in the case of a reference which is the first operand of an operator which sets its first operand; in this case, ref_count is the total number of pointers in the tree that point either to the reference or to the operator, the pointer from the operator to the reference not being counted for this purpose.) Values referenced under reference nodes with ref_count>0 may be kept in convenient registers by the code generator rather than, or as well as, in storage. The code generator reduces the ref_count after each use of the node. The optimizer tries to replace shared references with unshared references, as a means of dealing with common sub-expressions. In the case of a temporary, reduction of the ref_count to zero means that the storage or register holding the temporary may be reused. .sp 2 .un 10 c_offset - the constant offset. This field is meaningful whether or not the offset is variable. .sp 2 .un 10 c_length - the constant current length of a string value if reference.length is null. .sp 2 .un 10 symbol - points to the symbol or label node which represents the declaration of this value. .sp 2 .un 10 qualifier - points to the locator expression used to qualify this reference. Parse uses reference.qualifier to point to a locator qualifier if one appears. In the case of a defined item, qualifier points to a reference to the base item. .sp 2 .un 10 offset - points to the offset expression. If the offset is entirely constant this field is null. Parse uses reference.offset to point to a list node containing the subscript expression trees, if subscripts appear; the list is in reverse order. Parse does not distinguish subscripts and arguments. .sp 2 .un 10 length - points to the length expression giving the current length of the string value. If the length is constant then this field is null. Parse uses reference.length to point to a reference node for the structure qualifier if any. .sp 2 .un 10 subscript_list - io_semantics uses this to point to a list node holding the subscripts of this reference; for put_data. The subscript expressions are listed in (forward) order. The size of this list is used by the subscripter to set the size of the block of storage (block.plio_ssl) into which the code generator will store the evaluated subscripts; subscripter sets that size, ssl_size, as max( k+1 , ssl_size ), where k is the number of subscripts for the reference currently being processed. .sp 2 .un 10 padded_ref - indicates that the last word of the value is not shared with another value. Permits the code generator to assume, in most circumstances, that the spare bits of the last word of storage touched by this item are zero. However, see .ur passed_as_arg in "Symbol Nodes" on page 2-%P322%. .sp 2 .un 10 abnormal - set if the symbol has the abnormal bit set or if it is a reference to a non-local automatic variable that is passed as an argument by reference. .sp 2 .un 10 .sp 2 .in 10 .ll 45 .un 6 NOTE: All other fields are set and used only by the code generator. .in 0 .ll 65 .sp 3 .sr N43 "L_i_s_t_ _N_o_d_e_s_" .sr P43 % .ur %N43% .sp 2 .un 10 The list node is a general purpose node used to chain together other types of nodes. It is used to: .sp 2 .un 10 .in 9 .un 4 1. chain together the label nodes or label reference nodes which represent the label prefix. .sp 1 .un 4 2. chain together parameter descriptors of an entry() attribute. .sp 1 .un 4 3. chain together the members of a generic() attribute. .sp 1 .un 4 4. to represent the initial attribute. .sp 1 .un 4 5. to represent argument lists and descriptor lists of arg_list operators. .sp 2 .in 0 .na Format: .sp 2 .un 10 dcl 1 list based aligned, 2 node_type bit(9) unaligned, 2 reserved bit(12) unaligned, 2 number fixed(14) unaligned, 2 element dimension(n refer(list.number)) ptr unaligned; .sp 2 .un 10 .ad .sp 2 .in 10 .un 10 node_type - has a value of "000001011"b which identifies the node as a list node. .sp 2 .un 10 number - number of operands in this node. .sp 2 .un 10 element - pointers to the operands. .sp 2 .in 5 When list nodes are used to form uni-directional chains, the first "element" pointer is usually used to point to the next link in the chain. .in 0 .sp 3 .br .ne 4 .sr N44 "O_p_e_r_a_t_o_r_ _N_o_d_e_s_" .sr P44 % .ur %N44% .sp 2 .un 10 Each operation to be performed by the object program is represented by an operator node. All source language operators and all compiler generated operators have the same form and are subjected to the same optimizations. .sp 2 .un 10 .na dcl 1 operator based aligned, 2 node_type bit(9) unaligned, 2 op_code bit(9) unaligned, 2 shared bit(1) unaligned, 2 processed bit(1) unaligned, 2 optimized bit(1) unaligned, 2 number fixed(14) unaligned, 2 operand dimension(n refer(operator.number)) ptr unaligned; .sp 2 .un 10 .ad .sp 2 .in 10 .un 10 node_type - has a value of "000000011"b which identifies this as an operator node. .sp 2 .un 10 op_code - is one of the op codes listed in the appendix. .sp 2 .un 10 shared - indicates that this operator appears as a subexpression of another computation elsewhere in this program. The optimizer uses this bit to keep itself from getting into trouble. .sp 2 .un 10 processed - set by semantic translator to prevent erroneous re-processing of this operator tree. .sp 2 .un 10 optimized - this computation has been previously performed and it does not need to be re-evaluated. Operand one contains the correct value. .sp 2 .un 10 number - the number of operands .sp 2 .un 10 operand - pointers to the operands .in 0 .sp 3 .br .ne 4 .sr N45 "O_p_e_r_a_t_o_r_s_" .sr P45 % .ur %N45% .sp 2 The operators of the internal representation closely resemble the operators of the PL/I language. These operators are listed in the appendix and can be classified into distinct groups of operators having similar function. The following sections describe each class of operators. .sp 3 .br .ne 4 .sr N451 "ARITHMETIC OPERATORS" .sr P451 % .ur %N451% .sp 2 Arithmetic operands are: .sp 2 1. binary fixed (real|complex) .sp 1 2. binary float (real|complex) .sp 1 3. decimal (fixed|float)(real|complex) .sp 2 The code generator performs all necessary conversions between mode for cases 1 and 2. It performs conversions of mode and type for case 3. These conversions are done by the code generator because it can exploit particular hardware features. .sp 2 Operands may be any precision and scale, and may be packed or unpacked. The desired output is defined by the attributes of operand one. .sp 3 .br .ne 4 .sr N452 "STRING OPERATORS" .sr P452 % .ur %N452% .sp 2 The operands of string operators are scalar string values. They are either a all bit-strings or all character-strings. The boolean operators only allow bit-string operands while the concatenation operator allows either. The reference given as operand one describes the desired result. .sp 3 .br .ne 4 .sr N453 "ASSIGNMENT OPERATORS" .sr P453 % .ur %N453% .sp 2 The assign operator allows operands of any data type. Conversions are permitted between any combination of arithmetic and string data, between offset and pointer, between pointer and offset, between packed and unpacked data, and it allows assignment of pointer to file, and integer to arg_descriptor, arg_descriptor to integer, label constant to integer, and label constant to pointer. .sp 2 Assign_size_ck allows assignments between any combination of arithmetic and string data. Code is generated to check whether the receiving variable has sufficient precision or string length to hold the value to be assigned; if not, the size or stringsize condition is signaled. .sp 2 The assign_zero operator requires that its operand be fixed binary aligned with a precision of <36 and a scale factor of zero. .sp 2 The copy_words operator copies the storage of operand two into the storage of operand one. The number of words to be copied is given by operand three. The operator is used to implement assignment of PL/I arrays or structures. It is generated only for non-packed aggregates of identical type and aggregation. .sp 2 The copy_string operator copies the storage of operand two into the storage of operand one. The number of bits to be copied is given by operand three. The operator is used to implement assignment of PL/I arrays and structures. It is generated only for packed aggregates of identical type and aggregation. .sp 2 The make_desc operator is used to create a basic argument descriptor value. Operand two is a bit string value representing the left part of an argument descriptor, and operand three is an integer expression representing the size value of the basic argument descriptor. The operator combines operands two and three to produce a basic argument descriptor value. .sp 2 block_assign - This operator has n operands. Operands 2 through n are integer expressions to be evaluated and stored in operand one. Operand one is a temporary or variable whose data type is block_storage and whose size is sufficient to contain the integer values. The block_assign operator is used to process the subscript list of an array element or a put data statement. .sp 3 .br .ne 4 .sr N454 "RELATIONAL OPERATORS" .sr P454 % .ur %N454% .sp 2 Operand one of the relational operators is a bit_string value of length one. .ur The other two operands are either: both arithmetic (see "Arithmetic Operators" on page 2-%P451%), character-string, bit-string, pointer, offset, label, entry, or file expressions. .sp 3 .br .ne 4 .sr N455 "TRANSFER OPERATORS" .sr P455 % .ur %N455% .sp 2 Operand one of a transfer operator is a label valued expression. The second operand of the jump_true and jump_false operators is a bit-string value. The second and third operands of other conditional transfer operators obey the rules specified for the operands of relational operators. .sp 3 .br .ne 4 .sr N456 "CALL, SAVE, AND RETURN OPERATORS " .sr P456 % .ur %N456% .sp 2 The std_arg_list operator results in the creation of a Multics Standard Argument List in automatic storage. Operand one represents the argument list, and is a temporary whose storage class is block_storage. During argument list creation all argument expressions are evaluated. .sp 2 Operand two is a list node containing a vector of pointers to the argument expressions. The last argument of function references is the return value and is a "return_value", "temporary" or a variable reference. "Return value" storage class means that the called procedure will allocate space for .ur the return value. (Se "Temporary Values" on page 2-%P3259%.) .sp 2 Operand three is a list node containing a vector of pointers to references to the argument descriptors. If no descriptors are needed operand three is null. .sp 2 The std_call operator results in a Multics Standard Call. Operand one is null if the call is not a function reference; otherwise it points to the reference node used to access the return value. Operand two is an entry expression giving the entry to be invoked. Operand three is null if there are no arguments or return value; otherwise it is an argument list operator which prepared the argument list. .sp 2 The std_entry operator results in the creation of entry descriptive information and a Multics Standard entry sequence in the object program. The entry descriptive information includes the number of parameters and a descriptor for each parameter. .sp 2 The ex_prologue operator causes the prologue to be evaluated. .sp 2 The allot_auto operator makes permanent allocations in the stack. It is a pointer valued operator whose second operand is an integer expression specifying the number of words to be allocated. The storage is released by the return or non-local go to operator. .sp 2 The "param_ptr" and "param_desc_ptr" are used to access the argument pointer and argument descriptor pointer which references the kth argument of the entry used to invoke the procedure whose block node is referenced by operand three. They are used to assign these pointers to the automatic pointers used to reference the parameter or parameter descriptor. See .ur "Parameter" on page 2-%P3256%. .sp 2 The std_return operator returns via the Multics Standard Return. It has no arguments - an assignment statement has already assigned the return value to the last parameter. .sp 2 The return_value operator returns via the Multics standard return, but requires the evaluation, allocation, and assignment of the return value to the last parameter. The descriptor of the return value has already been set. See Figure 2-4. .sp 3 .br .ne 4 .sr N457 "OFFSET OPERATORS" .sr P457 % .ur %N457% .sp 2 Offset operators are used to compute the addresses of values at run-time. Their output operands are binary integers and their input operands are usually binary integer expressions. The "desc_size" operator has an arg_descriptor as operand two, and the "bit_pointer" operator has a pointer value as operand two. .sp 3 .br .ne 4 .sr N458 "BUILT-IN FUNCTION OPERATORS" .sr P458 % .ur %N458% .sp 2 The built-in function operators are a miscellaneous group of operators which support PL/I built-in functions. The types of their arguments are defined by the language. All argument conversions required by the language have been done and are not implied by the operator. .sp 3 .br .ne 4 .sr N459 "INPUT/OUTPUT OPERATORS" .sr P459 % .ur %N459% .sp 2 The input/output operators may be divided into four classes. .sp 1 First are the operators get_file, get_string, put_file, put_string, read_file, write_file, locate_file, delete_file, rewrite_file, open_file, and close_file. These are used by the parse to pass parsed input/output statements to the semantic phase. Each of these operators has operands enough to compass the references and expressions occurring in the options of the statement; each has one further operand, the last, which contains a bit(36) constant which encodes the options which have appeared and also the statement type. The operands of these operators are processed, and considerably rearranged, by the semantics before the code generation phase and, with the exception of the operators open_file and close_file which are retained without operands, these operators are not passed on to the code generator. .sp 1 Second are the transmission operators: get_list_trans, get_edit_trans, get_data_trans, put_list_trans, put_edit_trans, and put_data_trans. The get_data_trans operator is presented to the code generator with a single operand, a join of the items appearing in the list of the get data statement. The code generator will transform this join into a constant list of runtime-symbol-table offsets which will serve to identify the allowable runtime references. The put_data_trans operator has two operands, a list of subscript expressions and the reference with which they are associated. The code generator will see that the list of subscripts, as well as the address and runtime-symbol-table offset of the reference, are made available at runtime. Each of the other four transmission operators takes a descriptor-valued expression and the reference to which it corresponds; the code generator will see that the descriptor and the address of the item referenced are available at runtime. Third are the special operators: record_io, stream_prep, and terminate_trans. The record_io operator takes one or two operands and the stream_prep operator takes two operands. In both cases the first operand is a bit(36) constant which is transmitted to the runtime mechanisms and defines the work to be done. In both cases, the second operand, if present, is a label (the label of a null statement following the other statements which realize the I/O statement) to which control may be transferred at runtime if the execution of the statement cannot be continued. The terminate_trans operator is always compiled, after the list items, if any, in a get or put statement and has no operands; it is compiled by the code generator into the invocation of terminating code at runtime. .sp 1 Fourth is the set of format operators. The first two operands of a format operator are standard: the first identifies the next format operator (in the case of the operator l_parn, the operator identified is that following the associated r_parn); and the second is an integer expression for the repitition count. The third and other operands depend on the operator. For l_parn, the third operand identifies the first format operator of the parenthesised format list. In the r_format operator, the third operand is a reference to a format value. In the c_format, the third and fourth operands identify the component real format operators. In all other cases, the third and subsequent operands are integer expressions. (It is to be noted that all expressions, including those involved in the format-valued reference in an r_format, are to be evaluated at runtime from the runtime procedures but are compiled, when necessary, as internal procedures of the block containing the I/O statement.) .sp 1 .na .sp 3 .sr N4510 "AGGREGATE OPERATORS: LOOP AND JOIN" .sr P4510 % .ur %N4510% .sp 2 The loop operator takes five operands and is used for the expansion of dimensioned aggregates. Operand one points to the expression to be expanded. Operand two is a reference, the control variable in the loop. Operand three and four are the lower and upper bound expressions for the loop. Operand five is a list of those scalar expressions which have been pulled out of the loop for optimization purposes. .sp 1 The join operator has a variable number of operands which it serves to present in order to the code generator. Its operands may not be null. It is used in the expansion of structured aggregates, in the presentation of data lists in get and put statements, and in the compilation of most I/O statements. .sp 3 .bp .in 0 .sp 5 Appendix - Codes used in The Internal Representation .br .ne 23 .sp 7 The Node Types (nodes.incl.pl1) .sp 2 block_node "000000001"b statement_node "000000010"b operator_node "000000011"b reference_node "000000100"b token_node "000000101"b symbol_node "000000110"b context_node "000000111"b array_node "000001000"b bound_node "000001001"b format_value_node "000001010"b list_node "000001011"b default_node "000001100"b machine_state_node "000001101"b source_node "000001110"b label_node "000001111"b cross_reference_node "000010000"b sf_par_node "000010001"b temporary_node "000010010"b .br .ne 10 .sp 2 The Block Types (block_types.incl.pl1) .sp 2 root_block "000000001"b external_procedure "000000010"b internal_procedure "000000011"b begin_block "000000100"b on_unit "000000101"b .br .ne 12 .sp 2 The Boundary and Offset Unit Values (boundary.incl.pl1) .sp 2 bit_ 1 character_ 2 half_ 3 word_ 4 mod2_ 5 mod4_ 6 mod8_ 7 .br .ne 10 .sp 2 The Declare Types (declare_type.incl.pl1) .sp 2 by_declare "001"b by_explicit_context "010"b by_context "011"b by_implication "100"b by_compiler "101"b .br .ne 43 .sp 2 The Statement Types (statement_types.incl.pl1) .sp 2 unknown_statement "000000000"b allocate_statement "000000001"b assignment_statement "000000010"b begin_statement "000000011"b call_statement "000000100"b close_statement "000000101"b declare_statement "000000110"b lock_statement "000000111"b delete_statement "000001000"b display_statement "000001001"b do_statement "000001010"b else_clause "000001011"b end_statement "000001100"b entry_statement "000001101"b exit_statement "000001110"b format_statement "000001111"b free_statement "000010000"b get_statement "000010001"b goto_statement "000010010"b if_statement "000010011"b locate_statement "000010100"b null_statement "000010101"b on_statement "000010110"b open_statement "000010111"b procedure_statement "000011000"b put_statement "000011001"b read_statement "000011010"b return_statement "000011011"b revert_statement "000011100"b rewrite_statement "000011101"b signal_statement "000011110"b stop_statement "000011111"b system_on_unit "000100000"b unlock_statement "000100001"b wait_statement "000100010"b write_statement "000100011"b default_statement "000100100"b continue_statement "000100101"b .sp 2 .pa .sp 2 Hardware and Environment Parameters (system.incl.pl1) .sp 2 max_p_flt_bin_1 27 max_p_flt_bin_2 63 max_p_fix_bin_1 35 max_p_fix_bin_2 71 max_p_dec 61 min_scale -128 max_scale +127 max_bit_string 2359296 max_char_string 262144 max_area_size 65536 min_area_size 30 bits_per_word 36 bits_per_packed_ptr 36 bits_per_double 72 characters_per_half 2 characters_per_word 4 characters_per_double 8 words_per_label_var 4 words_per_entry_var 4 bits_per_character 9 bits_per_half 18 default_area_size 1024 default_flt_bin_p 27 default_fix_bin_p 17 default_flt_dec_p 10 default_fix_dec_p 7 .sp 2 .in 10 integer_type "010000000000000000000100000011000000"b .sp 2 dec_integer_type "010000000000000000000100000101000000"b .sp 2 pointer_type "000001000000000000000100000000000000"b .sp 2 real_type "001000000000000000000100000011000000"b .sp 2 complex_type "001000000000000000000100000010100000"b .sp 2 builtin_type "000000000000000010000000000000000000"b .sp 2 storage_block_type "000000000000100000000000000000000000"b .sp 2 arg_desc_type "000000000001000000000000000000000000"b .sp 2 local_label_var_type "000000001000000000000100001000010000"b .sp 2 entry_var_type "000000000100000000000000000000010000"b .sp 2 bit_type "000100000000000000000000000000000000"b .sp 2 char_type "000010000000000000000000000000000000"b .sp 2 f_logical_type "000100000000000000000100000000000000"b .sp 2 f_dim_type "000000000000000000000101000000010000"b .sp 2 f_type_conflict "111100000000000010000000000000000000"b .sp 2 f_dim_conflict "100000000100000010000000000000000000"b .sp 2 .sp 2 .sp 2 f_external_type "000000000100000000000000000000000100 010000000001000000000000000000000000"b .sp 2 f_test_type "011100000000000000000000000000000000 000000000000000000000000000000000000"b .sp 2 f_auto_type "000000000000000000000101000000010000 100010000000000000000000000000000000"b .sp 2 f_member_type "000000000000000000000101000000010000 100100100000000000000000000000100000"b .sp 2 f_common_type "100000000000000000000000000000000000 010000100000000000000000000000000000"b .sp 2 f_external_conflict "100000000000000000010000000000000000 000110000000000000000000000000000000"b .sp 2 f_auto_conflict "100000000100000010000000000000000000 000100000100000000000000000000000000"b .sp 2 f_common_conflict "100000000100000010000000000000000000 000110000100000000000000000000000000"b .sp 2 f_dat_equ_conflict "100000000100010010000000000000000000 000000000100000000000000000000000000"b .in 0 .br .ne 50 .sp 2 The Token Types (token_types.incl.pl1) .sp 2 .sp 2 no_token "000000000"b identifier "100000000"b isub "010000000"b plus "001000001"b minus "001000010"b asterisk "001000011"b slash "001000100"b expon "001000101"b not "001000110"b and "001000111"b or "001001000"b cat "001001001"b eq "001001010"b ne "001001011"b lt "001001100"b gt "001001101"b le "001001110"b ge "001001111"b ngt "001010000"b nlt "001010001"b assignment "001010010"b colon "001010011"b semi_colon "001010100"b comma "001010101"b period "001010110"b arrow "001010111"b left_parn "001011000"b right_parn "001011001"b bit_string "000100001"b char_string "000100010"b bin_integer "000110001"b dec_integer "000110011"b fixed_bin "000110000"b fixed_dec "000110010"b float_bin "000110100"b float_dec "000110110"b i_bin_integer "000111001"b i_dec_integer "000111011"b i_fixed_bin "000111000"b i_fixed_dec "000111010"b i_float_bin "000111100"b i_float_dec "000111110"b .sp 2 is_identifier "100000000"b is_isub "010000000"b is_delimiter "001000000"b is_constant "000100000"b is_arith_constant "000010000"b .sp 2 .br .ne 7 (FORTRAN ONLY) .sp 2 label_argument "010000001"b hollerith_constant_header "010000010"b x_format_f "010000011"b new_line "001011010"b logical_constant "000100001"b .sp 2 .pa .sp 2 The Operators (op_codes.incl.pl1) .sp 2 add "000010001"b opnd(1) <- opnd(2)+opnd(3) .sp 2 sub "000010010"b opnd(1) <- opnd(2)-opnd(3) .sp 2 mult "000010011"b opnd(1) <- opnd(2)*opnd(3) .sp 2 div "000010100"b opnd(1) <- opnd(2)/opnd(3) .sp 2 negate "000010101"b opnd(1) <- -opnd(2) .sp 2 exp "000010110"b opnd(1) <- opnd(2) ** opnd(3) .sp 2 and_bits "000100001"b opnd(1) <- opnd(2) & opnd(3) .sp 2 or_bits "000100010"b opnd(1) <- opnd(2)|opnd(3) .sp 2 xor_bits "000100011"b opnd(1) <- opnd(2) xor opnd(3) .sp 2 not_bits "000100100"b opnd(1) <- ^opnd(2) .sp 2 cat_string "000100101"b opnd(1) <- opnd(2)||opnd(3) .sp 2 assign "000110001"b opnd(1) <- opnd(2) .sp 2 assign_size_ck "000110010"b opnd(1) <- opnd(2) .sp 2 assign_zero "000110011"b opnd(1) <- 0 .sp 2 copy_words "000110100"b move opnd(2) to opnd(1) by opnd(3) words .sp 2 copy_string "000110101"b move opnd(2) to opnd(1) by opnd(3) units .sp 2 make_desc "000110110"b opnd(1) <- descriptor(opnd(2),opnd(3)) .sp 2 pack "000111000"b opnd(1) <- encode to picture opnd(2) .sp 2 unpack "000111001"b opnd(1) <- decode from picture opnd(2) .sp 2 less_than "001000100"b opnd(1) <- opnd(2) < opnd(3) .sp 2 greater_than "001000101"b opnd(1) <- opnd(2) > opnd(3) .sp 2 equal "001000110"b opnd(1) <- opnd(2) = opnd(3) .sp 2 not_equal "001000111"b opnd(1) <- opnd(2) ^= opnd(3) .sp 2 less_or_equal "001001000"b opnd(1) <- opnd(2) <= opnd(3) .sp 2 greater_or_equal "001001001"b opnd(1) <- opnd(2) >= opnd(3) .sp 2 jump "001010001"b go to opnd(1) unconditionally .sp 2 jump_true "001010010"b go to opnd(1) if opnd(2) is not 0 .sp 2 jump_false "001010011"b go to opnd(1) if opnd(2) is all 0 .sp 2 jump_if_lt "001010100"b go to opnd(1) if opnd(2) < opnd(3) .sp 2 jump_if_gt "001010101"b go to opnd(1) if opnd(2) > opnd(3) .sp 2 jump_if_eq "001010110"b go to opnd(1) if opnd(2) = opnd(3) .sp 2 jump_if_ne "001010111"b go to opnd(1) if opnd(2) ^= opnd(3) .sp 2 jump_if_le "001011000"b go to opnd(1) if opnd(2) <= opnd(3) .sp 2 jump_if_ge "001011001"b go to opnd(1) if opnd(2) >= opnd(3) .sp 2 jump_three_way "001011010"b opnd(1) = expression go to opnd(2) if expression < 0 go to opnd(3) if expression = 0 go to opnd(4) if expression > 0 .sp 2 std_arg_list "001100001"b opnd(1) <- arglist(opnd(2) desclist(opnd(3))) .sp 2 return_words "001100010"b return aggregate opnd(1), opnd(2) is length in words .sp 2 std_call "001100011"b opnd(1) <- call opnd(2) with opnd(3) .sp 2 return_bits "001100100"b return aggregate opnd(1), opnd(2) is length in bits .sp 2 std_entry "001100101"b entry(opnd(1)... opnd(n)) .sp 2 return_string "001100110"b return string opnd(1) .sp 2 ex_prologue "001100111"b execute the prologue -no operands- .sp 2 allot_auto "001101000"b opnd(1) <- addrel(stack,opnd(2)) .sp 2 param_ptr "001101001"b opnd(1) <- ptr to opnd(2) in block opnd(3) .sp 2 param_desc_ptr "001101010"b opnd(1) <- ptr to opnd(2) in block opnd(3) .sp 2 std_return "001101011"b return -no arguments- .sp 2 allot_ctl "001101100"b allocate opnd(1) and its desc opnd(2) .sp 2 free_ctl "001101101"b free opnd(1) .sp 2 bit_to_char "010000000"b opnd(1) <- (opnd(2)+8)/9 .sp 2 bit_to_word "010000001"b opnd(1) <- (opnd(2)+35)/36 .sp 2 char_to_word "010000010"b opnd(1) <- (opnd(2)+3)/4 .sp 2 half_to_word "010000011"b opnd(1) <- (opnd(2)+1)/2 .sp 2 word_to_mod2 "010000100"b opnd(1) <- (opnd(2)+1)/2*2 .sp 2 word_to_mod4 "010000101"b opnd(1) <- (opnd(2)+3)/4*4 .sp 2 word_to_mod8 "010000110"b opnd(1) <- (opnd(2)+7)/8*8 .sp 2 rel_fun "010000111"b opnd(1) <- rel(opnd(2)) .sp 2 baseno_fun "010001000"b opnd(1) <- baseno(opnd(2)) .sp 2 desc_size "010001001"b opnd(1) <- substr(opnd(2),13,24) .sp 2 ceil_fun "010010000"b opnd(1) <- ceil(opnd(2)) .sp 2 floor_fun "010010001"b opnd(1) <- floor(opnd(2)) .sp 2 round_fun "010010010"b opnd(1) <- round(opnd(2)) .sp 2 sign_fun "010010011"b opnd(1) <- sign(opnd(2)) .sp 2 abs_fun "010010100"b opnd(1) <- abs(opnd(2)) .sp 2 trunc_fun "010010101"b opnd(1) <- trunc(opnd(2)) .sp 2 tran_sign_fun "010010110"b opnd(1) <- abs(opnd(2)) with the sign of opnd(3) .sp 2 index_fun "010100000"b opnd(1) <- index(opnd(2),opnd(3)) .sp 2 off_fun "010100001"b opnd(1) <- offset(opnd(2),opnd(3)) .sp 2 complex_fun "010100010"b opnd(1) <- complex(opnd(2),opnd(3)) .sp 2 conjg_fun "010100011"b opnd(1) <- conjg(opnd(2),opnd(3)) .sp 2 mod_fun "010100100"b opnd(1) <- mod(opnd(2),opnd(3)) .sp 2 repeat_fun "010100101"b opnd(1) <- repeat(opnd(2),opnd(3)) .sp 2 verify_fun "010100110"b opnd(1) <- verify(opnd(2),opnd(3)) .sp 2 translate_fun "010100111"b opnd(1) <- translate(opnd(2),opnd(3)) .sp 2 lock_fun "010101000"b opnd(1) <- stac(opnd(2),opnd(3)) .sp 2 real_fun "010101001"b opnd(1) <- real(opnd(2)) .sp 2 imag_fun "010101010"b opnd(1) <- imag(opnd(2)) .sp 2 length_fun "010101011"b opnd(1) <- length(opnd(2)) .sp 2 pl1_mod_fun "010101100"b opnd(1) <- mod(opnd(2)) .sp 2 search_fun "010101101"b opnd(1) <- search(opnd(2),opnd(3)) .sp 2 allocation_fun "010101110"b opnd(1)<-allocation(opnd(2)) .sp 2 reverse_fun "010101111"b opnd(1) <- reverse(opnd(2)) .sp 2 addr_fun "010110000"b opnd(1) <- addr(opnd(2)) .sp 2 addr_fun_bits "010110001"b opnd(1) <- addr(opnd(2)) .sp 2 ptr_fun "010110010"b opnd(1) <- ptr(opnd(2),opnd(3)) .sp 2 baseptr_fun "010110011"b opnd(1) <- baseptr(opnd(2)) .sp 2 addrel_fun "010110100"b opnd(1) <- addrel(opnd(2),opnd(3)) .sp 2 min_fun "011000000"b opnd(1) <- min(opnd(1),opnd(2),...) .sp 2 max_fun "011000001"b opnd(1) <- max(opnd(1),opnd(2),...) .sp 2 pos_dif_fun "011000010"b opnd(1) <- opnd(2) - min(opnd(2),opnd(3)) .sp 2 enable_on "011010100"b opnd(1) is the cond name opnd(2) is the file name opnd(3) is the block .sp 2 revert_on "011010101"b opnd(1) is the cond name, opnd(2) is the file name .sp 2 signal_on "011010110"b opnd(1) is the cond name opnd(2) is the file name .sp 2 bound_ck "011100000"b opnd(1) <- opnd(2) if opnd(3) <= opnd(2) <= opnd(4) .sp 2 range_ck "011100001"b opnd(1) <- opnd(2) if opnd(3) <= opnd(2) <= opnd(4) .sp 2 loop "011100010"b do opnd(1) for opnd(2) from opnd(3) to opnd(4) by 1 , opnd(5) being a list of scalar expressions removed from the loop for optimization purposes. .sp 2 join "011100011"b compile in sequence: opnd(1), opnd(2) ... opnd(n) .sp 2 r_parn "011110001"b .sp 2 l_parn "011110010"b opnd(1) is format operator after parenthesized format list, opnd(2) is repitition count, opnd(3) is first format operator of parenthesized format list .sp 2 r_format "011110011"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is format-valued reference .sp 2 c_format "011110100"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is real format operator opnd(4) is real format operator .sp 2 f_format "011110101"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is field size opnd(4) is default decimal position opnd(5) is scale factor .sp 2 e_format "011110110"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is field size opnd(4) is default decimal position opnd(5) is total precision .sp 2 b_format "011110111"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is field size .sp 2 a_format "011111000"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is field size .sp 2 x_format "011111001"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is field size .sp 2 skip_format "011111010"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is skip count .sp 2 column_format "011111011"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is target column .sp 2 page_format "011111100"b opnd(1) is next format operator opnd(2) is repitition count .sp 2 line_format "011111101"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is target line number .sp 2 picture_format "011111110"b opnd(1) is next format operator opnd(2) is repitition count opnd(3) is picture constant .sp 2 get_list_trans "100000000"b getlist(opnd(2)) with opnd(1)=desc(opnd(2)) .sp 2 get_edit_trans "100000001"b getedit(opnd(2)) with opnd(1)=desc(opnd(2)) .sp 2 get_data_trans "100000010"b opnd(1) is join of items (references) in data list. .sp 2 put_list_trans "100000011"b putlist(opnd(2)) with opnd(1)=desc(opnd(2)) .sp 2 put_edit_trans "100000100"b putedit(opnd(2)) with opnd(1)=desc(opnd(2)) .sp 2 put_data_trans "100000101"b putdata(opnd(2)) where opnd(1) points to list-node of subscript expressions (or is null) .sp 2 terminate_trans "100000110"b terminate stream transmission .sp 2 stream_prep "100000111"b initiate stream transmission opnd(1) is description of statement opnd(2) is label for abnormal return .sp 2 record_io "100001000"b perform record_i/o operation opnd(1) is description of statement and options; opnd(2), if present, is label for abnormal return .sp 2 open_file "100011001"b opnd(1) is linesize opnd(2) is file opnd(3) is title opnd(4) is pagesize opnd(5) is attribute-bits opnd(6) is job-bits .sp 2 close_file "100011010"b opnd(2) is file opnd(3) is job-bits .sp 2 .sp 2 .sp 2 These operators are produced by the parse but are not used as input to the code generator. .sp 2 They are processed by the semantic translator. .sp 2 .sp 2 .sp 2 return_value "100010010"b return(opnd(1)) .sp 2 allot_based "100010011"b allot opnd(1) in opnd(2) .sp 2 free_based "100010100"b free opnd(1) out of opnd(2) .sp 2 get_file "100010101"b opnd(1) is copy opnd(2) is file opnd(3) is skip opnd(4) is list opnd(5) is job-bits .sp 2 get_string "100010110"b opnd(1) is copy opnd(2) is string opnd(4) is list opnd(5) is job-bits .sp 2 put_file "100010111"b opnd(1) is line opnd(2) is file opnd(3) is skip opnd(4) is list opnd(5) is job-bits .sp 2 put_string "100011000"b opnd(2) is string opnd(4) is list opnd(5) is job-bits .sp 2 read_file "100011011"b opnd(1) is set, into, or ignore opnd(2) is file opnd(3) is key or keyto opnd(4) is job-bits .sp 2 write_file "100011100"b opnd(1) is from opnd(2) is file opnd(3) is keyfrom opnd(4) is job-bits .sp 2 locate_file "100011101"b opnd(2) is file opnd(3) is keyfrom opnd(4) is variable to be located opnd(5) is job-bits .sp 2 do_fun "100011110"b opnd(1) is join of a list opnd(2) is control variable ref opnd(3) is specification operator .sp 2 do_spec "100011111"b opnd(1) to opnd(2) by opnd(3) repeat opnd(4) while opnd(5) opnd(6) is next specification .sp 2 rewrite_file "100100000"b opnd(1) is from opnd(2) is file opnd(3) is key opnd(4) is job-bits .sp 2 delete_file "100100001"b opnd(2) is file opnd(3) is key opnd(4) is job-bits .sp 2 refer "100100101"b opnd(1) refer(opnd(2)) .sp 2 prefix_plus "100100110"b opnd(1) <- +opnd(2) .sp 2 nop "100100111"b no-op  Chapter3.runoff 08/14/74 0844.0rew 08/14/74 0844.0 415458 .m1 6 .m2 0 .m3 4 .m4 6 .ms 1 .ad .ar .fo 1 "DRAFT: SUBJECT TO CHANGE"%sec%-%"order number" .sr sec 3 .sp 7 .ce 1 SECTION III .sp 2 .ce 1 SYNTACTIC TRANSLATION .sp 4 A_N__O_V_E_R_V_I_E_W_ .sp 2 Syntactic translation is the process of disassembling the source program into its consituent parts called tokens, building an internal representation of the program, and putting information into the symbol table and other tables. The syntactic translator consists of two modules called the lexical analyser and the parse. .bp L_E_X_I_C_A_L__A_N_A_L_Y_S_I_S_ .sp 2 The lexical analyser scans the characters of the source program from left to right and organizes the characters into groups of tokens which represent a statement. It creates the source listing file, it also builds a token table which contains the source representation of all tokens used in the source program. The lexical analyser is called by the parse each time the parse needs a new statement. .sp 2 The token table produced by the lexical analyser contains a single entry for each unique token in the source program. Searching of the token table is done using a hash coded scheme that provides quick access to the table. .sp 2 Each token table entry contains a pointer which may eventually point to a declaration of the token, that is, the symbol node. For each statement, the lexical analyzer builds a vector of pointers to the tokens which were found in the statement. This vector is the input to the parse. .* .bp .in 0 NAME: lex .sp 3 Function: .sp 2 .in 4 .un 4 1. It maintains an internal static running character index to the source segment that shows at any instant the beginning of the source that the lexical analyser has yet to process. .sp 1 .un 4 2. It scans the source segment until it reaches the next semicolon, and groups the characters it has scanned into a set of lexical units called tokens. The order of tokens is kept in an internal static array of pointers called the token list. When lex returns, the character index is pointing at the character immediately following the semicolon that it has just scanned. .sp 1 .un 4 3. When an include statement is found in the text, lex treats the include segment as the current source segment and goes on processing, until it reaches the end of the include segment. Then it reverts to the original source segment. .sp 1 .un 4 4. If a listing is required, lex writes the source into the listing segment. .in 0 .sp 3 Entry: .sp 2 lex .sp 3 Usage: .sp 2 declare lex entry; .sp 2 call lex; .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .br if_parse .sp 3 Entry: .sp 2 lex$write_last_line .sp 2 This entry checks that no text follows the logical end of the program. This entry writes the last line of the source into the listing segment. It also writes the list of all include files used by the program into the listing segment. .sp 3 Usage: .sp 2 declare lex$write_last_line entry; .sp 2 call lex$write_last_line; .sp 3 Programs that invoke this entry: .sp 2 parse .sp 3 Entry: .sp 2 lex$terminate_source .sp 2 This entry terminates the source segment. .sp 3 Usage: .sp 2 declare lex$terminate_source entry; .sp 2 call lex$terminate_source; .sp 3 Programs that invoke this entry: .sp 2 pl1 .sp 3 Entry: .sp 2 lex$scan_token_table .sp 2 This entry goes down the hash table and checks for duplicate declarations. .sp 3 Usage: .sp 2 declare lex$scan_token_table entry; .sp 2 call lex$scan_token_table; .sp 3 Programs that invoke this entry: .sp 2 pl1 .sp 3 Entry: .sp 2 lex$initialize_lex .sp 2 This entry initializes the data$data pointer once per process, and initializes the hash table once per compilation. .sp 3 Usage: .sp 2 declare lex$initialize_lex entry; .sp 2 call lex$initialize_lex; .sp 3 Programs that invoke this entry: .sp 2 parse .sp 3 Entry: .sp 2 lex$meter .sp 2 This entry gathers some statistics about the hash table. .in 4 .un 4 1. Number of empty buckets in the hash table. .un 4 2. Total number of tokens used in the program. .un 4 3. Maximum number of tokens in a single bucket of hash table. .un 4 4. Total storage used by all the token nodes for the program. .in 0 .sp 3 Usage: .sp 2 declare lex$meter entry ( token_count, token_words, empty_buckets, maximum ); .sp 2 call lex$meter ( fixed bin(15), fixed bin(15), fixed bin(15), fixed bin(15) ); .sp 2 .in 30 .un 30 1. token_count total number of tokens used in the program. (output) .sp 1 .un 30 2. token_words total number of words of storage in the tree segment used by all the token nodes in the program. (output) .sp 1 .un 30 3. empty_buckets total number of empty buckets in the hash table. (output) .sp 1 .un 30 4. maximum the maximum number of tokens in a single bucket. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 none .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 create_source .br an internal procedure to create a source node for each of the include file used in the source program. .sp 2 .un 20 lex_create_token .br an internal function used to create a token node for the token represented by the token_string. This function does essentially the same things as the external procedure create_token. The reason for this internal function is to save the large number of calling sequence lex would have to made to call the more expensive external procedure. .sp 2 .un 20 lex_err .br an internal procedure used to call the error message program error_. .in 0 .sp 3 External Variables: .sp 2 data$data .br pl1_stat_$cur_statement .br pl1_stat_$hash_table .br pl1_stat_$last_source .br pl1_stat_$line_count .br pl1_stat_$listing_on .br pl1_stat_$node_uses .br pl1_stat_$seg_name .br pl1_stat_$source_index .br pl1_stat_$source_list_ptr .br pl1_stat_$source_ptr .br pl1_stat_$source_seg .br pl1_stat_$st_length .br pl1_stat_$st_start .br pl1_stat_$statement_id .br tree_$ .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 bitcount bit_count of an include file. .sp 1 .un 20 dataptr pointer to the data$ segment that contains the driving table for lex. .sp 1 .un 20 end_of_file bit indicating end of segment is reached. .sp 1 .un 20 file_ptr pointer to an include file. .sp 1 .un 20 file_stack array of structure that contains the information of the source segment and all the include files used in the source. .sp 1 .un 20 file_token pointer to the token node created for the name of an include file. .sp 1 .un 20 filename_length length of the include file name. .sp 1 .un 20 first_time bit indicating whether lex$initialize_lex has been previously called in the same process. .sp 1 .un 20 index the running character index to the source segment. .sp 1 .un 20 line_size length of the current source line being processed by lex. .sp 1 .un 20 listing_on bit indicating whether a listing is needed for this compilation. It has the same value as pl1_stat_$listing_on. .sp 1 .un 20 old_file_token pointer to the old token node created for the name of an include file. .sp 1 .un 20 saved_index saved running character index. .sp 1 .un 20 saved_length saved length of current line. .sp 1 .un 20 saved_source_line saved total length of current source line. .sp 1 .un 20 saved_tindex saved length of the token string. .sp 1 .un 20 seg_ptr pointer to an include file. .sp 1 .un 20 semi_colon_ptr pointer to the token node ";". .sp 1 .un 20 source_depth number of include files used. .sp 1 .un 20 source_files total number of include files used. .sp 1 .un 20 source_line total length of current source line. .sp 1 .un 20 source_string_length .br length of the source segment. .in 0 .sp 3 Programs Called: .sp 2 bindec .br bindec$vs .br create_token .br error_ .br error_$no_text .br find_include_file_$initiate_count .br hcs_$terminate_noname .br pl1_get .br pl1_print$for_lex .br pl1_print$non_varying .br pl1_print$non_varying_nl .br pl1_print$varying_nl .br token_to_binary .br translator_info_$get_source_info .br tree_$ .sp 3 Include Files used: .sp 2 rename .br create_token .br language_utility .br source_id_descriptor .br nodes .br token .br token_types .br token_list .br source_list .br declare_type .br symbol .br system .sp 3 Errors Diagnosed: .sp 2 Error 76 .br Error 99 .br Error 100 .br Error 101 .br Error 103 .br Error 104 .br Error 105 .br Error 106 .br Error 107 .br Error 108 .br Error 109 .br Error 110 .br Error 111 .br Error 112 .br Error 125 .br Error 151 .br Error 152 .br Error 153 .br Error 154 .br Error 155 .br Error 156 .br Error 157 .br Error 158 .br Error 159 .br Error 441 .* .bp .in 0 NAME: data .sp 3 Function: .sp 2 This is a data segment that contains the driving table for the lexical analyzer. It consists of a two dimensional matrix of the form matrix(1:31,0:29). The lexical analyzer is an approximation of a finite state machine with 31 states. The input to the lexical analyzer is a character string. The character set used to construct the string can be loosely classified into 29 types. By a simple transformation, the matrix is declared as matrix(0:929). Each element of the matrix is a 36 bit bitstring containing four 9 bit substrings. The first nine bits give the token type of a resulting group of characters, the second nine bits are currently not used, the third nine bits give the action to take in lex, and the last nine bits give the next state. .bp T_H_E__P_A_R_S_E_ .sp 2 The parse gets the statement represented by the vector of token pointers from the lex and proceeds to analyze the statement, and transform the statement into an appropriate internal representation. The completed internal representation is a program tree that contains all the relationships between all the components of the original source program. .* .bp .in 0 NAME: parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It initializes various static variables and modules used for the parse. .sp 1 .un 4 2. It creates the root block node as the basis for the whole tree segment for the program. .sp 1 .un 4 3. It calls lex for the first statement of the program, and subsequently invokes procedure_parse to parse the remaining statements of the program. .sp 3 .in 0 Entry: .sp 2 parse .sp 3 Usage: .sp 2 declare parse entry ( ptr, ptr, fixed bin (15) ); .sp 2 call parse ( root, source_ptr, source_length ); .sp 2 .in 30 .un 30 1. root pointer to the root node block created by parse. (output) .sp 1 .un 30 2. source_ptr pointer to the base of the segment containing the source program. (input) .sp 1 .un 30 3. source_length length in characters of the source program. (input) .sp 3 .in 0 Programs that invoke this entry: .sp 2 pl1 .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$compiler_created_index .br pl1_stat_$error_memory .br pl1_stat_$one .br pl1_stat_$util_abort .sp 3 .in 0 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_block .br create_token .br error_$initialize_error .br lex$initialize_lex .br lex$write_last_line .br parse_error .br procedure_parse .br reserve$clear .br statement_type .sp 3 Include Files used: .sp 2 block .br block_types .br language_utility .br parse .br source_id_descriptor .br statement_types .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 180 .br Error 417 .* .bp .in 0 NAME: procedure_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It processes all statements occurring in begin blocks and procedures. .sp 1 By processing a statement is meant the following steps: .in +4 .un 4 a. calling lex to get the statement. .un 4 b. calling statement_type to determine the type of the statement. .un 4 c. calling an appropriate procedure to parse the statement into its proper internal representation. .sp 1 .in -4 .un 4 2. It creates a block node for the begin block or the procedure. .sp 1 .un 4 3. It calls itself recursively to handle nested blocks. .sp 1 .un 4 4. It attempts to match end statements to the proper procedure statement or begin statement. .in 0 .sp 3 Entry: .sp 2 procedure_parse .sp 3 Usage: .sp 2 declare procedure_parse entry ( fixed bin(15), ptr, bit(12) aligned, ptr, ptr, bit(9) aligned, bit(1) aligned ); .sp 2 call procedure_parse ( token_list_index, entry_ptr, conditions, father_block_ptr, end_ptr, block_type, return_flag ); .sp 2 .in 30 .un 30 1. token_list_index index of the token_list for the statement. (input/output) .sp 1 .un 30 2. entry_ptr pointer to the list of labels. (input) .sp 1 .un 30 3. conditions conditions for the block. (input) .sp 1 .un 30 4. father_block_ptr pointer to the block node containing this block. (input) .sp 1 .un 30 5. end_ptr pointer to the token that ends the block. (output) .sp 1 .un 30 6. block_type type of this block. (input) .sp 1 .un 30 7. return_flag bit indicating if there is a return statement in this block. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 parse .br procedure_parse .br do_parse .br on_parse .br if_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pla_stat_$cur_statement .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_block .br create_operator .br create_statement .br declare_label .br declare_parse .br default_parse .br do_parse .br if_parse .br io_statement_parse .br lex .br on_parse .br parse_error .br procedure_parse .br process_entry .br statement_parse .br statement_type .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br token_list .br block .br declare_type .br op_codes .br statement .br token .br block_types .br statement_types .br token_types .br list .sp 3 Errors Diagnosed: .sp 2 Error 410 .br Error 411 .br Error 412 .br Error 416 .* .bp .in 0 NAME: do_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the do statement. .sp 1 .un 4 2. It processes all statements following the do statement until a matching end statement is found. .sp 1 .un 4 3. It may call itself recursively to process other do statements. .in 0 .sp 3 Entry: .sp 2 do_parse .sp 3 Usage: .sp 2 declare do_parse entry ( fixed bin(15), ptr, bit(12) aligned, ptr, ptr, bit(1) aligned, bit(1) aligned, bit(1) aligned ); .sp 2 call do_parse ( token_list_index, entry_ptr, conditions, father_block_ptr, end_ptr, entry_flag, return_flag, iterative_do_flag ); .sp 2 .in 30 .un 30 1. token_list_index index of the token_list for the statement. (input/output) .sp 1 .un 30 2. entry_ptr pointer to the list of labels. (input) .sp 1 .un 30 3. conditions conditions for the block. (input) .sp 1 .un 30 4. father_block_ptr pointer to the block node containing this block. (input) .sp 1 .un 30 5. end_ptr pointer to the token node that ends the block. (output) .sp 1 .un 30 6. entry_flag bit indicating whether there is any entry statement within this block. (output) .sp 1 .un 30 7. return_flag bit indicating whether there is any return statement within this block. (output) .sp 1 .un 30 8. iterative_do_flag bit indicating whether an iterative do group has been found. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .br if_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 print .br an internal procedure used to call the error message program parse_error. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_label .br create_list .br create_operator .br create_statement .br declare_label .br declare_parse .br default_parse .br do_parse .br expression_parse .br free_node .br if_parse .br io_statement_parse .br lex .br on_parse .br parse_error .br procedure_parse .br process_entry .br reference_parse .br statement_parse .br statement_type .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br token_list .br block .br op_codes .br operator .br statement .br token .br block_types .br statement_types .br token_types .br list .br label .br reference .br declare_type .sp 3 Errors Diagnosed: .sp 2 Error 404 .br Error 405 .br Error 406 .br Error 407 .br Error 408 .br Error 409 .br Error 411 .br Error 413 .br Error 416 .br Error 418 .br Error 419 .br Error 424 .br Error 425 .br Error 426 .br Error 429 .br Error 433 .* .bp .in 0 NAME: on_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the on statement. .sp 1 .un 4 2. It processes all statements in the on unit. .sp 1 .un 4 3. It creates a block node for the on unit. .in 0 .sp 3 Entry: .sp 2 on_parse .sp 3 Usage: .sp 2 declare on_parse entry ( fixed bin(15), ptr, bit(12) aligned, ptr, ptr ); .sp 2 call on_parse ( token_list_index, entry_ptr, conditions, father_block_ptr, end_ptr ); .sp 2 .in 30 .un 30 1. token_list_index index of the token_list for the statement. (input/output) .sp 1 .un 30 2. entry_ptr pointer to the list of labels. (input) .sp 1 .un 30 3. conditions conditions for the block. (input) .sp 1 .un 30 4. father_block_ptr pointer to the block node containing this block. (input) .sp 1 .un 30 5. end_ptr pointer to the token that ends the block. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .br if_parse .sp 3 Entry: .sp 2 on_parse$revert .sp 2 This entry parses the revert statement and the signal statement. .sp 3 Usage: .sp 2 declare on_parse$revert entry ( fixed bin(15), ptr, ptr ); .sp 2 call on_parse$revert( token_list_index, statement_ptr, father_block_ptr ); .sp 2 .in 30 .un 30 1. token_list_index index of the token_list for the statement. (input/output) .sp 1 .un 30 2. statement_ptr pointer to the statement node for the revert statement or the signal statement. (input) .sp 1 .un 30 3. father_block_ptr pointer to the block node that contains this block. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 statement_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 get_condition .br this internal function ascertains if the condition name is valid, and records the condition context for the name. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$condition_index .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 bindec$vs .br context .br create_block .br create_list .br create_operator .br create_statement .br create_symbol .br create_token .br declare_label .br free_node .br io_statement_parse .br parse_error .br procedure_parse .br reference_parse .br statement_parse .br statement_type .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br block .br block_types .br context_codes .br declare_type .br list .br nodes .br op_codes .br operator .br reference .br statement .br statement_types .br symbol .br token .br token_list .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 1 .br Error 42 .br Error 420 .br Error 421 .br Error 422 .br Error 423 .* .bp .in 0 NAME: statement_type .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the condition prefix for the statement. .sp 1 .un 4 2. It parses the label prefix for the statement. .sp 1 .un 4 3. It determines the type of statement returned by lex. .in 0 .sp 3 Entry: .sp 2 statement_type .sp 3 Usage: .sp 2 declare statement_type entry ( fixed bin(15), ptr, bit(12) aligned) returns (fixed bin(15)); .sp 2 type = statement_type ( token_list_index, label_ptr, conditions ); .sp 2 .in 30 .un 30 1. token_list_index index of the token_list for the statement. (input/output) .sp 1 .un 30 2. label_ptr pointer to the list of labels for the statement. (output) .sp 1 .un 30 3. conditions conditions for the statement. (output) .sp 1 .un 30 4. type type of statement found by this procedure. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br parse .br do_parse .br on_parse .br if_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 has_equal .br an internal function to advance the token_list_index to search for an equal token. .sp 1 .un 20 print .br an internal procedure to call the error message program parse_error. .sp 1 .un 20 skip_parens .br an internal procedure to advance the token_list_index until it matches a corresponding right parenthesis. .in 0 .sp 3 External Variables: .sp 2 tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_list .br create_reference .br create_token .br parse_error .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br token_list .br list .br reference .br nodes .br token_types .br statement_types .sp 3 Errors Diagnosed: .sp 2 Error 2 .br Error 43 .br Error 44 .br Error 45 .br Error 95 .br Error 96 .* .bp .in 0 NAME: statement_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. The following statements are parsed by this program: .in +6 allocate statement .br assignment statement .br call statement .br free statement .br goto statement .br null statement .br return statement .in 0 .sp 3 Entry: .sp 2 statement_parse .sp 3 Usage: .sp 2 declare statement_parse entry ( fixed bin(15), ptr, bit(12) aligned, ptr, fixed bin(15) ); .sp 2 call statement_parse ( token_list_index, label_ptr, conditions, cur_block, type ); .sp 2 .in 30 .un 30 1. token_list_index index of the token_list for the statement. (input/output) .sp 1 .un 30 2. label_ptr pointer to the list of labels for the statement. (input) .sp 1 .un 30 3. conditions conditions for the statement. (input) .sp 1 .un 30 4. cur_block pointer to the block node containing this statement. (input) .sp 1 .un 30 5. type type of statement to be parsed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .br on_parse .br if_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 print .br an internal procedure used to call the error message program parse_error. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 context .br create_list .br create_operator .br create_reference .br create_statement .br create_symbol .br declare_label .br expression_parse .br on_parse$revert .br parse_error .br reference_parse .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br block .br declare_type .br context_codes .br label .br list .br nodes .br op_codes .br operator .br reference .br statement .br statement_types .br symbol .br token .br token_list .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 1 .br Error 5 .br Error 49 .br Error 150 .br Error 444 .br Error 446 .br Error 447 .br Error 450 .br Error 451 .br Error 452 .br Error 453 .br Error 454 .br Error 455 .br Error 456 .br Error 460 .* .bp .in 0 NAME: if_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the if statement. .sp 1 .un 4 2. If the then clause is an independent statement, this program will parse the then clause. .sp 1 .un 4 3. If the then clause is a group or a begin block, this program will process all the statements in the then clause. .sp 1 .un 4 4. It also processes all the statements in the else clause if there is an else clause. .in 0 .sp 3 Entry: .sp 2 if_parse .sp 3 Usage: .sp 2 declare if_parse entry ( fixed bin(15), ptr, bit(12) aligned, ptr, ptr, bit(1) aligned ); .sp 2 call if_parse ( token_list_index, entry_ptr, conditions, father_block, end_ptr, return_flag ); .sp 2 .in 30 .un 30 1. token_list_index index to the token_list for the statement. (input/outut) .sp 1 .un 30 2. entry_ptr pointer to the list of labels for this statement. (input) .sp 1 .un 30 3. conditions conditions for this statement. (input) .sp 1 .un 30 4. father_block pointer to the block node containing this statement. (input) .sp 1 .un 30 5. end_ptr pointer to the token that ends the block. (output) .sp 1 .un 30 6. return_flag bit indicating whether there is a return statement in this statement. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .br if_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 print .br an internal procedure used to call the error message program parse_error. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_label .br create_list .br create_operator .br create_statement .br declare_label .br do_parse .br expression_parse .br if_parse .br io_statement_parse .br lex .br on_parse .br parse_error .br procedure_parse .br reference_parse .br statement_parse .br statement_type .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br token_list .br token .br token_types .br op_codes .br block .br block_types .br statement .br statement_types .br nodes .br reference .br operator .br list .br label .br symbol .br declare_type .sp 3 Errors Diagnosed: .sp 2 Error 1 .br Error 412 .br Error 430 .br Error 431 .br Error 432 .br Error 446 .* .bp .in 0 NAME: io_statement_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the following input/output statements: .in +6 get statement .br put statement .br read statement .br write statement .br rewrite statement .br locate statement .br delete statement .br open statement .br close statement .sp 1 .in -6 .un 4 2. It calls format_list_parse to parse the format statement. .in 0 .sp 3 Entry: .sp 2 io_statement_parse .sp 3 Usage: .sp 2 declare io_statement_parse entry ( fixed bin(15), ptr, bit(12) aligned, ptr, ptr, bit(1) aligned, bit(9) aligned ); .sp 2 call io_statement_parse ( token_list_ptr, entry_ptr, conditions, father_block, end_ptr, return_flag, statement_type ); .sp 2 .in 30 .un 30 1. token_list_index index to the token_list for the statement. (input/output) .sp 1 .un 30 2. entry_ptr pointer to the list of labels fo this statement. (input) .sp 1 .un 30 3. conditions conditions for this statement. (input) .sp 1 .un 30 4. father_block pointer to the block node containing this statement. (input) .sp 1 .un 30 5. end_ptr pointer to the token that ends the block. (output) .sp 1 .un 30 6. return_flag bit indicating whether there is a return statement in this block. (input) .sp 1 .un 30 7. statement_type type of statement to be parsed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .br on_parse .br if_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .br .sp 3 Programs Called: .sp 2 context .br create_operator .br create_statement .br create_symbol .br create_token .br data_list_parse .br declare_label .br expression_parse .br format_list_parse .br parse_error .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br list .br block_types .br label .br block .br context_codes .br nodes .br declare_type .br operator .br op_codes .br statement .br statement_types .br symbol .br token_list .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 169 .br Error 237 .br Error 238 .br Error 239 .br Error 240 .br Error 241 .br Error 243 .br Error 245 .br Error 247 .br Error 254 .br Error 257 .br Error 288 .br Error 289 .br Error 290 .br Error 293 .br Error 428 .* .bp .in 0 NAME: format_list_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the format list in a format statement. .sp 1 .un 4 2. It parses the format list in a get (edit) statement or a put (edit) statement. .in 0 .sp 3 Entry: .sp 2 format_list_parse .sp 3 Usage: .sp 2 declare format_list_parse entry ( fixed bin(15), ptr, ptr, ptr ) returns ( bit(1) aligned ); .sp 2 success_bit = format_list_parse ( token_list_index, cur_block, statement_ptr, format_tree ); .sp 2 .in 30 .un 30 1. token_list_index index to the token list for the statement. (input) .sp 1 .un 30 2. cur_block pointer to the block node containing the format list. (input) .sp 1 .un 30 3. statement_ptr pointer to the statement node containing the format list. (input) .sp 1 .un 30 4. format_tree pointer to the format list returned by this program. (output) .sp 1 .un 30 5. success_bit bit indicating if the list of tokens does indeed parse into a format list. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 io_statement_parse .br format_list_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_operator .br create_symbol .br declare_picture .br expression_parse .br format_list_parse .br free_node .br parse_error .br reference_parse .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br block .br declare_type .br label .br list .br nodes .br operator .br op_codes .br picture_image .br reference .br statement .br statement_types .br token_list .br token_types .br symbol .sp 3 Errors Diagnosed: .sp 2 Error 278 .br Error 427 .br Error 439 .* .bp .in 0 NAME: data_list_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the data list in an input/output statement. .in 0 .sp 3 Entry: .sp 2 data_list_parse .sp 3 Usage: .sp 2 declare data_list_parse entry ( fixed bin(15), ptr, ptr) returns ( bit(1) aligned ); .sp 2 success_bit = data_list_parse ( token_list_index, cur_block, data_tree ); .sp 2 .in 30 .un 30 1. token_list_index index to the token list for the statement. (input) .sp 1 .un 30 2. cur_block pointer to the block node containing the statement. (input) .sp 1 .un 30 3. data_tree pointer to the data list returned by this program. (output) .sp 1 .un 30 4. success_bit bit indicating if the list of tokens does indeed parse into a data list. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 io_statement_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_operator .br expression_parse .br parse_error .br reference_parse .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br operator .br op_codes .br token_list .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 255 .br Error 256 .br Error 258 .br Error 404 .br Error 405 .br Error 406 .br Error 407 .br Error 408 .br Error 409 .br Error 418 .br Error 419 .br Error 424 .br Error 426 .* .bp .in 0 NAME: expression_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. This procedure parses expressions using a simple operator procedence technique. The syntax parsed is: .sp 1 .in +6 ::= [ ] ... .sp 1 .in -6 where the nth operator and its operands are stacked if the n+1st operator has higher precedence. The primitive is parsed by the intenal procedure "primitive". .in 0 .sp 3 Entry: .sp 2 expression_parse .sp 3 Usage: .sp 2 declare expression_parse entry ( fixed bin(15), ptr ) returns (ptr); .sp 2 expression_tree = expression_parse ( token_list_index, cur_block ); .sp 2 .in 30 .un 30 1. token_list_index index to the token list for the statement. (input/output) .sp 1 .un 30 2. cur_block pointer to the block node containing this expression. (input) .sp 1 .un 30 3. expression_tree pointer to the expression returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br data_list_parse .br default_parse .br do_parse .br expression_parse .br format_list_parse .br if_parse .br io_statement_parse .br reference_parse .br statement_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 primitive .br an internal procedure used to parse expressions, exponentiation operators, and parenthesized expressions. .in 0 .sp 3 External Variables: .sp 2 tree_$ .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 t pointer used to get better accessing to the list of tokens. .in 0 .sp 3 Programs Called: .sp 2 create_operator .br create_token .br evaluate .br expression_parse .br reference_parse .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br token_list .br token .br nodes .br operator .br op_codes .br token_types .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: reference_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the list of tokens into a reference node whenever possible. .sp 1 .un 4 2. The reference may be locator qualified, structure qualified, subscripted, or any combination thereof. .sp 1 .un 4 3. The reference may also be a function reference. .in 0 .sp 3 Entry: .sp 2 reference_parse .sp 3 Usage: .sp 2 declare reference_parse entry ( fixed bin(15), ptr ) returns (ptr); .sp 2 reference_tree = reference_parse ( token_list_index, cur_block ); .sp 2 .in 30 .un 30 1. token_list_index index to the token list for the statement. (input/output) .sp 1 .un 30 2. cur_block pointer to the block node containing this operand. (input) .sp 1 .un 30 3. reference_tree pointer to the operand representing the result of reference_parse. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br data_list_parse .br do_parse .br expression_parse .br format_list_parse .br if_parse .br io_statement_parse .br on_parse .br statement_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 atom .br an internal procedure to test and parse the list of tokens into an expression. Expressions of the form .in +10 ( reference ) .in -10 is parsed into .in +10 temporary_node = reference .in 0 .sp 3 External Variables: .sp 2 tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 context .br create_list .br create_operator .br create_reference .br create_symbol .br expression_parse .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br context_codes .br declare_type .br list .br nodes .br op_codes .br operator .br reference .br symbol .br token .br token_list .br token_types .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: declare_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the declare statement. .in 0 .sp 3 Entry: .sp 2 declare_parse .sp 3 Usage: .sp 2 declare declare_parse entry ( fixed bin(15), ptr, ptr ); .sp 2 call declare_parse ( token_list_index, cur_block, labelptr ); .sp 2 .in 30 .un 30 1. token_list_index index to the token_list for the statement. (input/output) .sp 1 .un 30 2. cur_block pointer to the block node containing this statement. (input) .sp 1 .un 30 3. labelptr pointer to the list of labels to this statement. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .sp 3 Entry: .sp 2 declare_parse$abort .sp 2 This entry calls the error message program parse_error. It also attempts to resume parse at the first comma after the error token not contained in parentheses. .sp 3 Usage: .sp 2 declare declare_parse$abort entry( fixed bin(15), ptr ); .sp 2 call declare_parse$abort ( error_number, error_pointer ); .sp 2 .in 30 .un 30 1. error_number the error number. (input) .sp 1 .un 30 2. error_pointer pointer to the operand that causes the error. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br declare_parse .br descriptor_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 declare_parse_factored .br is called to parse all the tokens in the declare statement between "declare" and the semicolon. It calls attribute_parse to process the attributes, and it calls itself recursively to process factored attribute lists when it encounters a left parenthesis. .sp 1 .un 20 link_symbol .br an internal procedure used to link up members of a structure. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br pl1_stat_$statement_id .br pl1_stat_$unwind .br tree_$ .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 cblock pointer to the block node containing this declare statement. .sp 1 .un 20 factored_level number indicating the depth of structure level the current symbol is in. .sp 1 .un 20 k used to show the position of the token_list_index. .sp 1 .un 20 l used to show the position of the token_list_index. .sp 1 .un 20 previous_symbol pointer to the symbol node of the structure containing the current symbol. .in 0 .sp 3 Programs Called: .sp 2 attribute_parse .br create_statement .br create_symbol .br create_token .br declare_label .br declare_parse$abort .br free_node .br merge_attributes .br parse_error .br token_to_binary .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br block .br token_types .br statement_types .br symbol .br token_list .br token .br declare_type .br reference .br link_symbol .sp 3 Errors Diagnosed: .sp 2 Error 3 .br Error 27 .* .bp .in 0 NAME: attribute_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the attribute set occurring in declare statements, in the returns(), entry() attributes, and in the when() clause of then generic () attribute. .in 0 .sp 3 Entry: .sp 2 attribute_parse .sp 3 Usage: .sp 2 declare attribute_parse entry ( ptr, ptr, fixed bin(15), bit(1) aligned ); .sp2 call attribute_parse ( cur_block, symbol_ptr, token_list_index, generic_bit ); .sp 2 .in 30 .un 30 1. cur_block pointer to the block node containing this declaration. (input) .sp 1 .un 30 2. symbol_ptr pointer to the symbol node for which the attributes are declared for. (input) .sp 1 .un 30 3. token_list_index index to the token list for the statement. (input/output) .sp 1 .un 30 4. generic_bit bit indicating that the procedure is called in the generic attribute context, which allows the declaration of precision attribute to range from low precision to high precision and the scale attribute to range from low scale to high scale. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_parse .br default_parse .br descriptor_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 get_scale .br an internal procedure to get the scale of a fixed or precision attribute. .sp 1 .un 20 initial_list .br an internal procedure to parse the initial attribute. .sp 1 .un 20 print .sp 1 an internal procedure used to call the error message program declare_parse$abort. .sp 1 .un 20 refer_exp .br an internal procedure to get the size or the bound of an item. In particular, if the size or bound has refer_extents declaration, it will be parsed. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$one .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 context .br create_array .br create_bound .br create_list .br create_operator .br create_token .br declare_parse$abort .br descriptor_parse .br expression_parse .br reference_parse .br token_to_binary .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br attribute_table .br block .br token_list .br reference .br context_codes .br token_types .br symbol .br array .br operator .br op_codes .br list .br nodes .sp 3 Errors Diagnosed: .sp 2 Error 6 .br Error 7 .br Error 8 .br Error 9 .br Error 10 .br Error 11 .br Error 12 .br Error 13 .br Error 14 .br Error 15 .br Error 17 .br Error 18 .br Error 19 .br Error 20 .br Error 22 .br Error 23 .br Error 24 .br Error 26 .br Error 57 .br Error 138 .br Error 192 .br Error 193 .* .bp .in 0 NAME: default_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the default statement. .in 0 .sp 3 Entry: .sp 2 default_parse .sp 3 Usage: .sp 2 declare default_parse entry ( fixed bin(15), ptr, ptr ); .sp 2 call default_parse ( token_list_index, cur_block, label_ptr ); .sp 2 .in 30 .un 30 1. token_list_index index to the token list for the statement. (input/output) .sp 1 .un 30 2. cur_block pointer to the block node containing this statement. (input) .sp 1 .un 30 3. label_ptr pointer to the list of labels for this statement. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br pl1_stat_$statement_id .br pl1_stat_$unwind .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 attribute_parse .br create_default .br create_statement .br create_symbol .br declare_label .br expression_parse .br free_node .br parse_error .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br default .br symbol .br block .br token_list .br token_types .br statement_types .br declare_type .sp 3 Errors Diagnosed: .sp 2 Error 48 .* .bp .in 0 NAME: descriptor_parse .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses descriptor lists. Descriptor lists occur in the following three contexts: .in +6 entry ( descriptior list ) in the entry attribute, .br returns ( descriptior list ) in the returns attribute, .br when ( descriptior list ) in the when clause of the generic attribute. .in 0 .sp 3 Entry: .sp 2 descriptor_parse .sp 3 Usage: .sp 2 declare descriptor_parse entry ( ptr, ptr, fixed bin(15) ) returns (ptr); .sp 2 return_ptr = descriptor_parse ( cur_block, token_ptr, token_list_index ); .sp 2 .in 30 .un 30 1. cur_block pointer to the block node containing this declaration. (input) .sp 1 .un 30 2. token_ptr pointer to the token node for which the attribute is declared for. (input) .sp 1 .un 30 3. token_list_index index to the token_list for the statement. (input/output) .sp 1 .un 30 4. return_ptr pointer to the chain of list nodes returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br process_entry .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 link_symbol .br an internal procedure used to link up members of a structure. .in 0 .sp 3 External Variables: .sp 2 tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 attribute_parse .br bindec$vs .br create_list .br create_symbol .br create_token .br declare_parse$abort .br parse_error .br token_to_binary .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br symbol .br token_list .br token_types .br declare_type .br list .br link_symbol .sp 3 Errors Diagnosed: .sp 2 Error 16 .* .bp .in 0 NAME: process_entry .sp 3 Function: .sp 2 .in 4 .un 4 1. It parses the procedure statement and the entry statement. .in 0 .sp 3 Entry: .sp 2 process_entry .sp 3 Usage: .sp 2 declare process_entry entry ( fixed bin(15), bit(9) aligned, ptr, ptr, bit(12) aligned ); .sp 2 call process_entry ( token_list_index, statement_type, cur_block, entry_ptr, conditions ); .sp 2 .in 30 .un 30 1. token_list_index index to the token_list for the statement. (input/output) .sp 1 .un 30 2. statement_type type of statement. (input) .sp 1 .un 30 3. cur_block pointer to the block node containing this statement. (input) .sp 1 .un 30 4. entry_ptr pointer to the list of labels for this statement. (input) .sp 1 .un 30 5. conditions conditions for this statement. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 procedure_parse .br do_parse .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 print .br an internal procedure used to call the error message program parse_error. .in 0 .sp 3 External Variables: .sp 2 cg_static_$support .br pl1_stat_$cur_statement .br pl1_stat_$root .br pl1_stat_$statement_id .br pl1_stat_$unwind .br pl1_stat_$validate_proc .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 context .br create_cross_reference .br create_list .br create_operator .br create_statement .br create_symbol .br create_token .br descriptor_parse .br parse_error .br reserve$rename_parse .sp 3 Include Files used: .sp 2 parse .br language_utility .br source_id_descriptor .br token_list .br context_codes .br nodes .br token .br statement_types .br statement .br cross_reference .br symbol .br declare_type .br operator .br token_types .br op_codes .br list .br block .br block_types .sp 3 Errors Diagnosed: .sp 2 Error 34 .br Error 35 .br Error 36 .br Error 37 .br Error 38 .br Error 39 .br Error 40 .br Error 41 .br Error 46 .* .bp .in 0 NAME: context .sp 3 Function: .sp 2 .in 4 .un 4 1. It records the context of certain identifiers found during the parse. .in 0 .sp 3 Entry: .sp 2 context .sp 3 Usage: .sp 2 declare context entry ( ptr, ptr, fixed bin(15) ); .sp 2 call context ( identifier, block_ptr, context_type ); .sp 2 .in 30 .un 30 1. identifier pointer to the token node representing the identifier. (input) .sp 1 .un 30 2. block_ptr pointer to the block node containing this token. (input) .sp 1 .un 30 3. context_type type of cntext to be recorded for the identifier. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br .br io_statement_parse .br on_parse .br process_entry .br reference_parse .br statement_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_context .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br context .br context_codes .br nodes .br block .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: evaluate .sp 3 Function: .sp 2 .in 4 .un 4 1. It examines an expression involving two token constants and decides if they can be simplified into one token constant. .in 0 .sp 3 Entry: .sp 2 evaluate .sp 3 Usage: .sp 2 declare evaluate entry ( bit(9) aligned, ptr, ptr ) retruns (ptr); .sp 2 return_ptr = evaluate ( op_code, first_ptr, second_ptr ); .sp 2 .in 30 .un 30 1. op_code indicates the kind of operation is involved. (input) .sp 1 .un 30 2. first_ptr pointer to the first token constant. (input) .sp 1 .un 30 3. second_ptr pointer to the second token constant. (input) .sp 1 .un 30 4. return_ptr pointer to the token node representing the resulting operand. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expression_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 bindec .br create_operator .br create_token .br token_to_binary .sp 3 Include Files used: .sp 2 op_codes .br operator .br token .br token_types .br language_utility .br source_id_descriptor .sp 3 Errors Diagnosed: .sp 2 none  Chapter4.runoff 08/13/74 1215.3r w 08/13/74 1214.7 194346 .m1 6 .m2 0 .m3 4 .m4 6 .ms 1 .ad .ar .fo 1 "DRAFT: SUBJECT TO CHANGE"%sec%-%"order number" .sr sec 4 .sp 7 .ce 1 SECTION IV .sp 2 .ce 1 DECLARATION PROCESSING .sp 4 T_H_E__C_O_N_T_E_X_T__P_R_O_C_E_S_S_O_R_ .sp 2 The context processor scans all the context nodes containing contextually derived attributes recorded during the parse. The context processor either augments the partial symbol table node created from declaration statements or creates new declarations. This activity constitutes the contextual and implicit declarations. .* .bp .in 0 NAME: context_processor .sp 3 Function: .sp 2 .in 4 .un 4 1. It does the context processing of all the context entries on a block node. .sp 1 .un 4 2. For each context entry in the block, it will try to match a previous declared symbol. .sp 1 .un 4 3. If a previous declaration is found, the context declaration will be overwritten except for the parameter context. If no previous declaration is found, a symbol node will be created, and the context declaration copied on to the symbol node. .sp .un 4 4. If a condition context entry is found to match with a declaration not in the same block, a new declaration will be made. .sp 1 .un 4 5. This program also expands the like attribute appearing anywhere in the block. .in 0 .sp 3 Entry: .sp 2 context_processor .sp 3 Usage: .sp 2 declare context_processor entry ( ptr ); .sp 2 call context_processor ( block_ptr ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node whose block.context chain is to be scanned. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 context_processor .br semantic_translator .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 found .br an internal procedure to match a context entry with a previously declared symbol node entry. .sp 1 .un 20 print .br an internal procedure to call the error message program error_$no_text. .sp 1 .un 20 process_like .br an internal procedure to process and expand the like attribute in a symbol node. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$root .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 context_processor .br copy_expression$copy_sons .br create_symbol .br error_$no_text .br lookup .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br block .br nodes .br reference .br context .br declare_type .br symbol .br token .sp 3 Errors Diagnosed: .sp 2 Error 69 .br Error 74 .br Error 74 .br Error 75 .br Error 119 .br Error 120 .br Error 133 .br Error 189 .br Error 214 .bp T_H_E__D_E_C_L_A_R_A_T_I_O_N__P_R_O_C_E_S_S_O_R_ .sp 2 After contextual and implicit declarations have been processed, the declaration processor scans all the symbol table nodes to develop additional information about each variable. These include the preparation of accessing code: transforming parameters and automatic adjustible arrays into based references, calculation of boundary requirements, offset expressions, and array multipliers and virtual origins; the computation of storage requirements for each variable; and the generation of initialization code for some variables. .* .bp .in 0 NAME: declare .sp 3 Function: .sp 2 .in 4 .un 4 1. This program establishes complete declarations for all the names used in the program. .sp 1 .un 4 2. It calls declare_structure to establish the complete declaration for all the members of the structure. .sp 1 .un 4 3. It calls validate to get the default attributes, and to check for correctness of all the declared attributes. .sp 1 .un 4 4. It creates descriptors for parameters and controlled variables. .sp 1 .un 4 5. It calls get_size to determine the storage size and boundary requirement for the declaration. .sp 1 .un 4 6. It generates a character string constant for condition constants. .sp 1 .un 4 7. It establishes the complete declaration for the returns descriptor and the parameter descriptor for an entry declaration. .sp 1 .un 4 8. For all the return values of all the entry constants in the block, it determines whether the attributes associated with the return values are the same. An integer will be created for use in the semantic translator if the attributes associated with the return values are not the same. .sp 1 .un 4 9. Pointers are created for parameters appearing in more than one position in any entry statement. .sp 1 .un 4 10. Allot_auto operators will be created in the prologue sequence for the block, for automatic variables with adjustible sizes. .sp 1 .un 4 11. It calls expand_initial to do the initialization of variables if necessary. .in 0 .sp 3 Entry: .sp 2 declare .sp 3 Usage: .sp 2 declare declare entry ( ptr ); .sp 2 call declare ( symbol_ptr ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node to be processed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br declare .br declare_structure .br defined_reference .br expand_assign .br expand_primitive .br expression_semantics .br io_semantics .br operator_semantics .br semantic_translator .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$eis_mode .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 compare_declaration .br copy_expression .br create_list .br create_operator .br create_statement$prologue .br declare .br declare_constant$char .br declare_constant$integer .br declare_descriptor .br declare_descriptor$parm .br declare_integer .br declare_pointer .br declare_structure .br expand_initial .br get_size .br lookup .br semantic_translator$abort .br semantic_translator$error .br validate .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br symbol .br block .br reference .br list .br operator .br statement .br op_codes .br statement_types .br nodes .br token .br token_types .br declare_type .br boundary .br system .sp 3 Errors Diagnosed: .sp 2 Error 98 .br Error 149 .br Error 194 .br Error 196 .br Error 213 .* .bp .in 0 NAME: compare_declaration .sp 3 Function: .sp 2 .in 4 .un 4 1. It compares the data type and the size of two declarations. .sp 1 .un 4 2. If the two declarations are arrays, or structures, it calls itself recursively to compare the array dimensions, bounds, or attributes of members of the structure. .in 0 .sp 3 Entry: .sp 2 compare_declaration .sp 3 Usage: .sp 2 declare compare_declaration entry ( ptr, ptr ) returns ( bit(1) aligned ); .sp 2 success_bit = compare_declaration ( first_ptr, second_ptr ); .sp 2 .in 30 .un 30 1. first_ptr pointer to either a reference node or a symbol node. (input) .sp 1 .un 30 2. second_ptr pointer to a symbol node. (input) .sp 1 .un 30 3. success_bit bit indicating if the comparison is successful. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 compare_declaration .br declare .br expand_assign .br operator_semantics .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 compare_declaration .br compare_expression .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br nodes .br picture_image .br reference .br symbol .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: validate .sp 3 Function: .sp 2 .in 4 .un 4 1. It validates that all attributes on a declaration is compatible. .sp 1 .un 4 2. It applies the default attributes to every declaration. .sp 1 .un 4 3. It checks for completeness of certain attributes. .sp 1 .un 4 4. It develops the packed attribute and the abnormal attribute. .sp 1 .un 4 5. It validates that precision, scale, string size, and area size are within proper range. .in 0 .sp 3 Entry: .sp 2 validate .sp 3 Usage: .sp 2 declare validate entry ( ptr ); .sp 2 call validate ( symbol_ptr ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node to be processed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_ .br declare_structure .br expression_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 evaluate .br an internal procedure to evaluate the predicate of a default statement. .sp 1 .un 20 inconsistent .br an internal procedure to check for incompatible attributes in the same declaration. .sp 1 .un 20 print .br an internal procedure to call the error message program semantic_translator$error. .sp 1 .un 20 system .br an internal procedure to evaluate the system defaults. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 error_$no_text .br merge_attributes .br propagate_bit .br semantic_translator$error .br token_to_binary .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br default .br symbol .br symbol_bits .br reference .br operator .br token .br token_types .br decoded_token_types .br list .br block .br op_codes .br nodes .br system .br attribute_table .br declare_type .sp 3 Errors Diagnosed: .sp 2 Error 97 .br Error 113 .br Error 200 .br Error 201 .br Error 204 .br Error 205 .br Error 206 .br Error 207 .br Error 208 .br Error 209 .br Error 211 .br Error 212 .br Error 215 .br Error 216 .br Error 217 .br Error 218 .br Error 219 .br Error 220 .br Error 222 .br Error 279 .br Error 280 .br Error 281 .br Error 282 .br Error 283 .br Error 284 .br Error 285 .br Error 357 .br Error 360 .br Error 367 .* .bp .in 0 NAME: merge_attributes .sp 3 Function: .sp 2 .in 4 .un 4 1. It merges attributes from a template declaration into a target declaration. .in 0 .sp 3 Entry: .sp 2 merge_attributes .sp 3 Usage: .sp 2 declare merge_attributes entry ( ptr, ptr ) returns ( bit(1) aligned ); .sp 2 success_bit = merge_attributes ( target_symbol_ptr, template_symbol_ptr ); .sp 2 .in 30 .un 30 1. target_symbol_ptr pointer to the symbol node of the declaration to which the attributes are merged into. (input) .sp 1 .un 30 2. template_symbol_ptr pointer to the symbol node of the declaration of the template. (input) .sp 1 .un 30 3. success_bit bit indicating if the merging process is successful. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_parse .br lang_util_ .br validate .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_token .sp 3 Include Files used: .sp 2 symbol .br reference .br token .br token_types .br language_utility .br source_id_descriptor .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: get_size .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates statements in the prologue sequence for adjustible bounds or adjustible sizes. .sp 1 .un 4 2. It turns on the varying_ref bit in the reference node for varying strings. .sp 1 .un 4 3. It fills the length and c_length fields in the reference node for areas. .sp 1 .un 4 4. It fills in the word_size and c_word_size fields in the symbol node. .sp 1 .un 4 5. If the declaration is a picture, it calls declare_picture to check the syntax of the picture string and to develop all its attributes. .sp 1 .un 4 6. It calculates the boundary requirement for each declaration. .sp 1 .un 4 7. If the declaration is an array, it calls get_array_size to find the total size and to compute the multipliers and virtual origin used by subscripted references to the array elements. .sp 1 .un 4 8. If the declaration is a member of the structure, it stores the offset units in the c_length field of the reference node temporarily. .sp 1 .un 4 9. If the declaration is a structure, it tries to improve the offset units to the best possible unit. .in 0 .sp 3 Entry: .sp 2 get_size .sp 3 Usage: .sp 2 declare get_size entry (ptr); .sp 2 call get_size ( symbol_ptr ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node to be processed by this program. (input/output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare .br declare_structure .br declare_temporary .br expand_initial .br lang_util_ .br operator_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 addf .br an internal procedure to create an add operator. .sp 1 .un 20 multf .br an internal procedure to create a mult operator. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$eis_mode .br pl1_stat_$util_abort .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_operator .br create_statement$prologue .br declare_constant$integer .br declare_integer .br declare_picture .br get_array_size .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br symbol .br block .br statement .br statement_types .br reference .br token .br operator .br op_codes .br boundary .br system .sp 3 Errors Diagnosed: .sp 2 Error 414 .br Error 434 .br Error 440 .br Error 457 .br Error 458 .br Error 459 .* .bp .in 0 NAME: get_array_size .sp 3 Function: .sp 2 .in 4 .un 4 1. It fills in the element size fields of the array node and expresses them in the best unit. .sp 1 .un 4 2. It walks down the bound pairs and construct two multipliers for each bound pair. The descriptor multiplier is used only when the array is accessed as a parameter. It is expressed in bits if the array is packed, and in words if it is unpacked. The other multiplier is used by this procedure and is expressed in the unit given by offset_units. .sp 1 .un 4 3. Multipliers are computed by the following rule: .in +6 m(n) = element_size .br m(n-1) = (hb(n)-lb(n)+1) * m(n) .br m(n-2) = (hb(n-1)-lb(n-1)+1) * m(n-1) .br . .br . .br . .br m(1) = (hb(2)-lb(2)+1) * m(2) .in -6 .sp 1 .un 4 4. The address of a subscripted element is: .in +6 addr( a(i(1),i(2),...,i(n)) ) = B - V + (i(1)*m(1) + i(2)*m(2) + ... + i(n)*m(n)) .br where .in +6 B = the beginning of storage for the array, that is, the offset of the first element, addr( a(i(lb),i(lb(2)),...,i(lb(n)) ) .un 6 and .br V = the virtual origin, that is, the offset of the 0th element, addr( a(0,0,...,0) ) .in -12 .sp 1 .un 4 5. The first multiplier is the element size. It is converted to bits when used as the descriptor multiplier of a packed, array. .sp 1 .un 4 6. It loops down the bound pairs and develop the other multiplirs. .sp 1 .un 4 7. It creates statements in the prologue sequence if any multiplier is an expression. .sp 1 .un 4 8. The last multiplier gives the total size of the array, this total size is recorded in the symbol node. .in 0 .sp 3 Entry: .sp 2 get_array_size .sp 3 Usage: .sp 2 declare get_array_size entry (ptr); .sp 2 call get_array_size ( symbol_ptr, offset_unit ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node with the dimensioned attribute. (input) .sp 1 .un 30 2. offset_unit unit in which the offset is expressed. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 get_size .sp 3 Internal Procedures: .sp 2 .sp 2 .in 20 .un 20 addf .br an internal procedure to create an add operator. .sp 1 .un 20 assignf .br an internal procedure to create an assign operator in the prologue sequence. .sp 1 .un 20 interleaved .br an internal procedure to distribute the bounds, multipliers, and virtual origins of a dimensional structure onto all its contained members at every level. .sp 1 .un 20 multf .br an internal procedure to create a mult operator. .sp 1 .un 20 subf .br an internal procedure to create a sub operator. .sp 1 .un 20 virtue .br an internal procedure to add a term to the virtual origin. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$eis_mode .br pl1_stat_$util_error .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_array .br create_bound .br create_operator .br create_statement$prologue .br declare_constant$integer .br declare_integer .br token_to_binary .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br array .br reference .br symbol .br token .br token_types .br block .br operator .br op_codes .br statement .br statement_types .br boundary .br nodes .br system .sp 3 Errors Diagnosed: .sp 2 Error 168 .* .bp .in 0 NAME: declare_structure .sp 3 Function: .sp 2 .in 4 .un 4 1. It scans the structure to determine the boundary, packing, and size required fby each member. .sp 1 .un 4 2. It computes the boundary, packing, and size required by the level one structure. .sp 1 .un 4 3. It then computes the offset for each member of the structure. .in 0 .sp 3 Entry: .sp 2 declare_structure .sp 3 Usage: .sp 2 declare declare_structre entry (ptr); .sp 2 call declare_structure ( symbol_ptr ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node to be processed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 get_structure_size .br an internal procedure to compute the offset of each structure member, to determine the level one structure size, and to call the internal procedure initialize to initialize each structure member, if necessary. .sp 1 .un 20 initialize .br an internal procedure to initialize all members of the structure, if necessary. .sp 1 .un 20 structure_scan .br an internal procedure to propagate the refer_extent, exp_extent, and star_extent bits upward, to determine the boundary required by each structure member, and the packing of the structure. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$eis_mode .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_operator .br create_statement$prologue .br declare_ .br declare_constant$integer .br declare_descriptor .br declare_descriptor$param .br declare_pointer .br expand_initial .br get_size .br offset_adder .br semantic_translator$error .br validate .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br symbol .br array .br block .br reference .br operator .br statement .br op_codes .br nodes .br statement_types .br boundary .br list .br system .sp 3 Errors Diagnosed: .sp 2 Error 210 .bp I_N_I_T_I_A_L_I_Z_A_T_I_O_N_ .sp 2 The declaration processor creates statements in the prologue sequence of the declaring blocks to do the initialization of variables. Variables that require initialization includes file constants, varying strings, areas, in addition to variables with the initial attribute. .* .bp .in 0 NAME: expand_initial .sp 3 Function: .sp 2 .in 4 .un 4 1. It initializes a file constant by creating an internal static file state block, and a file attribute block. .sp 1 .un 4 2. It initializes varying strings to null strings. .sp 1 .un 4 3. It initializes areas to "empty". .sp 1 .un 4 4. It creates a statement to initialize scalar variables. .sp 1 .un 4 5. For array initialization, it creates a subscript. For one dimension arrays, it creates codes to initialize the subscript to zero, increments it, and uses it as a subscript of the array, while the initial values are assigned one by one to the elements of the array. .sp 1 .un 4 6. For multi-dimensional arrays, a one dimensional vector whose number of elements is equal to the number of dimensions of the multi-dimensional array is created. Initialization is done in two steps. First the one dimensional array is initialized, then loop and join operators are created to initialize the multi-dimensional array. .in 0 .sp 3 Entry: .sp 2 expand_initial .sp 3 Usage: .sp 2 declare expand_initial entry ( ptr, ptr, ptr ); .sp 2 call expand_initial ( symbol_ptr, statement_ptr, locator_qualifier ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node to be processed by this program. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node or block node containing this declaration. (input) .sp 1 .un 30 3. locator_qualifier locator qualifier of the expression, if any. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br declare .br declare_structure .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 addf .br an internal procedure to create an add operator. .sp 1 .un 20 assign_initial .br an internal procedure to assign the values of an initial attribute to a vector. .sp 1 .un 20 assignf .br an internal procedure to create an assign operator. .sp 1 .un 20 link_father .br an internal procedure to create a list node to structure qualify members of the structure. .sp 1 .un 20 make_statement .br an internal procedure to create a statement node either in the prologue sequence or in the main sequence of the block. .sp 1 .un 20 multf .br an internal procedure to create a mult operator. .sp 1 .un 20 subf .br an internal procedure to create a sub operator. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_array .br create_bound .br create_cross_reference .br create_label .br create_list .br create_operator .br create_reference .br create_statement .br create_statement$prologue .br create_symbol .br create_token .br declare_constant$bit .br declare_constant$char .br declare_constant$integer .br declare_integer .br declare_pointer .br get_size .br semantic_translator$abort .br token_to_binary .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br cross_reference .br symbol .br boundary .br system .br label .br reference .br token .br token_types .br declare_type .br statement .br block .br statement_types .br op_codes .br operator .br array .br list .br nodes .sp 3 Errors Diagnosed: .sp 2 Error 264 .br Error 292 .br Error 442  Chapter5.runoff 09/03/74 1137.9rew 09/03/74 1137.9 769608 .m1 6 .m2 0 .m3 4 .m4 6 .ms 1 .ad .ar .fo 1 "DRAFT: SUBJECT TO CHANGE"%sec%-%"order number" .sr sec 5 .sp 7 .ce 1 SECTION V .sp 2 .ce 1 SEMANTIC TRANSLATION .sp 4 A_N__O_V_E_R_V_I_E_W_ .sp 2 The semantic translator scans over the internal representation of the program and transforms the internal representation to reflect the attributes declared with each variable. Thus the semantics of the variables will be used by this phase of the compiler to produce a more sophisticated and meaningful internal representation of the program ready for the optimizer and the code generator. .* .bp .in 0 NAME: semantic_translator .sp 3 Function: .sp 2 .in 4 .un 4 1. It calls the context_processor to process all the context information recorded during the parse. .sp 1 .un 4 2. For each block, starting from pl1_stat_$root, going down for its son block and then its brother block, the program performs the following jobs: .in +4 .un 4 a. It collects all the information necessary to determine whether a block can be quick. .un 4 b. It goes down the chain block.declaration and calls declare to process all the symbols in the chain. .un 4 c. It calls expression_semantics to process all the statements in the main sequence of the block, and then all the statements in the prologue sequence of the block. .in -4 .sp 1 .un 4 3. It goes over the block nodes and determine if they are quick. .in 0 .sp 3 Entry: .sp 2 semantic_translator .sp 3 Usage: .sp 2 declare semantic_translator entry; .sp 2 call semantic_translator; .sp 3 Programs that invoke this entry: .sp 2 pl1 .br v2pl1_semant_ .sp 3 Entry: .sp 2 semantic_translator$abort .sp 2 This entry is called when a fatal error occurs in declaration processing or semantic translation. Recovery consists of deleting the offending statement from the program by transforming it into a null statement. Illegal declaration remain in the program. The error message program error_ or error_$no_text is called, and control is transferred to start process the next statement or the next symbol. .sp 3 Usage: .sp 2 declare semantic_translator$abort entry ( fixed bin(15), ptr ); .sp 2 call semantic_translator$abort ( error_number, error_pointer ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. error_pointer pointer to an operand used by the error message program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br declare .br defined_reference .br do_semantics .br expand_assign .br expand_infix .br expand_initial .br expand_primitive .br expression_semantics .br function .br generic_selector .br lookup .br match_arguments .br operator_semantics .br semantic_translator .br subscripter .br v2pl1_semant_ .sp 3 Entry: .sp 2 semantic_translator$error .sp 2 This entry is called when a non-fatal error occurs during the semantic translation or declaration processing. The error message program error_ or error_$no_text is called to issue a warning, and control is transferred to continue process the same statement or the same symbol. .sp 3 Usage: .sp 2 declare semantic_translator$error entry ( fixed bin(15), ptr ); .sp 2 call semantic_translator$error ( error_number, error_pointer ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. error_pointer pointer to an operand used by the error message program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br declare .br declare_structure .br defined_reference .br expression_semantics .br function .br io_data_list_semantics .br io_semantics .br semantic_translator .br v2pl1_semant_ .br validate .sp 3 Entry: .sp 2 semantic_translator$call_es .sp 2 This entry is called by prepare_symbol_table in the code generator, when it wants to process an expression hanging off a symbol node. .sp 3 Usage: .sp 2 declare semantic_translator$call_es entry ( ptr, ptr, ptr, label ) returns (ptr); .sp 2 return_tree = semantic_translator$call_es ( cur_block, statement_ptr, input_tree, abort_label ); .sp 2 .in 30 .un 30 1. cur_block pointer to the block node containing this operand. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .sp 1 .un 30 4. abort_label the label to be transferred to if this program is aborted for any reason. (input) .sp 1 .un 30 5. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 prepare_symbol_table .br v2pl1_semant_ .sp 3 Internal Procedures: .sp 2 process_label .in 20 an internal procedure to process all the labels in the label list, and to issue warnings if the previous statement is a goto statement and there are no labels on the current statement. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$LHS .br pl1_stat_$abort_label .br pl1_stat_$cur_statement .br pl1_stat_$debug_semant .br pl1_stat_$error_flag .br pl1_stat_$index .br pl1_stat_$last_severity .br pl1_stat_$multi_type .br pl1_stat_$node_uses .br pl1_stat_$profile_length .br pl1_stat_$quick_pt .br pl1_stat_$root .br pl1_stat_$st_length .br pl1_stat_$st_start .br pl1_stat_$statement_id .br pl1_stat_$stop_id .br pl1_stat_$util_abort .br pl1_stat_$util_error .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 abort a label indicating where the control should go if there is a fatal error occuring anywhere in the declaration processing of symbols, or the semantic processing of statements. .sp 1 .un 20 had_error a bit indicating if an error has occurred in the processing. It is used only by the semantic_translator$call_es entry. .in 0 .sp 3 Programs Called: .sp 2 context_processor .br convert .br debug .br declare .br error .br error_ .br error_$no_text .br expression_semantics .br ioa_ .br semantic_translator$abort .br semantic_translator$error .sp 3 Include Files used: .sp 2 quick_info .br semant .br language_utility .br source_id_descriptor .br block .br block_types .br declare_type .br operator .br semantic_bits .br list .br symbol .br reference .br statement .br statement_types .br nodes .br token .br token_types .br system .sp 3 Errors Diagnosed: .sp 2 Error 56 .bp O_P_E_R_A_T_O_R__P_R_O_C_E_S_S_I_N_G_ .sp 2 When an operator is encountered, the attributes of the operands are examined, and from these attributes, the attributes of the result of the operation are derived. The result of an operator is represented in the program as a temporary node. These temporary nodes may be operands of other operators, and the attributes of these temporary nodes may in turn be used to derive the properties of yet other temporary nodes. .sp 2 Some operators may be modified, and some operators may be changed to a std_call operator to invoke a library routine if the semantics warrants it. .* .bp .in 0 NAME: operator_semantics .sp 3 Function: .sp 2 .in 4 .un 4 1. It goes down the operator node and extracts the data types from the operands. .sp 1 .un 4 2. For most operators, it determines the type, precision, scale of the result, and creates a temporary node to hold the result. It also converts each operand to the appropriate type, precision, and scale in order to produce the result. .sp 1 .un 4 3. For the exponentiation operator, it determines from the operands either to pass along the exponentiation operator, or to create a std_call operator to call a libraray subroutine. .in +10 cxp1_ .br dcxp1_ .br cxp2_ .br dcxp2_ .br decimal_exp_ .br xp22_ .br dxp12_ .br cxp12_ .br dcxp12_ .sp 1 .in -10 .un 4 4. Fr the assignment operator, the following steps are taken: .in +4 .un 4 a. If the right side is a constant, convert it to the type of the left side, unless the left side has no type. Then the right side is converted to the type represented by the constant itself. .un 4 b. If the left side has no type, it is converted to the type of the right side. .un 4 c. If the assignment is to a char(*) or bit(*) return parameter, a statement will be created to make a descriptor for the return parameter. .un 4 d. In certain cases assignments of x=0 are transformed into an operator assign_zero(x). .un 4 f. If the right side is an operator whose output temporary has the same attributes as the left side, replace the temporary with a reference to the left side. .un 4 g. Assignments of a pointer to an offset and vice versa are transformed into off_fun operator or ptr_fun operator. .un 4 h. Area assignment is converted into a call to area_$assign ( addr(a1), addr(a2) ); .in -4 .sp 1 .un 4 5. For the std_call operator, the procedure function will be invoked. .sp 1 .un 4 6. For the std_entry operator, a goto statement is created before and a null statement is created after the statement containing the std_entry operator. If any parameter or return value appears in a differenct position in another entry statement, then an assignment statement will be created so that the parameter or return value are made to be qualified by automatic pointers. If the block has multiple return types, an assignment statement is created so that it is possible to determine by means of an automatic integer which entry is invoked. An ex_prologue operator is created with every std_entry operator. .sp 1 .un 4 7. For a return_value operator with multiple return values, it is necessary to create a number of statements best illustrated by the following sequence: .in +10 .sp 1 if entry_indicator ^= 1 then goto label1; entry_1_return_value = return_operand; .br return; .un 10 label1: ; .sp 1 : .br : .br : .sp 1 if entry_indicator ^= n then goto labeln; .br entry_n_return_value = return_operand; .br return; .un 10 labeln: ; .in -10 .sp 1 It is sometimes possible to cause a fatal error by the processing of one of the generated statements, in that case, that statement will be transformed into a signal statement. .sp 1 .un 4 8. For input/output operators, the procedure io_semantics will be invoked. .sp 1 .un 4 9. For do_fun operators, the procedure do_semantics will be invoked. .sp 1 .un 4 10. For allot_based and free_based operators, the procedure alloc_semantics will be invoked. .in 0 .sp 3 Entry: .sp 2 operator_semantics .sp 3 Usage: .sp 2 declare operator_semantics entry ( ptr, ptr, ptr, bit(36) aligned ) returns (ptr); .sp 2 return_tree = operator_semantics ( block_ptr, statement_ptr, input_tree, context_bits ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operator. (input) .sp 1 .un 30 3. input_tree pointer to the operator node that is to be processed by operator_semantics. (input) .sp 1 .un 30 4. context_bits bits containing special information about this operator node. (input/output) .sp 1 .un 30 5. return_tree pointer to the operator node returned by operator_semantics. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br do_semantics .br expand_infix .br expand_prefix .br expression_semantics .br operator_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 convert_relationals .br an internal procedure used to force proper conversions of operands of relational operators. .sp 1 .un 20 converter .br an internal procedure used to convert operand(2) and operand(3) of the operator node to their appropriate type. .sp 1 .un 20 extract .br an internal procedure used to extract data types and useful pointers of all the operands of the operator node. .sp 1 .un 20 make .br an internal procedure used to create an operator node and a statement node, and attach the operator node to the root of the statement node. .sp 1 .un 20 prepare .br an internal procedure used to create statements for any expression found in the return_value operator, when there are multiple return types. .sp 1 .un 20 print .br an internal procedure used to call the error message program semantic_translator$abort. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$abort_label .br pl1_stat_$cur_statement .br pl1_stat_$error_flag .br pl1_stat_$multi_type .br pl1_stat_$root .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 alloc_semantics .br compare_declaration .br convert .br convert$to_target .br convert$validate .br copy_expression .br create_label .br create_list .br create_operator .br create_reference .br create_statement .br create_symbol .br create_token .br declare .br declare_constant .br declare_constant$integer .br declare_temporary .br do_semantics .br expand_assign .br expression_semantics .br free_node .br function .br get_size .br io_semantics .br operator_semantics .br refer_extent .br reserve$declare_lib .br semantic_translator$abort .br share_expression .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br symbol .br symbol_bits .br operator .br mask .br label .br list .br block .br block_types .br statement .br reference .br semantic_bits .br op_codes .br statement_types .br nodes .br system .br token .br token_types .br declare_type .br decoded_token_types .sp 3 Errors Diagnosed: .sp 2 Error 50 .br Error 51 .br Error 52 .br Error 53 .br Error 78 .br Error 134 .br Error 135 .br Error 180 .br Error 198 .br Error 223 .br Error 227 .br Error 229 .br Error 435 .bp O_P_E_R_A_N_D__P_R_O_C_E_S_S_I_N_G_ .sp 2 Operands may be constants, or references. References may be simple references, subscripted references, structure qualified references, locator qualified references, or function references. References may further be defined on other references. The semantic translator finds the correct declaration for each variable, builds and processes the length expression, offset expression and qualifier expression for each variable. When these accessing expressions are fully processed, the code generator can produce codes to access the data at runtime. .* .bp .in 0 NAME: expression_semantics .sp 3 Function: .sp 2 .in 4 .un 4 1. It processes the operator nodes in the following manner: .in +4 .un 4 a. It calls io_semantics for io opcodes. .un 4 b. It calls format_list_semantics for format opcodes. .un 4 c. It gets the proper pointer for locator qualification for refer and bit_pointer opcodes. .un 4 d. It calls itself recursively to process all the operands of the operator node. After all the operands are processed, it calls operator_semantics to produce the appropriate temporary result. If any of the operands is an aggregate reference or aggregate expression, it will invoke the aggregate package expand_assign, expand_infix or expand_prefix to do further processing of the operator. .sp 1 .in 4 .un 4 2. It processes the token node and the reference nodes in the following manner: .in +4 .un 4 a. It converts the constants if there are default statements in the block. Otherwise, it leaves the constants alone. .un 4 b. It calls lookup to get the proper symbol node pointer. .un 4 c. If the symbol has the builtin attribute, it calls builtin. .un 4 d. If the symbol has the generic attribute, it calls generic_selector. .un 4 e. It processes the qualifier. .un 4 f. It processes the subscripts. It determines if the reference is a scalar, a cross-section, or an array reference. It calls subscripter to compute the offset. If the symbol has the defined attribute, it calls defined_reference to compute the offset. .un 4 g. It processes the offset field of the reference node. .un 4 h. It processes the length field of the reference node. .un 4 i. If the symbol has the entry attribute, it calls function. .un 4 j. It turns on the aggregate bit in context_bits if the reference is a structure or an array. It then goes through an algorithm to determine whether the LHS_in_RHS bit in the statement node should be turned on. .in 0 .sp 3 Entry: .sp 2 expression_semantics .sp 3 Usage: .sp 2 declare expression_semantics entry ( ptr, ptr, ptr, bit (36) aligned ) returns (ptr); .sp 2 return_tree = expression_semantics ( block_ptr, statement_ptr, input_tree, context_bits ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand that is to be processed by expression_semantics. (input) .sp 1 .un 30 4. context_bits bits containing special information about this operand. (input/output) .sp 1 .un 30 5. return_tree pointer to the operand returned by expression_semantics. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br declare_descriptor .br defined_reference .br expand_assign .br expand_infix .br expand_initial .br expand_primitive .br expression_semantics .br function .br generic_selector .br io_data_list_semantics .br io_semantics .br operator_semantics .br semantic_translator .br subscripter .br v2pl1_semant_ .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 print .br an internal procedure used to call the error message program semantic_translator$abort. .in 0 .sp 3 External Variables: .sp 2 pl1_data$builtin_name .br pl1_stat_$LHS .br pl1_stat_$index .br pl1_stat_$locator .br pl1_stat_$root .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 builtin .br convert .br convert$to_integer .br convert$to_target .br copy_expression .br create_cross_reference .br create_list .br create_operator .br create_reference .br create_symbol .br create_token .br declare .br defined_reference .br expand_assign .br expand_infix .br expand_prefix .br expand_primitive .br expression_semantics .br format_list_semantics .br free_node .br function .br generic_selector .br io_semantics .br lookup .br operator_semantics .br propagate_bit .br semantic_translator$abort .br semantic_translator$error .br share_expression .br simplify_offset .br subscriptor .br validate .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br block .br block_types .br builtin_table .br cross_reference .br declare_type .br label .br list .br nodes .br op_codes .br operator .br reference .br semantic_bits .br statement .br symbol .br symbol_bits .br system .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 63 .br Error 64 .br Error 65 .br Error 66 .br Error 67 .br Error 68 .br Error 70 .br Error 71 .br Error 72 .br Error 73 .br Error 77 .br Error 80 .br Error 83 .br Error 102 .br Error 121 .br Error 137 .br Error 145 .br Error 291 .* .bp .in 0 NAME: simplify_offset .sp 3 Function: .sp 2 .in 4 .un 4 1. It attempts to reduce the precision of the length expression, if possible. .sp 1 .un 4 2. It attempts to simplify the offset expression into an expression part and a constant part. The expression part will be stored in reference.offset, and the constant part will be stored in reference.c_offset. .sp 1 .un 4 3. The expressions of the form .in +6 constant .br expression + constant .br expression - constant .br constant + expression .br constant1 * constant2 .br constant1 * (expression + constant2) .br constant1 * (expression - constant2) .br constant1 * (constant2 + expression) .br .in -6 will be simplified by this program. .in 0 .sp 3 Entry: .sp 2 simplify_offset .sp 3 Usage: .sp 2 declare simplify_offset entry ( ptr ); .sp 2 call simplify_offset ( tree ); .sp 2 .in 30 .un 30 1. tree pointer to the reference node whose offset expression and length expression are to be processed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expand_primitive .br expression_semantics .br function .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 check_addr .br an internal procedure to improve code generated for an unaligned item locator qualified by the addr of another item. .sp 1 .un 20 check_char_units .br an internal procedure to ensure unaligned binary numbers or pointers not to have character offset units. .sp 1 .un 20 check_exp .br an internal procedure to determine whether an offset expression occurs as part of the length expression. .sp 1 .un 20 fb1_const .br an internal procedure to determine if a declaration is a single word fixed binary constant. .sp 1 .un 20 fb_value .br an internal procedure to determine if a declaration is a fixed binary real constant or fixed binary real aligned variable. .sp 1 .un 20 fix_exp .br an internal procedure to reduce precision of the temporary of an expression to default precision, if possible. .sp 1 .un 20 free_exp .br an internal procedure to free the storage for an expression. .sp 1 .un 20 free_op .br an internal procedure to free an operator node. .sp 1 .un 20 in_expression .br an internal procedure to the internal procedure check_exp to determine whether an expression appears as part of another expression. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 compare_expression .br convert$to_integer .br copy_expression .br create_operator .br declare_constant$integer .br declare_temporary .br free_node .br share_expression .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br operator .br reference .br symbol .br array .br op_codes .br nodes .br system .br boundary .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: offset_adder .sp 3 Function: .sp 2 .in 4 .un 4 1. It combines one set of offset with another set of offset. .in 0 .sp 3 Entry: .sp 2 offset_adder .sp 3 Usage: .sp 2 declare offset_adder entry ( ptr, fixed bin(31), fixed bin(3), ptr, fixed bin(31), fixed bin(3), bit(1) ); .sp 2 call offset_adder ( offset_1, c_offset_1, unit_of_offset_1, offset_2, c_offset_2, unit_of_offset_2, no_improve_bit ); .sp 2 .in 30 .un 30 1. offset_1 pointer to the first offset expression. (input/output) .sp 1 .un 30 2. c_offset_1 first constant offset. (input/output) .sp 1 .un 30 3. unit_of_offset_1 unit in which offset_1 and c_offset_1 are measured. (input/output) .sp 1 .un 30 4. offset_2 pointer to the second offset expression. (input) .sp 1 .un 30 5. c_offset_2 second constant offset. (input) .sp 1 .un 30 6. unit_of_offset_2 unit in which offset_2 and c_offset_2 are measured. (input) .sp 1 .un 30 7. no_improve_bit bit indicating whether the offsets should be improved to the best unit. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br declare_structure .br defined_reference .br subscripter .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 get_ptr .br an internal procedure to eliminate the mod_bit and mod_byte operators, and to modifiy the mod_word operator before combining the two offsets. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$eis_mode .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_operator .br declare_constant$integer .br free_node .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br operator .br nodes .br op_codes .br boundary .br system .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: lookup .sp 3 Function: .sp 2 .in 4 .un 4 1. Given an identifier, it searches through the list of symbol nodes to find the applicable declaration associated with the identifier. This list of symbol nodes are chained first through token.declaration, and thereafter through symbol.multi_use. .sp 1 .un 4 2. Fully qualified references are considered applicable. .sp 1 .un 4 3. Partially qualified references are considered applicable if no better reference or no other partially qualified references can be found. .sp 1 .un 4 4. It creates a cross reference node for the identifier. .in 0 .sp 3 Entry: .sp 2 lookup .sp 3 Usage: .sp 2 declare lookup entry ( ptr, ptr, ptr, ptr, bit (36) aligned ) returns (bit(1) aligned); .sp 2 success_bit = lookup ( block_ptr, statement_ptr, input_tree, symbol_ptr, context_bits ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node conatining this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by lookup. (input) .sp 1 .un 30 4. symbol_ptr pointer to the symbol node for the operand. (output) .sp 1 .un 30 5. context_bits bits containing the special information about this operand. (output) .sp 1 .un 30 6. success_bit bit indicating if lookup has successfully found the symbol node corresponding to the input tree. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 context_processor .br declare .br defined_reference .br expression_semantics .br function .br prepare_symbol_table .br v2pl1_semant_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_cross_reference .br semantic_translator$abort .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br symbol .br label .br reference .br semantic_bits .br block .br statement .br token .br list .br cross_reference .br nodes .sp 3 Errors Diagnosed: .sp 2 Error 221 .* .bp .in 0 NAME: subscripter .sp 3 Function: .sp 2 .in 4 .un 4 1. It gathers all the subscripts from the subscript list. If the subscript is a constant, it gets its value and ascertain that the constant is within the subscript range. If the subscript is a variable or expression, it converts the result to integer type. .sp 1 .un 4 2. If the subscriptrange prefix is on, it creates a bound_ck operator. .sp 1 .un 4 3. If all the subscripts are constants, it will yield a constant offset as the partial result, otherwise it will yield an expression offset as the partial result. .sp 1 .un 4 4. It calls offset_adder to combine the partial offset with the offset produced by the declaration processor. .in 0 .sp 3 Entry: .sp 2 subscripter .sp 3 Usage: .sp 2 declare subscripter entry ( ptr, ptr, ptr, ptr, ptr ) returns (ptr); .sp 2 return_ptr = subscripter ( cur_block, statement_ptr, input_tree, subscript_ptr, symbol_ptr ); .sp 2 .in 30 .un 30 1. cur_block pointer to the block node containing this operand. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by subscripter. (input) .sp 1 .un 30 4. subscript_ptr pointer to the list of subscripts. (input) .sp 1 .un 30 5. symbol_ptr pointer to the symbol node for the operand. (input) .sp 1 .un 30 6. return_tree pointer to the operand returned by subscripter. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 defined_reference .br expand_primitive .br expression_semantics .br function .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 addf .br an internal procedure to create an add operator. .sp 1 .un 20 multf .br an internal procedure to create a mult operator. .sp 1 .un 20 print .br an internal procedure used to call the error message program semantic_translator$abort. .sp 1 .un 20 subf .br an internal procedure to create a sub operator. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$eis_mode .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 convert$to_integer .br copy_expression .br create_bound .br create_list .br create_operator .br declare_constant$integer .br expression_semantics .br offset_adder .br semantic_translator$abort .br token_to_binary .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br block .br label .br symbol .br array .br reference .br statement .br list .br token .br operator .br op_codes .br boundary .br nodes .br token_types .br declare_type .br semantic_bits .br system .sp 3 Errors Diagnosed: .sp 2 Error 81 .br Error 82 .br Error 84 .br Error 184 .* .bp .in 0 NAME: function .sp 3 Function: .sp 2 .in 4 .un 4 1. It does the semantic processing of all the arguments. .sp 1 .un 4 2. It determines whether descriptors are needed for the arguments. .sp 1 .un 4 3. It determines whether an argument should be passed by-value or by-reference. .sp 1 .un 4 4. It has an algorithm to handle the special case when an argument is a cross section reference. .sp 1 .un 4 5. It does the semantic processing of the returns argument. .sp 1 .un 4 6. It creates a desc_size operator for the returns argument if necessary. .sp 1 .un 4 7. It creates a statement for the std_call operator if the returns parameter has the star_extents and/or the varying attribute. .in 0 .sp 3 Entry: .sp 2 function .sp 3 Usage: .sp 2 declare function entry ( ptr, ptr, ptr, ptr, bit(36) aligned ) returns (ptr); .sp 2 return_tree = function (cur_block, statement_ptr, input_tree, symbol_ptr, context_bits ); .sp 2 .in 30 .un 30 1. cur_block pointer to the block node containing this operand. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by function. (input) .sp 1 .un 30 4. symbol_ptr pointer to the symbol node for the operand. (input) .sp 1 .un 30 5. context_bits bits containing special information about this operand. (input/output) .sp 1 .un 30 6. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expression_semantics .br operator_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 print .br an internal procedure used to call the error message programs semantic_translator$abort and semantic_translator$error. .sp 1 .un 20 prop_bit .br an internal procedure used to turn on an attribute bit throughout a structure. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .br pl1_stat_$quick_pt .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 check_star_extents .br copy_expression .br create_array .br create_bound .br create_list .br create_operator .br create_reference .br create_statement .br create_symbol .br declare_constant$integer .br declare_descriptor .br declare_temporary .br expression_semantics .br lookup .br match_arguments .br semantic_translator$abort .br semantic_translator$error .br share_expression .br simplify_offset .br subscripter .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br block .br declare_type .br list .br nodes .br op_codes .br operator .br quick_info .br reference .br semantic_bits .br statement .br statement_types .br symbol .br symbol_bits .br system .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 47 .br Error 85 .br Error 86 .br Error 88 .* .bp .in 0 NAME: generic_selector .sp 3 Function: .sp 2 .in 4 .un 4 1. It does the semantic processing of all the arguments of the generic reference and gets the symbol pointer for each argument. .sp 1 .un 4 2. It calls the internal procedure compare_generic for each argument for each corresponding argument selector in every alternative. .sp 1 .un 4 3. It selects the proper entry reference when all the arguments match a particular selector. .in 0 .sp 3 Entry: .sp 2 generic_selector .sp 3 Usage: .sp 2 declare generic_selector entry ( ptr, ptr, ptr, ptr, bit(36) alligned ) returns (ptr); .sp 2 return_tree = generic_selector ( cur_block, statement_ptr, input_tree, subscript_ptr, context_bits ); .sp 2 .in 30 .un 30 1. cur_block pointer to the block node containing this operand. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .sp 1 .un 30 4. subscript_list pointer to the list of subscripts. (input) .sp 1 .un 30 5. context_bits bits containing special information about this operand. (input) .sp 1 .un 30 6. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expression_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 compare_generic .br an internal procedure to determine if an argument matches the description for a specific argument selector in the generic declaration. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_operator .br create_symbol .br expression_semantics .br semantic_translator$abort .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br semantic_bits .br list .br symbol .br reference .br token .br token_types .br nodes .br statement .br statement_types .br operator .br op_codes .br array .br declare_type .br picture_image .sp 3 Errors Diagnosed: .sp 2 Error 65 .* .bp .in 0 NAME: match_arguments .sp 3 Function: .sp 2 .in 4 .un 4 1. It is called by the procedure function to determine if an argument matches the corresponding parameter description, so that the argument can be passed by-reference instead of by-value. .sp 1 .un 4 2. It may call itself recursively if both the argument and the parameter are aggregate references so that lower level mismatches are also taken into consideration. .in 0 .sp 3 Entry: .sp 2 match_arguments .sp 3 Usage: .sp 2 declare match_arguments entry ( ptr, ptr ) returns (bit(1) aligned); .sp 2 success_bit = match_arguments ( first_ptr, second_ptr ); .sp 2 .in 30 .un 30 1. first_ptr pointer to the first operand. (input) .sp 1 .un 30 2. second_ptr pointer to the symbol node of the second operand. (input) .sp 1 .un 30 3. success_bit bit indicating if the two operands match. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 function .br match_arguments .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 int_index .br number indicating the depth of a structure the program is operating on. .sp 1 .un 20 parent_is_scalar .br bit indicating if the parent is a scalar. .in 0 .sp 3 Programs Called: .sp 2 compare_expression .br match_arguments .br semantic_translator$abort .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br nodes .br picture_image .br reference .br symbol .sp 3 Errors Diagnosed: .sp 2 Error 269 .* .bp .in 0 NAME: make_non_quick .sp 3 Function: .sp 2 .in 4 .un 4 1. It walks through an expression tree, if it finds a function reference to an internal procedure, it makes the internal procedure non-quick. .in 0 .sp 3 Entry: .sp 2 make_non_quick .sp 3 Usage: .sp 2 declare make_non_quick entry (ptr) ; .sp 2 call make_non_quick ( tree ); .sp 2 .in 30 .un 30 1. tree pointer to the expression to be processed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 check_star_extents .br io_data_list_semantics .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 reference .br list .br operator .br symbol .br block .br nodes .br op_codes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: builtin .sp 3 Function: .sp 2 .in 4 .un 4 1. It does the semantics processing of all builtin functions. .sp 1 .un 4 2. It checks whether a builtin function is called with an acceptable number of arguments. .sp 1 .un 4 3. It processes all the arguments and extracts the data type and the pointer of all the arguments. .sp 1 .un 4 4. If an aggregate reference is found among any of the arguments, it determines if the result of the builtin should be an aggregate. .sp 1 .un 4 5. It calls expand_arguments, an internal procedure to handle those aggregate builtin references. .sp 1 .un 4 6. It checks to make sure whether all the arguments have acceptable data types. converting them if necessary. .sp 1 .un 4 7. For individual builtin functions, the work is rather straight forward, it creates either an operator node with the appropriate temporary, or it creates a std_call operator to call a runtime library subroutine. .in 0 .in 0 .sp 3 Entry: .sp 2 builtin .sp 3 Usage: .sp 2 declare builtin entry ( ptr, ptr, ptr, ptr, ptr, bit(36) aligned ) returns (ptr); .sp 2 return_tree = builtin ( cur_block, statement_ptr, input_tree, subscript_list, builtin_symbol, context_bits ); .sp 2 .in 30 .un 30 1. cur_block pointer to the block containing this builtin function. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this builtin function. (input) .sp 1 .un 30 3. input_tree pointer to the builtin function to be processed. (input) .sp 1 .un 30 4. subscript_list pointer to the list of arguments for this builtin function. (input) .sp 1 .un 30 5. builtin_symbol pointer to the symbol node for this builtin function. (input) .sp 1 .un 30 6. context_bits bits containing special information for this builtin function. (input/output) .sp 1 .un 30 7. return_tree pointer to the operand returned by this procedure. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expression_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 check_strings .br an internal procedure to make sure that all the members of the structure used as the argument to the string builtin have the same kind of string. .sp 1 .un 20 convert_arg .br an internal procedure to convert an operand to a certain data type. .sp 1 .un 20 expand_arguments .br an internal procedure to expand all the aggregate arguments to the builtin function. .sp 1 .un 20 make_assignment .br an internal procedure to create an operator node and a statement node and to attach the operator node to the root of the statement. .sp 1 .un 20 merge .br an internal procedure to combine the results of the expanded arguments of the builtin function. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$builtin_name .br pl1_stat_$cur_statement .br pl1_stat_$eis_mode .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 builtin .br check_star_extents .br compare_expression .br convert .br convert$from_builtin .br convert$to_integer .br convert$to_target .br convert$to_target_fb .br copy_expression .br create_list .br create_operator .br create_reference .br create_statement .br create_symbol .br create_token .br declare .br declare_constant .br declare_constant$bit .br declare_constant$char .br declare_constant$integer .br declare_descriptor .br declare_integer .br declare_temporary .br defined_reference .br expand_assign .br expand_infix .br expand_primitive .br expression_semantics .br fill_refer .br offset_adder .br operator_semantics .br propagate_bit .br reserve$declare_lib .br semantic_translator$abort .br semantic_translator$error .br share_expression .br simplify_offset .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br block .br boundary .br builtin_table .br decoded_token_types .br declare_type .br label .br list .br mask .br nodes .br operator .br op_codes .br reference .br semantic_bits .br statement .br statement_types .br symbol .br symbol_bits .br system .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 121 .br Error 122 .br Error 123 .br Error 124 .br Error 126 .br Error 127 .br Error 128 .br Error 131 .br Error 132 .br Error 139 .br Error 141 .br Error 142 .br Error 146 .br Error 147 .br Error 148 .br Error 160 .br Error 167 .br Error 168 .br Error 187 .br Error 188 .br Error 190 .br Error 436 .br Error 437 .br Error 438 .* .bp .in 0 NAME: initialize_builtin .sp 3 Function: .sp 2 .in 4 .un 4 1. It initializes the external static data block pl1_data$ that contains information about all the builtin functions. .in 0 .sp 3 Entry: .sp 2 initialize_builtin .sp 3 Usage: .sp 2 declare initialize_builtin .sp 2 call initialize_builtin; .sp 3 Programs that invoke this entry: .sp 2 none .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_data_image$builtin_name .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 write_list_ .sp 3 Include Files used: .sp 2 mask .br op_codes .br system .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: pl1_data .sp 3 Function: .sp 2 This data segment contains information of all the builtin functions. For each builtin function, it describes: the name of the builtin function; whether the builtin function will produce an aggregate result if some of its arguments are aggregates; the opcode if the builtin function is to result in an operator; the procedure to invoke if the builtin function is to result in a std_call operator; the label to transfer to in the procedure builtin; the number of arguments expected for the builtin function; and the data type expected of these arguments. .sp 2 This data segment is used extensively by the procedure builtin. .* .bp .in 0 NAME: reserve .sp 3 Function: .sp 2 .in 4 .un 4 1. This program maintains a list of names of all the library subroutines that the resulting object program may invoke. .sp 1 .un 4 2. It calls reserve$read_lib to create a token node with a specific name. .sp 1 .un 4 3. It declares the name as an entry constant. .in 0 .sp 3 Entry: .sp 2 reserve$declare_lib .sp 3 Usage: .sp 2 declare reserve$declare_lib entry ( fixed bin(15) ) returns (ptr) ; .sp 2 entry_ptr = reserve$declare_lib ( subroutine_number ); .sp 2 .in 30 .un 30 1. subroutine_number number on the reserved list for library subroutines. (input) .sp 1 .un 30 2. entry_ptr pointer to the reference node representing the entry. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br convert_chars .br lang_util_ .br operator_semantics .sp 3 Entry: .sp 2 reserve$read_lib .sp 2 This entry is used to create a token node for a specific library subroutine name. .sp 3 Usage: .sp 2 declare reserve$read_lib entry ( fixed bin(15) ) returns (ptr) ; .sp 2 token_ptr = reserve$read_lib ( subroutine_number ); .sp 2 .in 30 .un 30 1. subroutine_number number on the reserved list for library subroutines. (input) .sp 1 .un 30 2. token_ptr pointer to the token node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 compile_link .br lang_util_ .br reserve$declare_lib .sp 3 Entry: .sp 2 reserve$clear .sp 2 This entry clears the renamed_array and the declared_array used in this program. .sp 3 Usage: .sp 2 declare reserve$clear entry ( ) returns (ptr) ; .sp 2 null_ptr = reserve$clear ( ); .sp 2 .in 30 .un 30 1. null_ptr null pointer returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br parse .sp 3 Entry: .sp 2 reserve$rename_parse .sp 2 This entry is used to implement the rename option used in a procedure statement. By this option, the name of a specific library subroutine may be changed. .sp 3 Usage: .sp 2 declare reserve$rename_parse entry ( fixed bin(15), bit(1) aligned ); .sp 2 call reserve$rename_parse ( subroutine_number, success_bit ); .sp 2 .in 30 .un 30 1. subroutine_number number on the reserved list for library subroutines. (input) .sp 1 .un 30 2. success_bit bit indicating if the renaming step is successful. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br process_entry .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$root .br tree_$ .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 declared_array an array of bits to indicate whether a particular library subroutine name has already been declared as an entry constant. .sp 1 .un 20 parallel_ptr an array of pointers used to indicate the new name to use if the particular library subroutine name has been renamed in a rename option. .sp 1 .un 20 parallel_ptr_number .br a number showing an empty slot in the parallel_ptr array. .sp 1 .un 20 renamed_array an array of bits to indicate whether a particular library subroutine name has already been renamed in a rename option. .in 0 .sp 3 Programs Called: .sp 2 create_symbol .br create_token .br parse_error .br reserve$read_lib .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br boundary .br declare_type .br op_codes .br operator .br parameter .br reference .br symbol .br system .br token .br token_list .br token_types .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: defined_reference .sp 3 Function: .sp 2 .in 4 .un 4 1. Given a defined reference node and a subscript list, this procedure determines whether the defined reference is properly declared. .sp 1 .un 4 2. It forms the proper offset expression for the defined reference. .in 0 .sp 3 Entry: .sp 2 defined_reference .sp 3 Usage: .sp 2 declare defined_reference entry ( ptr, ptr, ptr, ptr, ptr, bit(36) aligned) returns (ptr); .sp 2 return_tree = defined_reference ( block_ptr, statement_ptr, input_tree, subscript_list, symbol_ptr, context_bits ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand that is to be processed by program. (input) .sp 1 .un 30 4. subscript_list pointer to the list of subscripts for this defined reference. (input) .sp 1 .un 30 5. symbol_ptr pointer to the symbol node of this defined reference. (input) .sp 1 .un 30 6. context_bits bits containing special information about this operand. (input/output) .sp 1 .un 30 7. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expand_primitive .br expression_semantics .br io_data_list_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 find .br an internal procedure to find and replace asterisks and isubs in a subscript list. .sp 1 .un 20 find_r .br an internal procedure to find and replace only isubs in a subscript list. .sp 1 .un 20 isubs_or_stars .br an internal procedure to find asterisks and isubs in the subscript list of based reference offsets and to replace and form the proper offset expression for the defined reference. .sp 1 .un 20 match .br an internal procedure to match the defined item's father against its base to determine the suitability for simple defining or isub defining. .sp 1 .un 20 print .br an internal procedure used to call the error message program semantic_translator$abort. .sp 1 .un 20 string_overlay .br an internal procedure to determine the suitability of a reference being string overlayed defining. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$eis_mode .br pl1_stat_$root .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 convert .br copy_expression .br create_operator .br create_symbol .br decbin .br declare .br declare_constant$integer .br declare_temporary .br expression_semantics .br lookup .br offset_adder .br propagate_bit .br semantic_translator$abort .br semantic_translator$error .br subscripter .br token_to_binary .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br symbol .br symbol_bits .br block .br reference .br semantic_bits .br token .br statement .br array .br list .br oO .br op_codes .br token_types .br nodes .br system .br declare_type .br boundary .sp 3 Errors Diagnosed: .sp 2 Error 77 .br Error 81 .br Error 82 .br Error 175 .br Error 176 .br Error 177 .br Error 178 .br Error 179 .br Error 181 .br Error 183 .br Error 185 .bp T_H_E__A_G_G_R_E_G_A_T_E__E_X_P_A_N_S_I_O_N_ .sp 2 Special tools are needed to handle aggregate references and aggregate expressions in a pl1 program. Aggregate references and aggregate expressions are recognized by expression_semantics. This information is transmitted back to the caller, who now recognizes that some or all of the operands of an operator are aggregates, and who will invoke expand_assign, expand_infix, or expand_prefix to do the processing depending on whether the operator is an assign operator, an infix operator or a prefix operator. .* .bp .in 0 NAME: expand_assign .sp 3 Function: .sp 2 .in 4 .un 4 1. This procedure looks at the left side and the right side of the assign operator, and transforms the operator into loop and join operators. .sp 1 .un 4 2. If the left side is already a loop operator or join operator, then expand_infix is called to merge the left side and the right side. .sp 1 .un 4 3. If the right side is a constant, it is converted into the type it represents. .sp 1 .un 4 4. If the LHS_in_RHS bit in the statement node is on, assignment must be done in two steps. .sp 1 .un 4 5. If the left side is a temporary with no data type, it is replaced with a temporary whose type and extents are given by the right side. .sp 1 .un 4 6. If an optimization can be found, the assignment is transformed into a copy_string or copy_word operator. Otherwise expand_infix is called to merge the left side and the right side. .in 0 .sp 3 Entry: .sp 2 expand_assign .sp 3 Usage: .sp 2 declare expand_assign entry ( ptr, ptr, ptr, bit (36) aligned, ptr) returns (ptr); .sp 2 return_tree = expand_assign ( block_ptr, statement_ptr, input_tree, context_bits, aggregate_reference ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .sp 1 .un 30 4. context_bits bits containing special information about this operand. (input/output) .sp 1 .un 30 5. aggregate_reference pointer to the aggregate reference node, sometimes served as the secondary return value. (output) .sp 1 .un 30 6. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expand_assign .br expression_semantics .br operator_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 declare_expression .br an internal procedure used to create a declaration which represents the result of an aggregate reference. .sp 1 .un 20 fill .br an internal procedure of fill_desc used to create assignments to descriptors to individual member or bound of an aggregate reference. .sp 1 .un 20 fill_desc .br an internal procedure used to create assignments to descriptors of an aggregate expression when used as a return value. .sp 1 .un 20 make_copy .br an internal procedure to create a copy_string operator or a copy_word operator. .sp 1 .un 20 maker .br an internal procedure to create a source like declaration of a temporary. .sp 1 .un 20 print .br an internal procedure used to call the error message program semantic_translator$abort. .sp 1 .un 20 size .br an internal procedure to determine the size of a string array temporary. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 compare_declaration .br convert .br copy_expression .br create_array .br create_bound .br create_operator .br create_statement .br create_symbol .br create_token .br declare .br declare_constant$integer .br declare_temporary .br expand_assign .br expand_infix .br expression_semantics .br refer_extent .br semantic_translator$abort .br simplify_expression .br subscriptor .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br block .br boundary .br declare_type .br decoded_token_types .br list .br nodes .br op_codes .br operator .br reference .br semantic_bits .br statement .br statement_types .br symbol .br symbol_bits .br system .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 90 .br Error 91 .br Error 93 .br Error 195 .* .bp .in 0 NAME: expand_prefix .sp 3 Function: .sp 2 .in 4 .un 4 1. It is used to expand a unary operator when its operand is an aggregate reference, or an aggregate expression. .sp 1 .un 4 2. It calls expand_primitive to expand the aggregate reference. .sp 1 .un 4 3. It calls an internal procedure to apply the unary operation to each member of the aggregate reference. .in 0 .sp 3 Entry: .sp 2 expand_prefix .sp 3 Usage: .sp 2 declare expand_prefix entry ( ptr, ptr, ptr ) returns (ptr); .sp 2 return_tree = expand_prefix ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .sp 1 .un 30 4. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expression_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 apply_prefix .br an internal procedure to apply the unary operation to each member of the aggregate expression. A call is made to operator_semantics to process the unary operators thus formed. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_operator .br expand_primitive .br operator_semantics .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br operator .br semantic_bits .br op_codes .br nodes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: expand_infix .sp 3 Function: .sp 2 .in 4 .un 4 1. It is used to expand an infix operator when some of its operands are aggregate references or aggregate expressions. .sp 1 .un 4 2. It calls expand_primitive to expand any aggregate reference. .sp 1 .un 4 3. It calls an internal procedure to locally optimize any scalar expression found in any operand. .sp 1 .un 4 4. It calls the internal procedure walk or match to apply the binary operation to the expanded operands. .in 0 .sp 3 Entry: .sp 2 expand_infix .sp 3 Usage: .sp 2 declare expand_infix entry ( ptr, ptr, ptr ) returns (ptr); .sp 2 return_tree = expand_infix ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .sp 1 .un 30 4. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expand_assign .br expression_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 match .br an internal procedure to match the expanded parts of aggregate references and to combine them. .sp 1 .un 20 simplify_scalar .br an internal procedure to extract scalar subexpressions so that it is evaluated only once outside the loop. .sp 1 .un 20 walk .br an internal procedure to walk down the loop and join operator of one aggregate reference and to apply the binary operation to the expanded member and a scalar. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$LHS .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 compare_expression .br create_operator .br create_statement .br create_symbol .br declare_temporary .br expand_primitive .br expression_semantics .br operator_semantics .br semantic_translator$abort .br share_expression .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br declare_type .br nodes .br op_codes .br operator .br reference .br semantic_bits .br statement .br statement_types .br symbol .br system .sp 3 Errors Diagnosed: .sp 2 Error 79 .* .bp .in 0 NAME: expand_primitive .sp 3 Function: .sp 2 .in 4 .un 4 1. It determines from the subscript list the number of additional subscripts that needs be created. .sp 1 .un 4 2. It calls the internal procedure expander to do the expansion. .sp 1 .un 4 3. Depending on the declaration of the aggregate reference, it returns a series of loop and join operator to represent the expansion of the aggregate reference. .in 0 .sp 3 Entry: .sp 2 expand_primitive .sp 3 Usage: .sp 2 declare expand_primitive entry ( ptr, ptr, ptr ) returns (ptr); .sp 2 return_tree = expand_primitive ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .sp 1 .un 30 4. return_tree pointer to the operand returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expand_infix .br expand_prefix .br expression_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 addf .br an internal procedure to create an add operator. .sp 1 .un 20 bit_ptr .br an internal procedure to search and replace the bit_pointer operator with the proper locator qualifier. .sp 1 .un 20 declare_index .br an internal procedure to declare a control index of the form "s.n" used in the loop operators. .sp 1 .un 20 expander .br an internal procedure to create a join operator for structure reference, and to create a loop operator for array reference. It may call itself recursively if the sublevel member of an aggregate reference is again an aggregate reference. .sp 1 .un 20 make_loop .br an internal procedure to create a loop operator. .sp 1 .un 20 process_subscripted_reference .br an internal procedure to do the semantics processing of a scalar subscripted reference produced by the expansion of the aggregate reference. .sp 1 .un 20 subf .br an internal procedure to create a sub operator. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 bindec$vs .br copy_expression .br create_bound .br create_list .br create_operator .br create_reference .br create_symbol .br create_token .br declare .br declare_constant$integer .br declare_temporary .br defined_reference .br expression_semantics .br refer_extent .br semantic_translator$abort .br share_expression .br simplify_expression .br simplify_offset .br subscripter .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br declare_type .br label .br list .br nodes .br op_codes .br operator .br reference .br semantic_bits .br symbol .br system .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 81 .* .bp .in 0 NAME: simplify_expression .sp 3 Function: .sp 2 .in 4 .un 4 1. It walks through the expression and simplify all constant expressions of the form: .in +6 constant1 + constant2 .br constant1 - constant2 .br constant1 * constant2 .in -6 .in 0 .sp 3 Entry: .sp 2 simplify_expression .sp 3 Usage: .sp 2 declare simplify_expression ( ptr, fixed bin, bit(1) aligned ) returns (ptr); .sp 2 return_tree = simplify_expression ( input_tree, constant_value, modified_bit ); .sp 2 .in 30 .un 30 1. input_tree pointer to the expression to be simplified. (input/output) .sp 1 .un 30 2. constant_value value of the expression if the entire expression can be reduced to a constant. (output) .sp 1 .un 30 3. modified_bit bit indicating if the entire expression is reduced to a constant. (output) .sp 1 .un 30 4. return_tree pointer to the modified expression. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expand_assign .br expand_primitive .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 declare_constant$integer .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br nodes .br op_codes .br operator .br reference .br symbol .br system .sp 3 Errors Diagnosed: .sp 2 none .bp S_P_E_C_I_A_L__S_T_A_T_E_M_E_N_T_S_ .sp 2 Certain operators representing allocate statements, do statements, or input/output statements undergo considerable modifications. Many new statements and operators may be created to fully implement their meaning. .* .bp .in 0 NAME: alloc_semantics .sp 3 Function: .sp 2 .in 4 .un 4 1. It transforms the allot_based and free_based operators into calls to the runtime routines alloc_, alloc_$storage, and freen_. .sp 1 .un 4 2. If the allocation reference has the control attribute, the allot_based operator is transformed into the allot_ctl operator and the free_based operator is transformed into the free_ctl operator. .sp 1 .un 4 3. If the set reference is an unaligned pointer or an offset, statements will be created after or before the call to do the conversion between the different data types. .sp 1 .un 4 4. If the allocation reference is an aggregate reference with refer_extents, statements will be created to assign the expression value to the refer reference in the refer option. .sp 1 .un 4 5. If the allocation reference has the initial attribute, the procedure expand_initial will be invoked to do the initialization of the based allocated reference. .in 0 .sp 3 Entry: .sp 2 alloc_semantics .sp 3 Usage: .sp 2 declare alloc_semantics entry ( ptr, ptr, ptr ); .sp 2 call alloc_semantics ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input/output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 operator_semantics .sp 3 Entry: .sp 2 alloc_semantics$init_only .sp 2 This entry is called by io_semantics in the processing of a locate statement. .sp 3 Usage: .sp 2 declare alloc_semantics$init_only entry ( ptr, ptr, ptr ); .sp 2 call alloc_semantics$init_only ( locator, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. locator locator qualifier of the allocation reference. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 io_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 build_assignment .br an internal procedure to create statements to assign expression values to the refer reference in a refer option. .sp 1 .un 20 getsize .br an internal procedure to get the number of storage words to be allocated or freed. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_list .br create_operator .br create_reference .br create_statement .br create_symbol .br declare_constant$integer .br declare_descriptor$ctl .br declare_pointer .br declare_temporary .br expand_initial .br expression_semantics .br operator_semantics .br propagate_bit .br refer_extent .br reserve$declare_lib .br semantic_translator$abort .br share_expression .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br array .br boundary .br list .br nodes .br operator .br op_codes .br reference .br .br semantic_bits .br statement .br statement_types .br symbol .br symbol_bits .br system .sp 3 Errors Diagnosed: .sp 2 Error 114 .br Error 115 .br Error 116 .br Error 117 .br Error 118 .* .bp .in 0 NAME: do_semantics .sp 3 Function: .sp 2 .in 4 .un 4 1. It does the semantics processing of the do statement. .sp 1 .un 4 2. If the control variable of the do statement is locator qualified, subscript qualified, or has length expressions, these qualifiers will be extracted out of the do loop to prevent their values from being reset accidentally. .sp 1 .un 4 3. Depending on the existence of to-clause, by-clause, repeat-clause, and while-clause in the do-specification, statements will be created to represent their logic. .sp 1 .un 4 4. If the do statement is a multiple specification do loop, a label variable will be created to control the flow of logic. .in 0 .sp 3 Entry: .sp 2 do_semantics .sp 3 Usage: .sp 2 declare do_semantics entry ( ptr, ptr, ptr ); .sp 2 call do_semantics ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand that is to be processed by program. (input/output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 operator_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 copy_ref .br an internal procedure to determine whether a reference should be shared. .sp 1 .un 20 make_operator .br an internal procedure to create an operator node. .sp 1 .un 20 make_statement .br an internal procedure to create a statement node. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_label .br create_list .br create_operator .br create_reference .br create_statement .br create_symbol .br create_token .br declare_integer .br declare_pointer .br free_node .br operator_semantics .br semantic_translator$abort .br share_expression .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br block .br declare_type .br label .br list .br nodes .br operator .br op_codes .br reference .br semantic_bits .br .br statement .br statement_types .br symbol .br system .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 140 .br Error 143 .br Error 144 .* .bp .in 0 NAME: io_semantics .sp 3 Function: .sp 2 .in 4 .un 4 1. io_semantics handles both the major io operators compiled by the parse as the root nodes of I/O statements, and the minor io operators (transmission operators), provided, for the most part, by io_data_list_semantics in the compilation of the data lists of get and put statements. For the handling of transmission operators, see step 15, below. .sp 1 .un 4 2. The parse attaches operands of two types to io operators: reference and expression operands from the various options of io statements, attached in canonical positions known to parse and semantics alike; and a special final operand which is, in effect, a 36 bit bitstring. This last operand has a bit position for every option and statement type recognizable by the parse; the bits are set to describe the particular statement observed by the parse and serve importantly to drive the compilation of the statement by io_semantics (see step 13). .sp 1 .un 4 3. The design of the compiled procedure provides that I/O statements are almost entirely executed out-of-line by the PL/1 runtime I/O routines, PLIO. The work of io_semantics is, then, to provide for suitable invocations of PLIO and to provide for the transfer of information between the compiled procedure and PLIO. The general design of the compiled procedure is as follows: .in +4 .sp 1 .un 4 a. each block containing an I/O statement or format statement is non-quick; that is, it has a stack frame distinct from that of its parent block (if any). .sp 1 .un 4 b. each stack frame corresponding to a block containing an I/O statement has a workspace, PS, reserved in it for use by PLIO during the execution of any I/O statement and for passing information from the compiled procedure to PLIO (and sometimes back again). .sp 1 .un 4 c. the location of this workspace is known to PL/1 operators by a convention between the code generator and the PL/1 operators; all invocations of PLIO are accomplished by PL/1 operator invocations - rather than by full PL/1 calls - the PL/1 operators pass a single argument to PLIO in every case, namely the address of PS. Accordingly, the compiled procedure must, either by direct code or with the help of the PL/1 operators, store into PS (and, occasionally, elsewhere) all information which the invoked entry in PLIO will require to complete its work. .sp 1 .in -4 .un 4 4. The work of io_semantics thus consists chiefly of compiling assignments to PS and invocations of PLIO. This is accomplished by the creation of assignment operators and of special io-operators which the code generator compiles into invocations of "transfer vector" entries in PL/1 operators. Certain of the jobs of assigning to PS are done by the code generator as part of its work in compiling the special io-operators. Some of the information that appears in PS is constant through the life of the stack frame containing the PS (for example, the stack frame pointer, the runtime symbol table pointer) and is put into PS by code supplied by the code generator on its own motion (see PLM for io_op) rather than as the compilation of operators generated by io_semantics. .sp 1 .un 4 5. Assignment to or from PS is tricky, an anomaly in the compiler. Although at runtime PS is a structure containing pointers, integers, character and bit strings, a label, etc., at compile time PS is simply an unstructured "storage block". Assignment to PS makes use of the fact that the code generator will in effect take unspec of the object being assigned and will put it, as a bit string, at a position in PS depending on the offset relative to PS. It is thus necessary to convert the object being assigned into the exact form which it will have in PS prior to assigning it to PS. Extracting information from PS (as with the string returned for a KEYTO option) requires use of a defined reference whose qualifier points at the right spot in PS. .sp 1 .un 4 6. A source_io_statement is compiled into a list of statements, as follows: .in +4 .sp 1 .un 4 a. a labelled null statement (if the source statement was labelled); .sp 1 .un 4 b. an assignment statement whose root is a join operator all but the last of whose operands are assignment operators each of which assigns an argument to its proper place in PS (or the like); and the last operand of which invokes PLIO (to do preparatory work in the stream case, to do the main work in the record case.); .sp 1 .un 4 c. in the case of most get and put statements, a list of statements implementing the implied DO's in the LIST, EDIT, or DATA option and having transmission operators for each scalar list item; .sp 1 .un 4 d. in the case of a read statement with a keyto option, a statement to assign to the target of the keyto option; .sp 1 .un 4 e. in many cases a null statement to which PLIO is to pass control if the remainder of the statement's execution is to be aborted. .sp 1 .in -4 .un 4 7. So that arguments to PLIO may be stored in the proper form and in the proper place (chiefly in PLIO), io_semantics maintains an "assign-list", of length "lal", which is a list of assign operators each of which makes such an assignment. The operators in this list are created by an internal procedure of io_semantics, assign_ps, which creates the operator and in many cases inserts conversion operators or operators to create a pointer to a given argument. .sp 1 .un 4 8. The io operator is processed as follows. First, if the io statement is labelled, a null statement is inserted after the labelled statement, and the root nodes of the labelled and null statements are interchanged so that a labelled null statement precedes an unlabelled io statement. .sp 1 .un 4 9. The length, "lal", of the "assign-list" is initialized to zero and the existence of PS is provided for. The last operand of the io-operator is converted to a 36 bit bitstring item, "job", which shows the options processed by the parse. Additional bits will be set in "job" by io_semantics and "job" will be passed to PLIO via PS where it will be interpretted as specifying the work to be done at runtime. .sp 1 .un 4 10. If a DATA, LIST, or EDIT option appears, io_data_list_semantics is called. This has the effect of appending statements after the io statement, statements which implement implied DO's, transmissions of all list elements, and the establishment of format lists. For a "get data" statement, no statements are created. Instead, a get_data_trans operator is compiled containing the list of allowed targets (a list of zero length for the source statement "get data;"); the code generator will translate this operator into a constant list of runtime symbol table offsets and the address of this constant list will be put into PS. .sp 1 .un 4 11. If the io statement is a LOCATE statement, then the reference in the statement is checked for conformance to the language, the pointer to be SET is established, and the size of the generation to be located is computed and assigned in PS. .sp 1 References to the variable to be allocated and to the pointer to be set are preserved in the local variables "locate_var" and "locate_set", respectively. The unprocessed reference to the pointer (if it appears) and to the variable to be allocated are removed from among the operands of the io operator. .sp 1 .un 4 12. The oerands now attached to the io operator are processed by expression_semantics. They are processed as, and are required to turn out to be, scalar, except in the two cases: the operands for the FROM and INTO options. .sp 1 .un 4 13. The bits of the "job" (see step 2) now drive the further processing of the operands of the io operator, the presence of the i-th bit of "job" causing the code at the label "action(i)" to be invoked relative to the appropriate operand of the io operator. In most cases the work of the code so invoked is to check the semantic correctness of the program element and then cause one or more assignments to PS (or the like) to be compiled and put on the "assign-list" (see step 7) by calling the internal procedure "assign_ps". Most of these actions require no documentation here. A few special actions will be considered. .sp 1 INTO , FROM (actions 25,27): Storage in PS of the address and bitlength of the generation appearing in the option would suffice but for two points. First, the compiler's addressing of varying strings and of arrays of varying strings has to be considered. The compiler will take the address of the first data word (i.e., the second word) of a varying string or array of varying strings; and will calculate the bitlength only on the data portion of a scalar varying string. Accordingly, bit(3) of "job" is set to indicate that the generation is varying and bit(35) of "job" is set to indicate a varying array. Second, as an optimization in consideration of the fact that the runtime I/O mechanism expects byte-aligned and byte-lengthed generations of storage, the compiler will set bit(34) of "job" to indicate that byte-alignment and byte-length of the generation must be checked at runtime; if the byte-alignment and byte-length can be assured at compile time, then this bit will not be set. .sp 1 KEYTO (action 22): The reference in the KEYTO option (the keyto target) is checked to see that it is a character string reference (pseudovariables not being allowed). An assignment statement is created before the statement following the read statement. This assignment statement will pick up the value obtained at runtime and assign it to the keyto target. A labelled null statement is then created before the statement originally following the read statement (and, thus, after the assignment statement) whose label is assigned to PS as an abnormal return label. .sp 1 OPEN (action 34): A structure, FAB2, is created in the stack frame to receive the attributes specified in the open statement. A template is created to initialize FAB2; constants for title, pagesize, and linesize are written into the template. An assignment of the template to FAB2 is placed in the "assign-list". Assignments of variable values for title, pagesize, and linesize are compiled and placed into the "assign-list". An assignment of the address of FAB2 to PS is compiled and placed in the "assign-list". .sp 1 .un 4 14. After the "job"-dictated actions are done, the "job" word is corrected for use at runtime and placed in the record_io or stream_prep operator, if any. An assignmant statement is created before the current statement (which has been made a null statement) to which is attached a join operator joining the operators in the "assign-list". .sp 1 .un 4 15. The transmission operators (see step 1), as originally created by data_list_parse and as transformed by io_data_list_semantics, are of three kinds. .sp 1 The get_data_trans operator has as its single operand a join of the references appearing in the list of the get data statement. This operator is not processed further by io_semantics. .sp 1 The put_data_trans operator is received by io_semantics with one operand, a reference containing a subscript list. io_semantics moves this subscript list to the first operand position of the put_data_trans operator. The code generator will make the runtime symbol table offset for the reference and the evaluated subscript values available at runtime. .sp 1 The remaining transmission operators, get_list_trans, put_list_trans, get_edit_trans, and put_edit_trans, are treated as a class. To each is attached a descriptor valued expression whose value describes the item being transmitted (this item is always scalar at this point, aggregates having been expanded by expand_prefix - see io_data_list_semantics). This descriptor is a trivially determined constant in the cases of numeric or pictured items, but may be complicated in the case of string items which may be adjustable, have refer extents, etc. .in 0 .sp 3 Entry: .sp 2 io_semantics .sp 3 Usage: .sp 2 declare io_semantics entry ( ptr, ptr, ptr ); .sp 2 call io_semantics ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand that is to be processed by program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expression_semantics .br operator_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 assign_ps .br an internal procedure whose princial use is the assignment with coercive conversion of some element to PS. It has been extended to do addressing and to assign to storage blocks other than PS. .sp 1 .un 20 io_semantics_util .br a dummy entry point, never called. .sp 1 .un 20 io_semantics_util$keys .br an internal procedure to extend the size of PS to 48 + 65 words long to accommodate the new key, which is declared as char(256) varying. It also sets list.element(50) to the defined new key, whose qualifier is PS|48. .sp 1 .un 20 io_semantics_util$make_fa .br an internal procedure to create a work space of 122 words to store the format stack in the use of a "get edit" or "put edit" statement. .sp 1 .un 20 io_semantics_util$make_fab2 .br an internal procedure to create a work space of 14 words to accommodate the title option, page size, and line size in an open statement. .sp 1 .un 20 io_semantics_util$make_ffsb .br an internal procedure to create a fake FSB block for the use of string option in a get statement or put statement. .sp 1 .un 20 io_semantics_util$make_ps .br an internal procedure to create a 48 word work space for the PS used by all io statements. .sp 1 .un 20 io_semantics_util$make_ssl .br an internal procedure to create a work space for the subscript list used in a "put data" statement. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$generate_symtab .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 alloc_semantics$init_only .br convert .br convert$to_target .br copy_expression .br create_label .br create_list .br create_operator .br create_reference .br create_statement .br create_symbol .br create_token .br declare .br declare_constant .br declare_constant$bit .br declare_constant$integer .br declare_descripter .br declare_temporary .br expression_semantics .br io_data_list_semantics .br ioa_ .br operator_semantics .br propagate_bit .br refer_extent .br semantic_translator$error .br share_expression .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br nodes .br block .br list .br operator .br op_codes .br semantic_bits .br symbol .br array .br system .br reference .br token .br token_types .br statement .br statement_types .br declare_type .br label .br ps_map .br symbol_bits .br boundary .sp 3 Errors Diagnosed: .sp 2 Error 62 .br Error 114 .br Error 115 .br Error 461 .br Error 462 .br Error 263 .br Error 464 .br Error 465 .br Error 466 .br Error 467 .br Error 468 .br Error 471 .br Error 472 .br Error 474 .br Error 475 .* .bp .in 0 NAME: io_data_list_semantics .sp 3 Function: .sp 2 .in 4 .un 4 1. It processes the data list of a stream-io statement. .sp 1 .un 4 2. It turns on the set bit of the symbol node for an item in a get statement data list. .sp 1 .un 4 3. It turns on the get_data bit in the block node for "get data;" or "put data;" statements. .sp 1 .un 4 4. Items in a "get data" statement data list will be put on the pl1_stat_$ok_list; .sp 1 .un 4 5. Items in a "put data" statement data list will have their symbol.put_in_symtab bit turned on. .sp 1 .un 4 6. It calls the internal procedure io_join_semantics to process the items on the data list of a "get/put list/edit" statement. .sp 1 .un 4 7. It calls the entry format_list_semantics to process the format list in a "get edit" or "put edit" statement. .in 0 .sp 3 Entry: .sp 2 io_data_list_semantics .sp 3 Usage: .sp 2 declare io_data_list_semantics entry ( ptr, ptr, ptr ); .sp 2 call io_data_list_semantics ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input/output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 io_semantics .sp 3 Entry: .sp 2 format_list_semantics .sp 2 It processes the format list of a format statement, or the format list in "get edit" or "put edit" statements. It may call itself recursively to process format items and format lists. .sp 3 Usage: .sp 2 declare format_list_semantics entry ( ptr, ptr, ptr ); .sp 2 call format_list_semantics ( block_ptr, statement_ptr, input_tree ); .sp2 .in 30 .un 30 1. block_ptr pointer to the block node containing this statement. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. input_tree pointer to the operand to be processed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expression_semantics .br io_data_list_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 down .br .br an internal procedure to turn on the set bit and the put_in_symtab bit in the symbol node and all the lower level members. .sp 1 .un 20 io_join_semantics .br The internal procedure io_join_semantics processes an item list, which may contain simple items such as references and expressions as well as complex items - implied do groups -, by creating statements and inserting them just before the statement that originally followed the io statement being compiled. These statements control the do-groups and contain the transmission operators which io_semantics later processes. The join seen by io_join_semantics contains simple items and/or do_fun operators (corresponding to implied do groups). io_join_semantics collects the maximum number of consecutive simple items, replaces each with the appropriate transmission operator containing the simple item, and creates a statement whose root node is a join containing these transmission operators (if there are more than one) or containing the transmission operator itself (if there is exactly one). Each do_fun operator is processed by the creation of a do statement containing, as its root, the do_fun operator, next followed by the result of invoking io_join_semantics recursively to process the item list associated with the do_fun operator, and finally followed by a labelled null statement whose label is associated with the do statement as if it were the associated end statement. .sp 1 .un 20 label_of_statement .br an internal procedure to create a label to attach to a null statement created by this program. .sp 1 .un 20 walk .br an internal procedure to turn on the set bit and the put_in_symtab bit in the symbol node and all its fathers and sons and brothers. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$ok_list .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 convert$to_target .br create_label .br create_list .br create_operator .br create_statement .br create_symbol .br declare_constant$integer .br declare_temporary .br defined_reference .br expression_semantics .br format_list_semantics .br make_non_quick .br semantic_translator$abort .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br nodes .br system .br mask .br reference .br block .br token .br token_types .br semantic_bits .br symbol .br declare_type .br label .br list .br op_codes .br operator .br statement .br statement_types .br ps_map .sp 3 Errors Diagnosed: .sp 2 Error 170 .br Error 171 .br Error 469 .br Error 470 .br Error 473  Chapter8.runoff 09/05/74 1139.9r w 09/05/74 1134.4 808029 .m1 6 .m2 0 .m3 4 .m4 6 .ms 1 .ad .ar .fo 1 "DRAFT: SUBJECT TO CHANGE"%sec%-%"order number" .sr sec 8 .sp 7 .ce 1 SECTION VIII .sp 2 .ce 1 UTILITY PROGRAMS .sp 4 A_N__O_V_E_R_V_I_E_W_ .sp 2 The procedures described in this section deals with many of the utility functions not limited to use by any phase of the compiler. .bp N_O_D_E__M_A_N_A_G_E_M_E_N_T__P_R_O_G_R_A_M_S_ .sp 2 The scheme used for the allocation and freeing of the nodes used by the compiler is simple. When a node is needed, it is allocated in the tree_$ segment -- sometimes in the xeq_tree_$ segment. When a node is to be freed, generally no action is taken. But because of the frequency of allocating and freeing certain nodes like the operator node (2 or 3 operands), list node (2 or 3 elements), reference node, and statement node, a pool is maintained to keep track of the freed nodes. On subsequent allocation of the same type of node, this pool is examined for the existence of a freed and reuseable node before attempting to allocate a fresh node in the tree_$ segment (or xeq_tree_$ segment). .* .bp .in 0 NAME: create_block .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a block node. .in 0 .sp 3 Entry: .sp 2 create_block .sp 3 Usage: .sp 2 declare create_block entry ( bit(9) aligned, ptr ) returns (ptr) ; .sp 2 block_ptr = create_block ( block_type, father_block_ptr ); .sp 2 .in 30 .un 30 1. block_type type of block node to be created. (input) .sp 1 .un 30 2. father_block_ptr pointer to the block node containing this block. (input) .sp 1 .un 30 3. block_ptr pointer to the block node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 code_generator .br lang_util_ .br on_parse .br parse .br prepare_symbol_table .br procedure_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .br pl1_stat_$statement_id .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br block .br block_types .br nodes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_statement .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a statement node. .in 0 .sp 3 Entry: .sp 2 create_statement .sp 3 Usage: .sp 2 declare create_statement entry ( bit(9) aligned, ptr, ptr, bit(12) aligned ) returns (ptr); .sp 2 statement_ptr = create_statement ( statement_type, father_ptr, label_ptr, conditions ); .sp 2 .in 30 .un 30 1. statement_type type of statement to be created. (input) .sp 1 .un 30 2. father_ptr either a pointer to the block node containing this statement, or a pointer to the statement node preceding this statement. (input) .sp 1 .un 30 3. label_ptr pointer to the list of labels for this statement. (input) .sp 1 .un 30 4. conditions conditions for this statement. (input) .sp 1 .un 30 5. statement_ptr pointer to the statement node created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br code_generator .br declare_descriptor .br declare_parse .br default_parse .br do_parse .br do_semantics .br expand_assign .br expand_infix .br expand_initial .br function .br if_parse .br io_data_list_semantics .br io_semantics .br io_statement_parse .br lang_util_ .br on_parse .br operator_semantics .br prepare_symbol_table .br procedure_parse .br process_entry .br statement_parse .br statement_recognizer .sp 3 Entry: .sp 2 create_statement$prologue .sp 2 This entry is used to create a statement node in the prologue sequence instead of the main sequence of the block. .sp 3 Usage: .sp 2 declare create_statement$prologue entry ( bit(9) aligned, ptr, ptr, bit(12) aligned ) returns (ptr); .sp 2 statement_ptr = create_statement$prologue ( statement_type, father_ptr, label_ptr, conditions ); .sp 2 .in 30 .un 30 1. statement_type type of statement to be created. (input) .sp 1 .un 30 2. father_ptr either a pointer to the block node containing this statement, or a pointer to the statement node preceding this statement. (input) .sp 1 .un 30 3. label_ptr pointer to the list of labels for this statement. (input) .sp 1 .un 30 4. conditions conditions for this statement. (input) .sp 1 .un 30 5. statement_ptr pointer to the statement node created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare .br declare_descriptor .br declare_structure .br expand_initial .br get_array_size .br get_size .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br pl1_stat_$tree_ptr .br pl1_stat_$node_uses .br pl1_stat_$source_seg .br pl1_stat_$st_length .br pl1_stat_$st_start .br pl1_stat_$statement_id .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br xeq_tree_$ .sp 3 Include Files used: .sp 2 rename_xeq .br token_list .br label .br reference .br list .br statement .br block .br nodes .br statement_types .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_operator .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes an operator node. .in 0 .sp 3 Entry: .sp 2 create_operator .sp 3 Usage: .sp 2 declare create_operator entry ( bit(9) aligned, fixed bin(15) ) returns (ptr); .sp 2 operator_ptr = create_operator ( op_code, arg_number ); .sp 2 .in 30 .un 30 1. op_code operator code for this operator. (input) .sp 1 .un 30 2. arg_number number of arguments for this operator. (input) .sp 1 .un 30 3. operator_ptr pointer to the operator node created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br attribute_parse .br builtin .br convert .br copy_expression .br data_list_parse .br declare .br declare_descriptor .br declare_structure .br defined_reference .br do_parse .br do_semantics .br evaluate .br expand_assign .br expand_infix .br expand_initial .br expand_prefix .br expand_primitive .br expression_parse .br expression_semantics .br format_list_parse .br function .br generic_selector .br get_array_size .br get_size .br if_parse .br io_data_list_semantics .br io_semantics .br io_statement_parse .br lang_util_ .br offset_adder .br on_parse .br operator_semantics .br prepare_symbol_table .br procedure_parse .br process_entry .br reference_parse .br simplify_offset .br statement_parse .br subscripter .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$tree_ptr .br pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br xeq_tree_$ .sp 3 Include Files used: .sp 2 rename_xeq .br operator .br nodes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_reference .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a reference node. .in 0 .sp 3 Entry: .sp 2 create_reference .sp 3 Usage: .sp 2 declare create_reference entry ( ptr ) returns (ptr); .sp 2 reference_ptr = create_reference ( token_ptr ); .sp 2 .in 30 .un 30 1. token_ptr pointer to the token node or symbol node for this reference (input) .sp 1 .un 30 2. reference_ptr pointer to the reference node created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br code_generator .br copy_expression .br declare_descriptor .br do_semantics .br expand_initial .br expand_primitive .br expression_semantics .br fill_refer .br function .br get_reference .br io_semantics .br lang_util_ .br operator_semantics .br refer_extent .br reference_parse .br share_expression .br statement_parse .br statement_type .sp 3 Entry: .sp 2 create_reference$for_symbol .sp 2 This entry is called so that the reference node created will be allocated in the xeq_tree_ segment instead of the tree_ segment. .sp 3 Usage: .sp 2 declare create_reference entry ( ptr ) returns (ptr) ; .sp 2 reference_ptr = create_reference ( token_ptr ); .sp 2 .in 30 .un 30 1. token_ptr pointer to the token node or symbol node for this reference. (input) .sp 1 .un 30 2. reference_ptr pointer to the reference node created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 create_symbol .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$free_ptr .br pl1_stat_$node_uses .br xeq_tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br nodes .br reference .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_token .sp 3 Function: .sp 2 .in 4 .un 4 1. It prepares to create a token node for the token represented by the given string. .sp 1 .un 4 2. It tries to find the token node in the hash table. .sp 1 .un 4 3. If it succeeds, it returns the pointer to the token node found. .sp 1 .un 4 4. If it fails, it creates a new token node, puts the pointer in the appropriate slot in the hash table, and returns. .in 0 .sp 3 Entry: .sp 2 create_token .sp 3 Usage: .sp 2 declare create_token entry ( char (*) aligned, bit (9) aligned ) returns (ptr) ; .sp 2 token_ptr = create_token ( token_string, token_type ); .sp 2 .in 30 .un 30 1. token_string string for which the token is made. (input) .sp 1 .un 30 2. token_type type of token to be created. (input) .sp 1 .un 30 3. token_ptr pointer to the token node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br builtin .br convert .br create_identifier .br declare_parse .br descriptor_parse .br do_semantics .br evaluate .br expand_assign .br expand_initial .br expand_primitive .br expression_parse .br expression_semantics .br initialize_int_static .br io_semantics .br io_statement_parse .br lang_util_ .br lex .br merge_attributes .br on_parse .br operator_semantics .br parse .br process_entry .br reserve .br statement_type .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$hash_table .br pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br nodes .br token .br create_token .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_symbol .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a symbol node. .in 0 .sp 3 Entry: .sp 2 create_symbol .sp 3 Usage: .sp 2 declare create_symbol entry ( ptr, ptr, bit(3) aligned ) returns (ptr); .sp 2 symbol_ptr = create_symbol ( block_ptr, token_ptr, create_type ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this symbol. (input) .sp 1 .un 30 2. token_ptr pointer to the token node for which the symbol node is created. (input) .sp 1 .un 30 3. create_type bits indicating whether the symbol node is created by declaration, by context, by implication, or by the compiler. (input) .sp 1 .un 30 4. symbol_ptr pointer to the symbol node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br context_processor .br copy_expression .br declare_constant .br declare_descriptor .br declare_integer .br declare_parse .br declare_pointer .br declare_temporary .br default_parse .br defined_reference .br descriptor_parse .br do_semantics .br expand_assign .br expand_infix .br expand_initial .br expand_primitive .br expression_semantics .br format_list_parse .br function .br generate_constant .br generic_selector .br get_variable .br io_data_list_semantics .br io_semantics .br io_statement_parse .br lang_util_ .br on_parse .br operator_semantics .br process_entry .br reference_parse .br reserve .br statement_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$free_ptr .br pl1_stat_$node_uses .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_identifier .br create_reference$for_symbol .br pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br symbol .br block .br token_list .br nodes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_context .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a context node. .in 0 .sp 3 Entry: .sp 2 create_context .sp 3 Usage: .sp 2 declare create_context entry ( ptr, ptr ) returns (ptr); .sp 2 context_ptr = create_context ( block_ptr, token_ptr ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containging this token. (input) .sp 1 .un 30 2. token_ptr pointer to the token node for which the context is to be recorded. (input) .sp 1 .un 30 3. context_ptr pointer to the context node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 context .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br context .br nodes .br block .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_array .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes an array node. .in 0 .sp 3 Entry: .sp 2 create_array .sp 3 Usage: .sp 2 declare create_array entry ( ) returns (ptr); .sp 2 array_ptr = create_array ( ); .sp 2 .in 30 .un 30 1. array_ptr pointer to the array node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br copy_expression .br expand_assign .br expand_initial .br function .br get_array_size .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br nodes .br array .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_bound .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a bound node. .in 0 .sp 3 Entry: .sp 2 create_bound .sp 3 Usage: .sp 2 declare create_array entry ( ) returns (ptr); .sp 2 array_ptr = create_array ( ); .sp 2 .in 30 .un 30 1. array_ptr pointer to the array node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br copy_expression .br expand_assign .br expand_initial .br expand_primitive .br function .br get_array_size .br lang_util_ .br subscripter .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br nodes .br array .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_list .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a list node. .in 0 .sp 3 Entry: .sp 2 create_list .sp 3 Usage: .sp 2 declare create_list entry ( fixed bin(15) ) returns (ptr); .sp 2 list_ptr = create_list ( number ); .sp 2 .in 30 .un 30 1. number number of elements for this list node. (input) .sp 1 .un 30 2. list_ptr pointer to the list node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br assign_storage .br attribute_parse .br builtin .br check_o_and_s .br compile_entry .br compile_statement .br convert_chars .br copy_expression .br declare .br descriptor_parse .br do_parse .br do_semantics .br expand_initial .br expand_primitive .br expression_semantics .br function .br gen_pl1_linkage .br get_reference .br if_parse .br io_data_list_semantics .br io_semantics .br lang_util_ .br mst .br name_assign .br on_parse .br operator_semantics .br optimizer .br process_entry .br reference_parse .br statement_parse .br statement_type .br subscripter .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$free_ptr .br pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br xeq_tree_$ .sp 3 Include Files used: .sp 2 rename .br nodes .br list .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_default .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a default node. .in 0 .sp 3 Entry: .sp 2 create_default .sp 3 Usage: .sp 2 declare create_default entry ( ) returns (ptr); .sp 2 default_ptr = create_default ( ); .sp 2 .in 30 .un 30 1. default_ptr pointer to the default node created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 default_parse .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br default .br nodes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_label .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a label node. .in 0 .sp 3 Entry: .sp 2 create_label .sp 3 Usage: .sp 2 declare create_label entry ( ptr, ptr, bit(3) aligned ); .sp 2 label_ptr = ( block_ptr, token_ptr, create_type ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this label. (input) .sp 1 .un 30 2. token_ptr pointer to the token node for which the label node is created. (input) .sp 1 .un 30 3. create_type bits indicating whether the label node is created by declaration, by context, by implication, or by the compiler. (input) .sp 1 .un 30 4. label_ptr pointer to the label node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 code_generator .br compile_block .br compile_statement .br compile_tree .br convert_chars .br declare_label .br do_parse .br do_semantics .br expand_initial .br if_parse .br io_data_list_semantics .br io_semantics .br lang_util_ .br operator_semantics .br set_indicators .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .br pl1_stat_$statement_id .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_identifier .br pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br nodes .br block .br label .br token_list .br token .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_cross_reference .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates and initializes a cross_reference node. .in 0 .sp 3 Entry: .sp 2 create_cross_reference .sp 3 Usage: .sp 2 declare create_cross_reference entry ( ) returns (ptr); .sp 2 cross_reference_ptr = create_cross_reference ( ); .sp 2 .in 30 .un 30 1. cross_reference_ptr pointer to the cross_reference node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 expand_initial .br expression_semantics .br lang_util_ .br lookup .br process_entry .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .br cross_reference .br nodes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_identifier .sp 3 Function: .sp 2 .in 4 .un 4 1. It fabricates a compiler-created unique name. .sp 1 .un 4 2. It creates a token node for that name. .in 0 .sp 3 Entry: .sp 2 create_identifier .sp 3 Usage: .sp 2 declare create_identifier entry ( ) returns (ptr); .sp 2 token_ptr = create_identifier ( ); .sp 2 .in 30 .un 30 1. token_ptr pointer to the token node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 create_label .br create_symbol .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$compiler_created_index .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 bindec$vs .br create_token .sp 3 Include Files used: .sp 2 token_types .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: create_storage .sp 3 Function: .sp 2 .in 4 .un 4 1. It allocates a block of words. .in 0 .sp 3 Entry: .sp 2 create_storage .sp 3 Usage: .sp 2 declare create_storage entry ( fixed bin ) returns (ptr); .sp 2 storage_ptr = create_storage ( number ); .sp 2 .in 30 .un 30 1. number number of words to be allocated. (input) .sp 1 .un 30 2. storage_ptr pointer to the block of storage returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_constant .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$node_uses .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 pl1_get .br tree_$ .sp 3 Include Files used: .sp 2 rename .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: pl1_get .sp 3 Function: .sp 2 .in 4 .un 4 1. It calls tree_manager$get_free to get a free area. .in 0 .sp 3 Entry: .sp 2 pl1_get .sp 3 Usage: .sp 2 declare pl1_get entry ( fixed bin(15), ptr ) returns (ptr); .sp 2 return_ptr = pl1_get ( size, area_ptr ); .sp 2 .in 30 .un 30 1. size number of words to be allocated. (input) .sp 1 .un 30 2. area_ptr pointer to the area inside which space is to be allocated. (input) .sp 1 .un 30 3. return_ptr pointer to the space just allocated. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 assign_storage .br cg_error .br compile_formats .br copy_temp .br create_array .br create_block .br create_bound .br create_context .br create_cross_reference .br create_default .br create_label .br create_list .br create_operator .br create_reference .br create_statement .br create_storage .br create_symbol .br create_token .br e_v .br generate_constant .br lang_util_ .br lex .br mst .br pl1_signal_catcher .br stack_temp .br state_man .sp 3 Entry: .sp 2 pl1_put .sp 2 This entry is used for freeing an area. But currently this entry does nothing. .sp 3 Usage: .sp 2 declare pl1_put entry; .sp 2 call pl1_put; .sp 3 Programs that invoke this entry: .sp 2 none .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 none .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: tree_manager .sp 3 Function: .sp 2 .in 4 .un 4 1. It manages the use of multiple free storage segments used by the compiler during compilation. .in 0 .sp 3 Entry: .sp 2 tree_manager$init .sp 2 It creates a tree_$ segment, and a xeq_tree_$ segment. .sp 3 Usage: .sp 2 declare tree_manager$init entry ( label ); .sp 2 call tree_manager$init ( abort_label ); .sp 2 .in 30 .un 30 1. abort_label label indicating where the transfer is to go if all the storage space is exhausted. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br v2pl1 .sp 3 Entry: .sp 2 tree_manager$truncate .sp 2 It truncates the tree_$ segment as well as the xeq_tree_$ segment. .sp 3 Usage: .sp 2 declare tree_manager$truncate entry ( ); .sp 2 call tree_manager$truncate; .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br v2pl1 .sp 3 Entry: .sp 2 tree_manager$get_free .sp 2 This entry makes a call to the Multics system routine hcs_$make_seg to allocate a free segment in the process directory of the user. .sp 3 Usage: .sp 2 declare tree_manager$get_free entry ( fixed bin(24), ptr, ptr ); .sp 2 call tree_manager$get_free ( size, area_ptr, unused_ptr ); .sp 2 .in 30 .un 30 1. size number of words to be allocated. (input) .sp 1 .un 30 2. area_ptr pointer to the area inside which space is to be allocated. (input) .sp 1 .un 30 3. unused_ptr dummy argument, currently not being used for any purpose. .in 0 .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$condition_index .br pl1_stat_$free_ptr .br pl1_stat_$root .br pl1_stat_$source_list_ptr .br pl1_stat_$tree_vec_index .br tree_$tree_ .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 abort_label label indicating where the transfer is to go if all the free segments are exhausted. .sp 1 .un 20 tree_vec array of pointers to the free segments it has allocated. .sp 1 .un 20 xeq_ptr pointer to the xeq_tree area it has allocated. .in 0 .sp 3 Programs Called: .sp 2 hcs_$make_seg .br hcs_$truncate_seg .br ioa_ .sp 3 Include Files used: .sp 2 source_list .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: free_node .sp 3 Function: .sp 2 .in 4 .un 4 1. Given a pointer to a node, it will determine the type of node to be freed. .sp 1 .un 4 2. If the node is an operator node, a list node, a reference node, or a symbol node, the node will be saved on a free-list. Future creations of the same type of node can pick it up from the free-list, without having to allocate a new node. .in 0 .sp 3 Entry: .sp 2 free_node .sp 3 Usage: .sp 2 declare free_node entry ( ptr ); .sp 2 call free_node ( node_ptr ); .sp 2 .in 30 .un 30 1. node_ptr pointer to the node to be freed by this program. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_parse .br default_parse .br do_parse .br do_semantics .br expression_semantics .br format_list_parse .br lang_util_ .br offset_adder .br on_parse .br operator_semantics .br optimizer .br prepare_symbol_table .br simplify_offset .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$free_ptr .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 rename .br nodes .br symbol .br token .br block .br statement .br reference .br array .br list .br context .br label .br operator .sp 3 Errors Diagnosed: .sp 2 none .bp V_A_R_I_A_B_L_E__A_N_D__C_O_N_S_T_A_N_T__C_R_E_A_T_I_O_N__P_R_O_G_R_A_M_S_ .sp 2 It is often necessary for the compiler to declare a constant or a variable with some specific attributes to facilitate the processing of other references and expressions. This function is accomplished by the following procedures. .* .bp .in 0 NAME: declare_integer .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates a symbol node and makes a fixed binary real declaration of default precision and automatic storage class. .in 0 .sp 3 Entry: .sp 2 declare_integer .sp 3 Usage: .sp 2 declare declare_integer entry ( ptr ); .sp 2 return_ptr = declare_integer ( block_ptr ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node for which the integer is declared. (input) .sp 1 .un 30 2. return_ptr pointer to the reference node representing the integer declared by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br declare .br do_semantics .br expand_initial .br get_array_size .br get_size .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 .br .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_symbol .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br boundary .br declare_type .br symbol .br system .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: declare_pointer .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates a symbol node and makes apointer declare_constantl withautomatic storage class. .in 0 .sp 3 Entry: .sp 2 declare_pointer .sp 3 Usage: .sp 2 declare declare_pointer .sp 2 return_ptr = declare_pointer ( block_ptr ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node for which the pointer is declare. (input) .sp 1 .un 30 2. return_ptr pointer to the reference node representing the pointer declared by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br declare .br declare_descriptor .br declare_structure .br do_semantics .br expand_initial .br lang_util_ .br prepare_symbol_table .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_symbol .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br boundary .br declare_type .br symbol .br system .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: declare_temporary .sp 3 Function: .sp 2 .in 4 .un 4 1. It searches through the list of temporary nodes already created for an identical declaration. If the search is successful, that temporary will be returned. .sp 1 .un 4 2. If the search fails, it creates a symbol node and makes a new declaration with temporary storage class. .sp 1 .un 4 3. The new temporary node created witll be chained onto the list of temporary nodes. .in 0 .sp 3 Entry: .sp 2 declare_temporary .sp 3 Usage: .sp 2 declare declare_temporary entry ( bit(36) aligned, fixed bin(31), fixed bin(15), ptr ) returns (ptr) ; .sp 2 return_ptr = declare_temporary ( data_type, precision, scale, length ); .sp 2 .in 30 .un 30 1. data_type data type of the temporary. (input) .sp 1 .un 30 2. precision precision of the temporary if the data type is arithmetic, otherwise the string length. (input) .sp 1 .un 30 3. scale scale of the temporary if the data type is arithmetic. (input) .sp 1 .un 30 4. length length expression of the string if the data type is a string. (input) .sp 1 .un 30 5. return_ptr pointer to the reference node representing the temporary. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br convert .br decimal_op .br declare_descriptor .br defined_reference .br expand_assign .br expand_infix .br expand_primitive .br function .br io_data_list_semantics .br io_semantics .br lang_util_ .br operator_semantics .br prepare_symbol_table .br simplify_offset .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$temporary_list .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_symbol .br get_size .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br symbol .br boundary .br mask .br reference .br declare_type .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: declare_label .sp 3 Function: .sp 2 .in 4 .un 4 1. Given a list of labels, this program will get the token representing each label. .sp 1 .un 4 2. For each token, if a declaration has already been made, it will check if the attributes are consistent. For constant label arrays, it will update the high bound and the low bound. .sp 1 .un 4 3. If no declaration has been made, a label node will be created. .in 0 .sp 3 Entry: .sp 2 declare_label .sp 3 Usage: .sp 2 declare declare_label entry ( ptr, ptr, ptr, bit(3) aligned ); .sp 2 call declare_label ( block_ptr, statement_ptr, label_ptr, declare_type ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this label. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this label. (input) .sp 1 .un 30 3. label_ptr pointer to the list node of labels. (input) .sp 1 .un 30 4. declare_type bits indicating whether the declare is by context, by implicating, or by the compiler. .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_parse .br default_parse .br do_parse .br if_parse .br io_statement_parse .br on_parse .br procedure_parse .br statement_parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_label .br parse_error .br token_to_binary .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br block .br label .br list .br nodes .br reference .br token .sp 3 Errors Diagnosed: .sp 2 Error 31 .br Error 54 .* .bp .in 0 NAME: declare_descriptor .sp 3 Function: .sp 2 .in 4 .un 4 1. It creates a descriptor for the argument of a call. .sp 1 .un 4 2. It determines if the descriptor has already been made for the argument. .sp 1 .un 4 3. It creates a parameter descriptor pointer if necessary. .in 0 .sp 3 Entry: .sp 2 declare_descriptor .sp 3 Usage: .sp 2 declare declare_descriptor entry ( ptr, ptr, ptr, ptr, bit(1) aligned ) returns (ptr) ; .sp 2 descriptor_ptr = declare_descriptor ( block_ptr, statement_ptr, symbol_ptr, locator_qualifier, array_descriptor_bit ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this declaration. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. symbol_ptr pointer to the symbol node for which the descriptor is to be made. (input) .sp 1 .un 30 4. locator_qualifier locator qualifier expression for this operand. (input) .sp 1 .un 30 5. array_descriptor_bit bit indicating if an array descriptor is required. (input) .sp 1 .un 30 6. descriptor_ptr pointer to the descriptor created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br declare .br declare_structure .br function .br io_semantics .br lang_util_ .sp 3 Entry: .sp 2 declare_descriptor$ctl .sp 2 This special entry point is used to make assignments to controlled descriptors at allocation time. .sp 3 Usage: .sp 2 declare declare_descriptor$ctl entry ( ptr, ptr, ptr, ptr, bit(1) aligned ) returns (ptr) ; .sp 2 descriptor_ptr = declare_descriptor$ctl ( block_ptr, statement_ptr, symbol_ptr, locator_qualifier, array_descriptor_bit ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this declaration. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. symbol_ptr pointer to the symbol node for which the descriptor is to be made. (input) .sp 1 .un 30 4. locator_qualifier locator qualifier expression for this operand. (input) .sp 1 .un 30 5. array_descriptor_bit bit indicating if an array descriptor is required. (input) .sp 1 .un 30 6. descriptor_ptr pointer to the descriptor created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br lang_util_ .sp 3 Entry: .sp 2 declare_descriptor$param .sp 2 This entry point is used to indicate that all the extents and bounds have already been computed by get_size. .sp 3 Usage: .sp 2 declare declare_descriptor$param entry ( ptr, ptr, ptr, ptr, bit(1) aligned ) returns (ptr) ; .sp 2 descriptor_ptr = declare_descriptor$param ( block_ptr, statement_ptr, symbol_ptr, locator_qualifier, array_descriptor_bit ); .sp 2 .in 30 .un 30 1. block_ptr pointer to the block node containing this declaration. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this operand. (input) .sp 1 .un 30 3. symbol_ptr pointer to the symbol node for which the descriptor is to be made. (input) .sp 1 .un 30 4. locator_qualifier locator qualifier expression for this operand. (input) .sp 1 .un 30 5. array_descriptor_bit bit indicating if an array descriptor is required. (input) .sp 1 .un 30 6. descriptor_ptr pointer to the descriptor created by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_ .br declare_structure .br lang_util_ .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 assignf .br an internal procedure to create a statement for the assignment to the descriptor. .sp 1 .un 20 assignm .br an internal procedure to create a statement for generating multiplier assignments to controlled descriptors. .sp 1 .un 20 builder .br an internal procedure to build a descriptor from the symbol node. .sp 1 .un 20 copy .br an internal procedure to call copy_expression for a reference node if the reference node has offset expression, length expression, or qualifier expression. .sp 1 .un 20 set_star .br an internal procedure to propagate the star_extents bit upward. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$util_abort .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_operator .br create_reference .br create_statement .br create_statement$prologue .br create_symbol .br declare_constant$desc .br declare_constant$integer .br declare_pointer .br declare_temporary .br expression_semantics .br refer_extent .br token_to_binary .sp 3 Include Files used: .sp 2 semant .br language_utility .br source_id_descriptor .br semantic_bits .br symbol .br array .br reference .br statement .br block .br operator .br statement_types .br op_codes .br system .br declare_type .br boundary .br nodes .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 28 .br Error 29 .* .bp .in 0 NAME: declare_picture .sp 3 Function: .sp 2 .in 4 .un 4 1. It calls picture_info_ to ascertain that the picture string is valid. .sp 1 .un 4 2. It fills in the attributes of the picture as determined by picture_info_. .sp 1 .un 4 3. It declares the picture_constant, and puts it in symbol.general. .in 0 .sp 3 Entry: .sp 2 declare_picture .sp 3 Usage: .sp 2 declare declare_picture entry ( char(*) aligned, ptr, fixed bin(15) ); .sp 2 call declare_picture ( picture_string, symbol_ptr, error_code ); .sp 2 .in 30 .un 30 1. picture_string character string representing the picture. (input) .sp 1 .un 30 2. symbol_ptr pointer to the symbol node with the picture attribute. (input) .sp 1 .un 30 3. error_code error number returned by picture_info_. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 format_list_parse .br get_size .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 declare_constant$bit .br picture_info_ .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br picutre_constant .br picutre_image .br picutre_types .br reference .br symbol .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: declare_constant .sp 3 Function: .sp 2 .in 4 .un 4 1. It computes the boundary requirement and the bit size needed to declare the constant. .sp 1 .un 4 2. It searches throught the chain of constants to find a constant with the same value. .sp 1 .un 4 3. It creates a new symbol node to represent the value if no other constant has the same value. .sp 1 .un 4 4. If another constant value can be found but with different attributes, then an equivalence declaration will be made. .sp 1 .un 4 5. The new constant will be linked to the constant chain. .in 0 .sp 3 Entry: .sp 2 declare_constant .sp 3 Usage: .sp 2 declare declare_constant entry ( bit(*) aligned, bit(36) aligned, fixed bin(31), fixed bin(15) ) returns (ptr) ; .sp 2 return_ptr = declare_constant ( value, data_type, precision, scale ); .sp 2 .in 30 .un 30 1. value value of the constant to be declared. (input) .sp 1 .un 30 2. data_type data type of the constant. (input) .sp 1 .un 30 3. precision precision of the constant if the data type is arithmetic, otherwise the string length. (input) .sp 1 .un 30 4. scale scale of the constant if the data type is fixed. (input) .sp 1 .un 30 5. return_ptr pointer to the reference node representing the constant declared by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br convert .br declare_constant .br io_semantics .br lang_util_ .br operator_semantics .sp 3 Entry: .sp 2 declare_constant$bit .sp 2 This entry is used to declare a bit string constant. .sp 3 Usage: .sp 2 declare declare_constant$bit entry ( bit(*) aligned ) returns (ptr) ; .sp 2 return_ptr = declare_constant$bit ( bit_string ); .sp 2 .in 30 .un 30 1. bit_string bit string value of the constant to be declared. (input) .sp 1 .un 30 2. return_ptr pointer to the reference node representing the bit constant declared by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br declare_picture .br expand_initial .br io_semantics .br lang_util_ .sp 3 Entry: .sp 2 declare_constant$char .sp 2 This entry is used to declare a character string constant. .sp 3 Usage: .sp 2 declare declare_constant$char entry ( char(*) aligned ) returns (ptr) ; .sp 2 return_ptr = declare_constant$char ( char_string ); .sp 2 .in 30 .un 30 1. char_string char string value of the constant to be declared. (input) .sp 1 .un 30 2. return_ptr pointer to the reference node representing the character constant declared by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br declare .br expand_initial .br lang_util_ .sp 3 Entry: .sp 2 declare_constant$desc .sp 2 This entry is used to declare a constant descriptor. .sp 3 Usage: .sp 2 declare declare_constant$desc entry ( bit(*) aligned ) returns (ptr) ; .sp 2 return_ptr = declare_constant$desc ( desc_bit_string ); .sp 2 .in 30 .un 30 1. desc_bit_string bit string value of the descriptor constant to be declared. (input) .sp 1 .un 30 2. return_ptr pointer to the reference node representing the descriptor constant declared by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 declare_descriptor .br lang_util_ .sp 3 Entry: .sp 2 declare_constant$integer .sp 2 This entry is used to declare a fixed binary constant. .sp 3 Usage: .sp 2 declare declare_constant$integer entry ( fixed bin(31) ) returns (ptr) ; .sp 2 return_ptr = declare_constant$integer ( value ); .sp 2 .in 30 .un 30 1. value value of the integer constant to be declared. (input) .sp 1 .un 30 2. return_ptr pointer to the reference node representing the integer constant declared by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br declare .br declare_descriptor .br declare_structure .br defined_reference .br expand_assign .br expand_initial .br expand_primitive .br function .br get_array_size .br get_size .br io_data_list_semantics .br io_semantics .br lang_util_ .br offset_adder .br operator_semantics .br prepare_symbol_table .br simplify_offset .br subscripter .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$constant_list .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 create_storage .br create_symbol .br declare_constant .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br symbol .br reference .br system .br boundary .br declare_type .sp 3 Errors Diagnosed: .sp 2 none .bp C_O_N_V_E_R_S_I_O_N__P_R_O_G_R_A_M_S_ .sp 2 Conversion between data types is done by the following utility procedures. .* .bp .in 0 NAME: convert .sp 3 Function: .sp 2 .in 4 .un 4 1. It gets the input type, input precision, and input scale. .sp 1 .un 4 2. It gets the output type; and output precision and output scale if possible. .sp 1 .un 4 3. It checks the validity of this attempted conversion. .sp 1 .un 4 4. If the input and the output have identical data types, no conversion is done. .sp 1 .un 4 5. If the input is not a constant, an assign operator will be created, so that conversion will be done at run time. .sp 1 .un 4 6. If the input is a constant, conversion is done at compile time. .in 0 .sp 3 Entry: .sp 2 convert .sp 3 Usage: .sp 2 declare convert entry ( ptr, bit(36) aligned ) returns (ptr) ; .sp 2 return_ptr = convert ( input_tree, target_type ); .sp 2 .in 30 .un 30 1. input_tree operand to be converted by this program. (input) .sp 1 .un 30 2. target_type data type to which the operand is to be converted. (input) .sp 1 .un 30 3. return_ptr pointer to the result returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br defined_reference .br expand_assign .br expression_semantics .br io_semantics .br lang_util_ .br operator_semantics .br semantic_translator .sp 3 Entry: .sp 2 convert$from_builtin .sp 2 This entry is used to suppress warning diagnostics that may normally be given, because the user does an explicit conversion using a builtin function. .sp 3 Usage: .sp 2 declare convert$from_builtin entry ( ptr, bit(36) aligned ) returns (ptr) ; .sp 2 return_ptr = convert$from_builtin ( input_tree, target_type ); .sp 2 .in 30 .un 30 1. input_tree operand to be converted by this program. (input) .sp 1 .un 30 2. target_type data type to which the operand is to be converted. (input) .sp 1 .un 30 3. return_ptr pointer to the result returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br lang_util_ .sp 3 Entry: .sp 2 convert$to_integer .sp 2 This entry is used to convert an operand to a fixed binary integer value with no scale factors. .sp 3 Usage: .sp 2 declare convert$to_integer entry ( ptr, bit(36) aligned ) returns (ptr) ; .sp 2 return_ptr = convert$to_integer ( input_tree, target_type ); .sp 2 .in 30 .un 30 1. input_tree operand to be converted by this program. (input) .sp 1 .un 30 2. target_type data type to which the operand is to be converted. (input) .sp 1 .un 30 3. return_ptr pointer to the result returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expression_semantics .br lang_util_ .br simplify_offset .br subscripter .sp 3 Entry: .sp 2 convert$to_target .sp 2 This entry is used to convert an operand to the data type, precision, scale or length specified by a target declaration. .sp 3 Usage: .sp 2 declare convert$to_target entry ( ptr, ptr ) returns (ptr) ; .sp 2 return_ptr = convert$to_target ( input_tree, target_reference ); .sp 2 .in 30 .un 30 1. input_tree operand to be converted by this program. (input) .sp 1 .un 30 2. target_reference pointer to the target reference node. (input) .sp 1 .un 30 3. return_ptr pointer to the result returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br expression_semantics .br io_data_list_semantics .br io_semantics .br lang_util_ .br operator_semantics .sp 3 Entry: .sp 2 convert$to_target_fb .sp 2 This entry is used to suppress warning diagnostics that may normally be given when an operand is converted to the data type, precision, scale or length specified by the target declaration because the user does an explicit conversion using a builtin function. .sp 3 Usage: .sp 2 declare convert$to_target_fb entry ( ptr, ptr ) returns (ptr) ; .sp 2 return_ptr = convert$to_target_fb ( input_tree, target_reference ); .sp 2 .in 30 .un 30 1. input_tree operand to be converted by this program. (input) .sp 1 .un 30 2. target_reference pointer to the target reference node. (input) .sp 1 .un 30 3. return_ptr pointer to the result returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br lang_util_ .sp 3 Entry: .sp 2 convert$validate .sp 2 This entry is used to find out whether two sides of an assign operator is compatible. .sp 3 Usage: .sp 2 declare convert$validate entry ( ptr, ptr ) returns (ptr) ; .sp 2 return_ptr = convert$validate ( input_tree, target_reference ); .sp 2 .in 30 .un 30 1. input_tree operand to be converted by this program. (input) .sp 1 .un 30 2. target_reference pointer to the target reference node. (input) .sp 1 .un 30 3. return_ptr pointer to the result returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br operator_semantics .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 ceil .br an internal procedure to perform the ceiling function. .sp 1 .un 20 desc_type .br an internal procedure to convert the data type and precision into a descriptor type code. .sp 1 .un 20 get_target_size .br an internal procedure to compute the output precision, scale and length, when the input type, input precision, scale, length and output type is known. .sp 1 .un 20 print .br an internal procedure to call the error message program pl1_stat_$util_abort or pl1_stat_$util_error. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$util_abort .br pl1_stat_$util_error .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 assign_ .br char_to_numeric_ .br create_operator .br create_token .br declare_constant .br declare_temporary .br share_expression .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br declare_type .br desc_dcls .br desc_types .br mask .br nodes .br op_codes .br operator .br reference .br symbol .br system .br token .br token_types .sp 3 Errors Diagnosed: .sp 2 Error 223 .br Error 224 .br Error 225 .br Error 226 .br Error 227 .br Error 228 .br Error 229 .br Error 230 .br Error 231 .br Error 232 .br Error 233 .br Error 234 .br Error 235 .br Error 236 .br Error 246 .br Error 248 .br Error 249 .br Error 250 .br Error 251 .br Error 252 .br Error 253 .br Error 443 .* .bp .in 0 NAME: bindec .sp 3 Function: .sp 2 .in 4 .un 4 1. It converts a fixed binary number to a fixed decimal number. .in 0 .sp 3 Entry: .sp 2 bindec .sp 3 Usage: .sp 2 declare bindec entry ( fixed bin ) returns ( char(12) aligned ); .sp 2 character_result = bindec ( binary_number ); .sp 2 .in 30 .un 30 1. binary_number binary number to be converted. (input) .sp 1 .un 30 2. character_result decimal result expressed in characters. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 display_pl1_map .br display_pl1_text .br evaluate .br lang_util_ .br lex .br pl1_print .br v2pl1 .sp 3 Entry: .sp 2 bindec$vs .sp 2 This entry is used to return a varying character string instead of a nonvarying character string. .sp 3 Usage: .sp 2 declare bindec$vs entry ( fixed bin ) returns ( char(12) varying ); .sp 2 character_result = bindec$vs ( binary_number ); .sp 2 .in 30 .un 30 1. binary_number binary number to be converted. (input) .sp 1 .un 30 2. character_result decimal result expressed in characters. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 cg_error .br create_identifier .br decode_node_id .br descriptor_parse .br display_pl1_text .br display_text .br expand_primitive .br lang_util_ .br lex .br on_parse .br pl1_error_print .br prepare_symbol_map_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 eis_bits .br eis_micro_ops .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: binoct .sp 3 Function: .sp 2 .in 4 .un 4 1. It converts a bit string to an octal string. .in 0 .sp 3 Entry: .sp 2 binoct .sp 3 Usage: .sp 2 declare binoct entry ( bit(36) aligned ) returns ( char(12) aligned ); .sp 2 character_result = binoct ( bit_string ); .sp 2 .in 30 .un 30 1. bit_string bit string to be converted. (input) .sp 1 .un 30 2. character_result octal result expressed in characters. (output) .in 0 .br .sp 3 Programs that invoke this entry: .sp 2 display_pl1_map .br display_text .br lang_util_ .br pl1_symbol_print .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 none .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: binary_to_octal_string .sp 3 Function: .sp 2 .in 4 .un 4 1. It converts a fixed binary constant into a octal string. .in 0 .sp 3 Entry: .sp 2 binary_to_octal_string .sp 3 Usage: .sp 2 declare binary_to_octal_string entry ( fixed bin, char(12) aligned ); .sp 2 call binary_to_octal_string ( integer, octal_string ); .sp 2 .in 30 .un 30 1. integer fixed binary constant to be converted. (input) .sp 1 .un 30 2. octal_string character string representation of the octal value. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 none .sp 3 Entry: .sp 2 binary_to_octal_var_string .sp 2 This entry returns a varying octal string instead of a nonvarying octal string. .sp 3 Usage: .sp 2 declare binary_to_octal_var_string entry ( fixed bin, char(12) varying ); .sp 2 call binary_to_octal_var_string ( integer, octal_var_string ); .sp 2 .in 30 .un 30 1. integer fixed binary constant to be convertd. (input) .sp 1 .un 30 2. octal_string character string representation of the octal value. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 pl1_error_print .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 none .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: decbin .sp 3 Function: .sp 2 .in 4 .un 4 1. It converts a character string representing a signed or unsigned decimal constant to a fixed binary value. .in 0 .sp 3 Entry: .sp 2 decbin .sp 3 Usage: .sp 2 declare decbin entry ( char(*) aligned ) returns ( fixed bin ); .sp 2 value = decbin ( decimal_string ); .sp 2 .in 30 .un 30 1. decimal_string character string representing a signed or unsigned decimal constant. (input) .sp 1 .un 30 2. value value returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 defined_reference .br lang_util_ .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 none .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: token_to_binary .sp 3 Function: .sp 2 .in 4 .un 4 1. It gets the value of a constant token node. .in 0 .sp 3 Entry: .sp 2 token_to_binary .sp 3 Usage: .sp 2 declare token_to_binary entry ( ptr ) returns ( fixed bin ); .sp 2 value = token_to_binary ( token_ptr ); .sp 2 .in 30 .un 30 1. token_ptr pointer to the token node to be converted. (input) .sp 1 .un 30 2. value value returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 attribute_parse .br declare_descriptor .br declare_label .br declare_parse .br defined_reference .br descriptor_parse .br evaluate .br expand_initial .br get_array_size .br initialize_int_static .br lang_util_ .br lex .br subscriptre .br validate .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 none .sp 3 Errors Diagnosed: .sp 2 none .bp N_O_D_E__D_U_P_L_I_C_A_T_I_O_N__P_R_O_G_R_A_M_S_ .sp 2 The following procedures duplicates expressions or nodes so that the same expression or reference may be used or shared by different parts of the program. .* .bp .in 0 NAME: copy_expression .sp 3 Function: .sp 2 .in 4 .un 4 1. It duplicates a node and its components. .in 0 .sp 3 Entry: .sp 2 copy_expression .sp 3 Usage: .sp 2 declare copy_expression entry ( ptr unaligned ) returns (ptr) ; .sp 2 return_ptr = copy_expression ( operand_ptr ); .sp 2 .in 30 .un 30 1. operand_ptr pointer to the operand to be duplicated. (input) .sp 1 .un 30 2. return_ptr pointer returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br copy_expression .br declare .br declare_descriptor .br declare_structure .br defined_reference .br do_semantics .br expand_assign .br expand_initial .br expand_primitive .br expression_semantics .br fill_refer .br function .br generic_selector .br get_array_size .br io_semantics .br lang_util_ .br merge_attributes .br operator_semantics .br optimizer .br prepare_symbol_table .br refer_extent .br share_expression .br simplify_offset .br subscripter .sp 3 Entry: .sp 2 copy_sons .sp 2 This entry is used to duplicate all the symbol nodes of the members of a structure. .sp 3 Usage: .sp 2 declare copy_sons entry ( ptr, ptr ); .sp 2 call copy_sons ( father_ptr, stepfather_ptr ); .sp 2 .in 30 .un 30 1. father_ptr pointer to the symbol node to be duplicated. (input) .sp 1 .un 30 2. stepfather_ptr pointer to the new symbol node. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 context_processor .br lang_util_ .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 copy_symbol .br an internal procedure to create a symbol node, and to duplicate all the fields in the symbol node. .in 0 .sp 3 External Variables: .sp 2 pl1_stat_$util_abort .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 previous pointer set to remember the original symbol.next when a symbol node is to be duplicated. .in 0 .sp 3 Programs Called: .sp 2 copy_expression .br create_array .br create_bound .br create_list .br create_operator .br create_reference .br create_symbol .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br array .br symbol .br declare_type .br list .br nodes .br operator .br op_codes .br reference .sp 3 Errors Diagnosed: .sp 2 Error 32 .* .bp .in 0 NAME: share_expression .sp 3 Function: .sp 2 .in 4 .un 4 1. It determines whether a reference node or an operator node can be shared, and increments the reference count. .sp 1 .un 4 2. It calls copy_expression if these nodes are not sharable. .in 0 .sp 3 Entry: .sp 2 share_expression .sp 3 Usage: .sp 2 declare share_expression entry ( ptr ) returns (ptr) ; .sp 2 return_ptr = share_expression ( operand_ptr ); .sp 2 .in 30 .un 30 1. operand_ptr pointer to the operand to be shared. (input) .sp 1 .un 30 2. return_ptr pointer returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br call_op .br convert .br do_semantics .br expand_infix .br expand_primitive .br expression_semantics .br function .br io_semantics .br lang_util_ .br operator_semantics .br simplify_offset .br string_temp .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_reference .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br nodes .br operator .br reference .br symbol .sp 3 Errors Diagnosed: .sp 2 none .bp E_R_R_O_R__D_I_A_G_N_O_S_T_I_C__P_R_O_G_R_A_M_S_ .sp 2 The following procedures are used to print the error messages either on the user's console or in the program listing. .* .bp .in 0 NAME: parse_error .sp 3 Function: .sp 2 .in 4 .un 4 1. It calls the error message program error_. .in 0 .sp 3 Entry: .sp 2 parse_error .sp 3 Usage: .sp 2 declare parse_error entry ( fixed bin(15), ptr ); .sp 2 call parse_error ( error_number, error_ptr ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. error_ptr pointer to the node exhibiting the error. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 data_list_parse .br declare_label .br declare_parse .br default_parse .br descriptor_parse .br do_parse .br format_list_parse .br if_parse .br io_statement_parse .br lang_util_ .br on_parse .br parse .br procedure_parse .br process_entry .br reserve .br statement_parse .br statement_type .sp 3 Entry: .sp 2 parse_error$no_text .sp 2 This entry is called when the error is caused not as a result of processing the statements in the block. .sp 3 Usage: .sp 2 declare parse_error$no_text entry ( fixed bin(15), ptr ); .sp 2 call parse_error$no_text ( error_number, error_ptr ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. error_ptr pointer to the node exhibiting the error. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 none .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$cur_statement .br pl1_stat_$source_seg .br pl1_stat_$st_length .br pl1_stat_$st_start .br pl1_stat_$statement_id .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 error_ .sp 3 Include Files used: .sp 2 source_id .br language_utility .br source_id_descriptor .br token_list .br statement .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: pl1_error_print .sp 3 Function: .sp 2 .in 4 .un 4 1. It gets the error message from the error message segment. .sp 1 .un 4 2. It constructs the file number, line number and statement number, and the statement that causes the error. .sp 1 .un 4 3. It prints the complete message on the user's console. .in 0 .sp 3 Entry: .sp 2 pl1_error_print$write_out .sp 3 Usage: .sp 2 declare pl1_error_print$write_out entry ( fixed bin(15), 1 unaligned, 2 bit(8), 2 bit(14), 2 bit(5), ptr, fixed bin(11), fixed bin(31), fixed bin(31), fixed bin(15) ); .sp 2 call pl1_error_print$write_out ( error_number, statement_id, token_ptr, source_seg, source_start, source_length, source_line ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. statement_id a substructure containing the file number, line number, and statement number where the error occurred. (input) .sp 1 .un 30 3. token_ptr pointer to the identifier causing the error. (input) .sp 1 .un 30 4. source_seg pointer to the source segment. (input) .sp 1 .un 30 5. source_start index showing the start of the statement causing the error. (input) .sp 1 .un 30 6. source_length length of the statement causing the error. (input) .sp 1 .un 30 7. source_line not being used. .in 0 .sp 3 Programs that invoke this entry: .sp 2 error_ .sp 3 Entry: .sp 2 pl1_error_print$listing_segment .sp 2 This entry is used to dump the error message on the listing segment rather than the user's console. .sp 3 Usage: .sp 2 declare pl1_error_print$listing_segment entry ( fixed bin(15), 1 unaligned, 2 bit(8), 2 bit(14), 2 bit(5), ptr ); .sp 2 call pl1_error_print$listing_segment ( error_number, statement_id, token_ptr ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. statement_id a substructure containing the file number, line number, and statement number where the error occurred. (input) .sp 1 .un 30 3. token_ptr pointer to the identifier causing the error. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 error_ .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 next_string .br an internal procedure to get the error message from the error message segment. .sp 1 .un 20 quote_token .br an internal procedure to replace the "$" in the error message text with the corresponding identifier string. .in 0 .sp 3 External Variables: .sp 2 cg_static_$debug .br pl1_stat_$abort_label .br pl1_stat_$brief_error_mode .br pl1_stat_$err_stm .br pl1_stat_$error_memory .br pl1_stat_$error_messages .br pl1_stat_$error_width .br pl1_stat_$greatest_severity .br pl1_stat_$last_severity .br pl1_stat_$last_statement_id .br pl1_stat_$severity_plateau .br pl1_stat_$source_list_ptr .br tree_$ .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 binary_to_octal_var_string .br bindec$vs .br decode_source_id .br ios_$write_ptr .br pl1_print$varying .br pl1_print$varying_nl .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br token .br token_types .br token_list .br source_list .br source_id .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: error .sp 3 Function: .sp 2 .un 4 1. It calls the error message program error_. .in 0 .sp 3 Entry: .sp 2 error .sp 3 Usage: .sp 2 declare error entry ( fixed bin(15), ptr, ptr ); .sp 2 call error ( error_number, statement_ptr, token_ptr ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this error. (input) .sp 1 .un 30 3. token_ptr pointer to the token node causing this error. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 adjust_ref_count .br aq_man .br assign_op .br assign_storage .br cg_error .br compile_statement .br eval_exp .br expmac .br gen_pl1_symbol .br jump_op .br lang_util_ .br m_a .br mst .br pl1_signal_catcher .br prepare_operand .br prepare_symbol_table .br semantic_translator .br stack_temp .br xr_man .sp 3 Entry: .sp 2 error$omit_text .sp 2 This entry calls error_$no_text instead of error_. .sp 3 Usage: .sp 2 declare error$omit_text entry ( fixed bin(15), ptr, ptr ); .sp 2 call error$omit_text ( error_number, statement_ptr, token_ptr ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. statement_ptr pointer to the statement node containing this error. (input) .sp 1 .un 30 3. token_ptr pointer to the token node causing this error. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 none .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$err_stm .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 error_ .br error_$no_text .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br source_id .br statement .br source_list .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: error_ .sp 3 Function: .sp 2 .in 4 .un 4 1. This is an error message buffering program. .sp 1 .un 4 2. If the listing option is on in the compilation, up to 100 error messages and related information are saved in the internal static buffer error_info. .sp 1 .un 4 3. It then calls pl1_error_print$write_out to print the error message on the user's console. .in 0 .sp 3 Entry: .sp 2 error_ .sp 3 Usage: .sp 2 declare error_ entry ( fixed bin(15), 1 unaligned, 2 bit(8), 2 bit(14), 2 bit(5), ptr, fixed bin(8), fixed bin(23), fixed bin(11), fixed bin(31) ); .sp 2 call error_ ( error_number, statement_id, token_ptr, source_seg, source_start, source_length, source_line ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. statement_id a substructure containing the file number, line number, and statement number where the error occurred. (input) .sp 1 .un 30 3. token_ptr pointer to the identifier causing the error. (input) .sp 1 .un 30 4. source_seg pointer to the source segment. (input) .sp 1 .un 30 5. source_start index showing the start of the statement causing the error. (input) .sp 1 .un 30 6. source_length length of the statement causing the error. (input) .sp 1 .un 30 7. source_line not being used. .in 0 .sp 3 Programs that invoke this entry: .sp 2 error .br lang_util_ .br lex .br parse_error .br semantic_translator .sp 3 Entry: .sp 2 error_$no_text .sp 2 This entry is called when it is not possible to determine the specific statement causing the error. .sp 3 Usage: .sp 2 declare error_$no_text entry ( fixed bin(15), 1 unaligned, 2 bit(8), 2 bit(14), 2 bit(5), ptr); .sp 2 call error_$no_text entry ( error_number, statement_id, token_ptr ); .sp 2 .in 30 .un 30 1. error_number error number. (input) .sp 1 .un 30 2. statement_id a substructure containing the file number, line number, and statement number where the error occurred. (input) .sp 1 .un 30 3. token_ptr pointer to the identifier causing the error. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 context_processor .br error .br initialize_int_static .br lang_util_ .br lex .br semantic_translator .br validate .sp 3 Entry: .sp 2 error_$finish .sp 2 This entry is called to sort the error messages in the buffer by statement number, and then dump them onto the listing segment. .sp 3 Usage: .sp 2 declare error_$finish entry; .sp 2 call error_$finish; .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br v2pl1 .sp 3 Entry: .sp 2 error_$initialize_error .sp 2 This entry is used to initialize the internal static running index ei. .sp 3 Usage: .sp 2 declare error_$initialize_error entry; .sp 2 call error_$initialize_error; .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br parse .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$error_width .br pl1_stat_$listing_on .sp 3 Internal Static Variables: .sp 2 .in 20 .un 20 ei running index into the error_info array. .sp 1 .un 20 error_info array of structure serving as the buffer for up to 100 error messages diagnosed by the program. .sp 1 .un 20 error_number number of an individual error. .sp 1 .un 20 file_number file number of an individual error. .sp 1 .un 20 line_number line number of an individual error. .sp 1 .un 20 statement_id substructure of error_info. .sp 1 .un 20 statement_number statement number of an individual error. .sp 1 .un 20 token_pt pointer to record the identifier causing an individual error. .in 0 .sp 3 Programs Called: .sp 2 pl1_error_print$listing_segment .br pl1_error_print$write_out .br pl1_print$non_varying_nl .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br nodes .br operator .br op_codes .br reference .br symbol .br source_id .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: decode_node_id .sp 3 Function: .sp 2 .in 4 .un 4 1. It decodes the source_id of a node into its component parts of file number, line number, and statement number. .in 0 .sp 3 Entry: .sp 2 decode_node_id .sp 3 Usage: .sp 2 declare decode_node_id entry ( ptr, bit(1) aligned ) returns ( char(120) varying ); .sp 2 source_id_string = decode_node_id ( node_ptr, capital_bit ); .sp 2 .in 30 .un 30 1. node_ptr pointer to a node whose source_id is to be decoded. (input) .sp 1 .un 30 2. capital_bit bit indicating whether to return upper case characters. (input) .sp 1 .un 30 3. source_id_string character string returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 compile_statement .br lang_util_ .br optimizer .br pl1_signal_catcher .sp 3 Entry: .sp 2 decode_source_id .sp 2 This entry supplies a 27-bit bitstring instead of a pointer to a node. .sp 3 Usage: .sp 2 declare decode_source_id entry ( 1 structure unaligned, 2 bit(8), 2 bit(14), 2 bit(5), bit(1) aligned ) returns ( char(120) varying ); .sp 2 source_id_string = decode_source_id ( source_id, capital_bit ); .sp 2 .in 30 .un 30 1. source_id source_id to be decoded. (input) .sp 1 .un 30 2. capital_bit bit indicating whether to return upper case characters. (input) .sp 1 .un 30 3. source_id_string character string returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 lang_util_ .br pl1_error_print .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 pl1_stat_$source_list_ptr .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 bindec$vs .sp 3 Include Files used: .sp 2 nodes .br source_id .br source_list .br token .sp 3 Errors Diagnosed: .sp 2 none .bp E_N_T_R_Y__V_E_C_T_O_R__P_R_O_G_R_A_M_S_ .sp 2 The compiler is grouped and bound into four distinct segments in the Multics system. These bound segments are called bound_parse_, bound_semant_, bound_lang_util_, and bound_cg_. Each of these may invoke procedures bound in the same segment or procedures in other bound segments. To facilitate cross-segment procedure invocation and to reduce the names appearing on a bound segment, each bound segment has a entry vector program and a transfer vector program. The entry vector program introduces entry names in its own bound segment invoked by other segments; while the transfer vector introduces entry names on other bound segments invoked by some procedures in its own bound segment. All the entry vector programs and transfer vector programs are written in the assembly language ALM. .sp 2 Note: There is no entry vector program for bound_parse_ because none of its components are invoked by procedures in the other bound segments. .* .bp .in 0 NAME: v2pl1_semant_ .sp 3 Function: .sp 2 .in 4 .un 4 1. This is the entry vector program for the bound segment bound_semant_. .in 0 .sp 3 Entry: .sp 2 abort .br call_es .br error .br expression_semantics .br lookup .br prepare_symbol_table .br semantic_translator .* .bp .in 0 NAME: lang_util_ .sp 3 Function: .sp 2 .in 4 .un 4 1. This is the entry vector program for the bound segment bound_lang_util_. .in 0 .sp 3 Entry: .sp 2 pl1_signal_catcher .br generate_definition .br end_symbol .br beg_symbol .br init_linkage .br gen_pl1_linkage .br compile_link .br assign_storage .br compile_formats .br mst .br by_size .br display_pl1_text .br display_pl1_map .br merge_attributes .br unaligned_nl .br for_lex .br string_ptr_nl .br string_ptr .br non_varying_nl .br non_varying .br varying_nl .br varying .br initialize_error .br finish .br no_text .br error_ .br error .br decode_source_id .br decode_node_id .br parse_error .br decbin .br share_expression .br to_target .br to_target_fb .br to_integer .br validate .br from_builtin .br convert .br rename_parse .br read_lib .br clear .br declare_lib .br copy_sons .br copy_expression .br compare_expression .br optimizer .br declare_temporary .br declare_pointer .br declare_picture .br declare_integer .br param .br ctl .br declare_descriptor .br char .br bit .br desc .br integer .br declare_constant .br refer_extent .br get_size .br free_node .br get_free .br truncate .br init .br pl1_get .br prologue .br create_storage .br create_statement .br create_reference .br create_operator .br create_list .br token_to_binary .br vs .br binoct .br bindec .br create_identifier .br create_token .br create_symbol .br create_label .br create_default .br create_cross_reference .br create_context .br create_bound .br create_block .br create_array .bp T_R_A_N_S_F_E_R__V_E_C_T_O_R__P_R_O_G_R_A_M_S_ .sp 2 Please refer to the previous subsection "Entry Vector Programs" for the description of transfer vector programs. .* .bp .in 0 NAME: parse_xfer_vector .sp 3 Function: .sp 2 .in 4 .un 4 1. This is the transfer vector program for the bound segment bound_parse_. .in 0 .sp 3 Entry: .sp 2 pl1_signal_catcher .br string_ptr_nl .br merge_attributes .br prepare_symbol_table .br truncate .br init .br token_to_binary .br semantic_translator .br rename_parse .br declare_picture .br declare_lib .br clear .br varying_nl .br non_varying_nl .br non_varying .br for_lex .br pl1_get .br parse_error .br optimizer .br free_node .br no_text .br initialize_error .br finish .br error_ .br create_token .br create_symbol .br create_statement .br create_reference .br create_operator .br create_list .br create_label .br create_default .br create_cross_reference .br create_context .br create_bound .br create_block .br create_array .br copy_expression .br vs .br binoct .br bindec .* .bp .in 0 NAME: semant_xfer_vector .sp 3 Function: .sp 2 .in 4 .un 4 1. This is the transfer vector program for the bound segment bound_semant_. .in 0 .sp 3 Entry: .sp 2 error .br create_block .br token_to_binary .br share_expression .br declare_lib .br refer_extent .br merge_attributes .br get_size .br free_node .br no_text .br error_ .br declare_temporary .br declare_pointer .br declare_integer .br param .br ctl .br declare_descriptor .br integer .br char .br bit .br declare_constant .br decbin .br create_token .br create_symbol .br prologue .br create_statement .br create_reference .br create_operator .br create_list .br create_label .br create_cross_reference .br create_bound .br create_array .br copy_sons .br copy_expression .br validate .br to_target_fb .br to_target .br to_integer .br from_builtin .br convert .br compare_expression .br vs .* .bp .in 0 NAME: util_xfer_vector .sp 3 Function: .sp 2 .in 4 .un 4 1. This is the transfer vector program for the bound segment bound_lang_util_. .in 0 .sp 3 Entry: .sp 2 cg_error .br l_v .br e_v .br prepare_operand .br call_es .br lookup .br expression_semantics .bp D_A_T_A__S_E_G_M_E_N_T_S_ .sp 2 The pl1_stat_ data segment contains the external static variables used by all phases of the compiler. .* .bp .in 0 NAME: pl1_stat_ .sp 3 .in 20 .un 20 LHS A pointer to the symbol node of the left hand side of an assignment statement currently being processed by the semantic translator. This pointer is set by expression_semantics, and reset by semantic_translator. This pointer is used by expand_infix and expression_semantics to decide whether an aggregate expression may be simplified. .sp 1 .un 20 abort_label This label field is set by the procedure semantic_translator. Transferring to this label results in unwinding the compiler, printing an error message informing the user that the compilation has been aborted, and executing the cleanup handler. .sp 1 .un 20 apostrophe_mode not used. .sp 1 .un 20 brief_error_mode This bit(1) field is set to "1"b if the brief option is specified. This field controls the amount of text to be printed when an error occurred. .sp 1 .un 20 card_input not used. .sp 1 .un 20 char_pos This field contains an approximate character count for the current listing segment. It is approximate because it is always one larger than the actual character count. If the listing file is a multisegment file, this field only contains the character count of the active component. .sp 1 .un 20 check_bounds not used. .sp 1 .un 20 compiler_created_index .br Initialized to 0, this is a count of the compiler generated symbol names. The names are of the form "cp.n", where n is the value of compiler_created_index. .sp 1 .un 20 compiler_name This character field is the compiler name to be stored in the object segment by the code generator. The name of this compiler is "pl1". .sp 1 .un 20 condition_index Initialized to 0, this is a count of the compiler generated condition na,mes. The names are of the form "condition.n", where n is the value of condition_index. .sp 1 .un 20 constant_list The root of the chain of all constants created by the compiler. .sp 1 .un 20 convert_len not used. .sp 1 .un 20 convert_ptr not used. .sp 1 .un 20 convert_switch not used. .sp 1 .un 20 cur_block not used. .sp 1 .un 20 cur_level not used. .sp 1 .un 20 cur_statement A pointer to the statement node currently being processed by the semantic translator. .sp 1 .un 20 debug_semant This bit(1) field is set to "1"b if the debug_semant option is specified. .sp 1 .un 20 dummy_block Initialized to a null pointer, this pointer is used by the code generator. .sp 1 .un 20 eis_mode This bit(1) field is used to indicate whether the extended instuction code is desired by this compilation. In the current Multics system, this bit is always on. .sp 1 .un 20 equivalence_base not used. .sp 1 .un 20 err_stm A pointer pointing to the statement node in which an error has been discovered. .sp 1 .un 20 error_flag This bit(1) field is used to indicate whether an error has occurred in the processing of compiler generated statements for the return statement in a multiple-entried program. .sp 1 .un 20 error_memory The procedure error_ remembers the first 100 errors, so they can be sorted by line number before being placed in the listing segment. .sp 1 .un 20 error_messages a pointer to the segment containing the text for all error messages. .sp 1 .un 20 error_width The line length for the I/O stream user_output. If user_output does not have a line length, the value 120 is used. .sp 1 .un 20 expl_continuation_count .br not used. .sp 1 .un 20 format_list not used. .sp 1 .un 20 free_ptr array of headers of free reuseable nodes saved in the allocation pool. .sp 1 .un 20 generate_symtab This bit(1) field is set to "1"b if there is a "get/put data;" statement in the program. .sp 1 .un 20 greatest_severity This field is initialized to 0 at the beginning of a compilation and will indicate the error level high water mark at the end of the compilation. In other words, the highest severity error recorded for this compilation. .sp 1 .un 20 had_data_io not used. .sp 1 .un 20 hash_table The token node hash table. .sp 1 .un 20 hollerith_mode not used. .sp 1 .un 20 index A number indicating the current locater qualifier in the external static array pl1_stat_$locator. .sp 1 .un 20 last_severity A number indicating the severity of error encountered, used to set the had_error bit in the procedure semantic_translator$call_es. .sp 1 .un 20 last_source The number of include files used in this compilation. .sp 1 .un 20 last_statement_id not used. .sp 1 .un 20 line_count At the end of a compilation this field is set to the number of newline characters in the source segment. .sp 1 .un 20 list3_node not used. .sp 1 .un 20 list5_node not used. .sp 1 .un 20 list_ptr A pointer to the current listing segment. .sp 1 .un 20 listing_on This bit(1) field is set to "1"b if a listing segment is to be produced. .sp 1 .un 20 locator An array of pointers to keep track of the locator qualifiers occurring at different levels of an expression. .sp 1 .un 20 max_list_size This field is the max_seg_size of the current listing segment. .sp 1 .un 20 max_node_type This indicates the number of different types of nodes used by the compiler. .sp 1 .un 20 modetable not used. .sp 1 .un 20 multi_type This bit(1) indicates that the semantic translator is currently processing a return statement in a multiple-entried program. .sp 1 .un 20 no_quick_blocks not used. .sp 1 .un 20 node_name An array of character(12) containing the names of different nodes used by the compiler. .sp 1 .un 20 node_sizes An array of numbers showing the sizes of different nodes used by the compiler. .sp 1 .un 20 node_uses An array of counters, one for each node length. The appropriate counter is bumped whenever a node is created. The length of the operator is based on the number of words allocated for it. This information is provided for metering purposes. .sp 1 .un 20 ok_list The root of the chain of OK lists. One OK list is created for each "get data" statement. .sp 1 .un 20 one A pointer to the token "1", a decimal integer. .sp 1 .un 20 optimize This bit(1) field indicates whether an optimize option is used in the compilation. .sp 1 .un 20 options A character string representation of all options specified in the compilation. This character string will appear in the listing segment. .sp 1 .un 20 pathname The absolute pathname of the source segment. .sp 1 .un 20 phase The current compilation phase. .sp 1 .un 20 print_cp_dcl If the cpdcl option is specified, this field is set to "1"b. .sp 1 .un 20 profile_length The number of words to be allocated to implement the profile feature of the compiler. This value will approximate the number of statements in the subprogram. .sp 1 .un 20 quick_pt A pointer to the bit array real_quick_info in the procedure semantic_translator. The bit array contains information on whether each block can be quick. .sp 1 .un 20 root A pointer to the root block node. .sp 1 .un 20 seg_name The entryname of the source segment but without the final component ".pl1". .sp 1 .un 20 severity_plateau This field is initially one but can be set by the user to any value from one to four. This field implements the severity option by specifying the minimum error level of error messages to be printed. .sp 1 .un 20 source_index A running index to the source segment currently working on by the procedure lex. .sp 1 .un 20 source_list_ptr A pointer to the array of structures source_list that contains information about the source segment and all the include files used in the compilation. .sp 1 .un 20 source_ptr A pointer to the source segment. .sp 1 .un 20 source_seg An index used to indicate the source segment or include file currently working on by the procedure lex. .sp 1 .un 20 st_length Current length of the statement being compiled. It is updated every time another token is parsed. .sp 1 .un 20 st_start Character offset of the beginning of the current statement relative to the base of the source segment. .sp 1 .un 20 statement_id The line number, statement number, and file number of the current statement. .sp 1 .un 20 stop_id If the debug_semant option or debug_cg option is used, this field is compared to pl1_stat_$statement_id. If they are equal, then the procedure debug will be invoked. .sp 1 .un 20 table Set to "1"b if the table option is specified in the compilation. .sp 1 .un 20 temporary_list The root of the chain of the temporary nodes created during the compilation. .sp 1 .un 20 tree_vec_index This field specifies how many additional segments are being used by the compiler to accommodate all the nodes used for the internal representation of the program. Its value will be zero if only tree_ and xeq_tree_ are being used. The value is maintained dynamically and reflects only the current storage requirements. .sp 1 .un 20 unwind A label variable set to a label constant in the procedure process_entry. This label is used as the point of transfer in case an error occurs in the procedures declare_parse or default_parse. .sp 1 .un 20 user_id The Person.Project.instance tag for the current compilation. .sp 1 .un 20 util_abort An entry variable used by the utility procedures to unwind after a level 3 error. It is assigned the value semantic_translator$abort. Transferring to this label results in unwinding the compiler sufficiently to continue compilation. .sp 1 .un 20 util_error An entry variable used by the utility procedures to unwind after an error. It is assigned the value semantic_translator$error. No unwinding results from transferring to this label. .sp 1 .un 20 validate_proc A pointer to the symbol node of the validating procedure when the validate option is used in a procedure statement or entry statement. .in 0 .bp O_T_H_E_R__M_I_S_C_E_L_L_A_N_E_O_U_S__P_R_O_G_R_A_M_S_ .sp 2 Some procedures deal with other miscellaneous functions, and do not fall into any category described earlier. .* .bp .in 0 NAME: refer_extent .sp 3 Function: .sp 2 .in 4 .un 4 1. It scans a reference node or an operator node to find a refer operator among some of its components. .sp 1 .un 4 2. It replaces all the refer operators by the refer target, qualified with a proper locator qualifier. .in 0 .sp 3 Entry: .sp 2 refer_extent .sp 3 Usage: .sp 2 declare refer_extent entry ( ptr, ptr ); .sp 2 call refer_extent ( expression_tree, locator_qualifier ); .sp 2 .in 30 .un 30 1. expression_tree pointer to the operator node or reference node to be processed by this program. (input/output) .sp 1 .un 30 2. locator_qualifier pointer to be used as the locator qualifier. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br declare_descriptor .br expand_assign .br expand_primitive .br io_semantics .br lang_util_ .br operator_semantics .br refer_extent .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_reference .br refer_extent .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br nodes .br reference .br operator .br op_codes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: fill_refer .sp 3 Function: .sp 2 .in 4 .un 4 1. It scans a reference node or an operator node to find a refer operator among some of its components. .sp 1 .un 4 2. It replaces all the refer operators by the refer target, qualified with a proper locator qualifier. .sp 1 .un 4 3. It has an argument which indicates whether the locator qualifier needs be duplicated. .in 0 .sp 3 Entry: .sp 2 fill_refer .sp 3 Usage: .sp 2 declare fill_refer entry ( ptr, ptr, bit(1) aligned ) returns (ptr) ; .sp 2 return_ptr = fill_refer ( expression_tree, locator_qualifier, copy_switch ); .sp 2 .in 30 .un 30 1. expression_tree pointer to the operator node or reference node to be processed by this program. (input) .sp 1 .un 30 2. locator_qualifier pointer to be used as the locator qualifier. (input) .sp 1 .un 30 3. copy_switch bit indicating whether copy_expression should be invoked. (input) .sp 1 .un 30 4. return_ptr pointer to the operator or reference node returned by this program. (output) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br prepare_symbol_table .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 copy_expression .br create_reference .sp 3 Include Files used: .sp 2 language_utility .br source_id_descriptor .br nodes .br reference .br operator .br op_codes .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: check_star_extents .sp 3 Function: .sp 2 .in 4 .un 4 1. It scans through all the arguments of a call for a length expression appearing in a position corresponding to a star extents parameter. .sp 1 .un 4 2. It calls make_non_quick if the search is successful. .in 0 .sp 3 Entry: .sp 2 check_star_extents .sp 3 Usage: .sp 2 declare check_star_extents entry ( ptr, ptr ); .sp 2 call check_star_extents ( symbol_ptr, argument_list ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node of the entry. (input) .sp 1 .un 30 2. argument_list list of arguments for the entry. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 builtin .br function .sp 3 Internal Procedures: .sp 2 none .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 make_non_quick .sp 3 Include Files used: .sp 2 nodes .br block .br symbol .br reference .br operator .br list .sp 3 Errors Diagnosed: .sp 2 none .* .bp .in 0 NAME: propagate_bit .sp 3 Function: .sp 2 .in 4 .un 4 1. It turns on a specified bit in the symbol node. .sp 1 .un 4 2. It also turns on the corresponding bit in the symbol node for all members of the structure. .in 0 .sp 3 Entry: .sp 2 propagate_bit .sp 3 Usage: .sp 2 declare propagate_bit entry ( ptr, fixed bin(15) ); .sp 2 call propagate_bit ( symbol_ptr, bit_position ); .sp 2 .in 30 .un 30 1. symbol_ptr pointer to the symbol node whose attribute is to be propagated. (input) .sp 1 .un 30 2. bit_position bit position of the attribute in the symbol node that is to be propagated. (input) .in 0 .sp 3 Programs that invoke this entry: .sp 2 alloc_semantics .br builtin .br defined_reference .br expression_semantics .br validate .sp 3 Internal Procedures: .sp 2 .in 20 .un 20 propagate .br an internal procedure to turn on a specified bit throughout a structure. .in 0 .sp 3 External Variables: .sp 2 none .sp 3 Internal Static Variables: .sp 2 none .sp 3 Programs Called: .sp 2 none .sp 3 Include Files used: .sp 2 symbol .sp 3 Errors Diagnosed: .sp 2 none ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved