02/06/86 reductions, rdc Syntax as a command: rdc path {-control_args} Function: generates language translators. It compiles a segment containing reductions and action routines into a PL/I source segment; it then invokes the pl1 compiler to compile the PL/I source. The reductions specify the syntax and semantics of a new language; the action routines perform the basic operations (e.g, generating code) required to translate the language. For more information see the Commands manual. Arguments: path is the pathname of a translator source segment that is to be compiled by rdc. If path does not have a suffix of rd, one is assumed; however the rd suffix must be the last component of the name of the source segment. Control arguments: -brief, -bf prints all error messages with only a brief summary of the error that has occurred. -long, -lg prints all error messages with a detailed description of the error that has occurred. -no_trace generates a translator without the tracing facility. (Default) -trace {STR} adds a tracing facility to the generated translator. STR defines whether tracing is enabled or disabled by default. It can be "on" (default) or "off." (See "Notes on tracing" below.) In addition, you can give any control argument accepted by the pl1 command. Notes: Reductions are expressed in a highly compact form that emphasizes the syntax and semantics of the new language. This command compiles these reductions into tables that drive an rdc-provided semantic analyzer for the language. This analyzer compares the tokens (basic units) of a program written in the new language with the valid token phrases defined in the reductions. When a valid phrase is found, the action routines defined by the reduction are invoked to translate the phrase. Translators generated by the command can be written more quickly than hand-programmed translators because rdc provides the semantic analyzer for the language. They are easier to understand and to maintain because the all-important language syntax and semantics is concentrated in the reductions, rather than being spread throughout the semantic analyzer. This command can generate translators for the simplest type of language, a right-linear (finite state automaton) language. Often such languages are composed of keywords with operands, such as the control language of the bind command. The organization of an rdc translator, the translation process, and the reduction language are described below. If you supply neither -brief nor -long, a detailed description is printed the first time an error occurs in a given compilation and a brief description is printed in subsequent occurrences of that error. Notes on tracing: The tracing facility helps in debugging the reductions for a new translator by showing which reductions are being applied, along with the source tokens of the language being compiled that match each reduction. This gives you a running view of the flow of control through the reductions and of the processing of tokens. Because the tracing facility generates large amounts of output, it can be selectively turned on and off during debugging by setting a variable declared as follows: dcl TRACING bit(1) aligned int static init("1"b); A value of "1"b turns tracing on; "0"b turns it off. The initial value is set by the operand of -trace. The translator can accept a control argument to turn TRACING on or off, or it can have a debugging entry point to set the switch, or the switch can be set at a particular probe breakpoint. For example, to trace from the 28th through the 40th reductions, you can use the following set of probe requests: probe translator ps "RD_ACTION(NRED)" go to RD_ACTION(NRED); b: if NRED = 28: halt When halted, type-- let TRACING = "1"b reset b: if NRED = 40: h c And when the 40th reduction was reached, type: let TRACING = "0"b reset c Notes on the reduction language: The reductions that define the syntax and semantics of a language to be translated are written in the reduction language. This translator generation language consists of two kinds of statements: reduction statements and attribute declarations. Reduction statements specify the syntax of token phrases in the language being translated. They also name action routines that are invoked to translate valid phrases and to diagnose invalid token phrases. Attribute declarations control the size of some fixed-length tables that the generated translator uses and cause translation action routines provided by the reductions command to be included in the translator. They are described below under "Attribute Declarations." Elements of the reduction language: labels syntax actions next reduction ------- ------------ ----------- -------------- MAX_DEPTH label_stack_depth_number \ INCLUDE NEXT_STMT \ INCLUDE ERROR \ INCLUDE LEX \ INCLUDE DELETE \ INCLUDE DELETE_STMT \ BEGIN / absolute_spec / semant(...) / label \ / / [var="1"b] / \ label label2 / / / \ / / LEX / RETURN \ / / LEX(n) / STACK \ / / / NEXT_STMT / STACK_POP \ / / DELETE / \ / / / DELETE(n) / \ / / DELETE(m,n) / \ / / DELETE_STMT / \ / / ERROR(n) / \ / / PUSH(label) / \ / / POP / \ ----------------------------------------------------------- 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