J3/02-160 Date: 02 March 2002 To: J3 From: Walt Brainerd Subject: Program Concepts (re: 01-396) I have tried to see what it would take to straighten out the text vs. process concepts. Here are some proposed "fixes". I would appreciate some feedback to see if you think this is worth doing. Maybe we don't care if it is not consistent. If there is some desire to do this, I will take suggestions and redo it based on the next version of 007, when available. Background: The standard distinguishes between the text of a program (e.g., program unit and subprogram) and the process (e.g., procedure) it defines. In olden days, there was "executable program" to contrast with "program". [ resulting in things like ... "execute the executable program" ! ] The current wording confuses these two things. A program is like lunch at a Chinese restaurant: some from column A and some from column B. For example: 2.2.1: "A program consists of ... program units and ... external procedures ..." Sometimes a text (program unit) gets executed; sometimes a procedure gets executed. 235:22 says a main program may be defined by means other than Fortran. My understanding is that it must be a companion processor. The only things we can describe with BNF are Fortran program units, so the only kind of program we can describe with syntax is a program that contains only Fortran. If we want "program" to include stuff defined by other means, then the syntactic thing should be something else: "fortran-program". Here is are proposed names for these things, trying to stick as closely to what is there and not use terms in these two different ways. Program units (Fortran source) What is defined by the source main program main function subprogram function subroutine subprogram subroutine The whole thing (syntactically) is a Fortran program. The process defined is a "program", which includes things defined by means other than Fortran. This term is inconsistent, in that it looks like the terms for text, but maybe we can't have everything. An alternative might be to call a "main" a "main program" and have "main program unit" be the text. This terminology is not as consistent and requires more changes (including changes to the syntax rules), I think, but may be closer to what some may expect intuitively. Here are some proposed changes, based on 02-007: 2:9 "program (2.2.1)" -> "Fortran program (2.2)" 9:6 " -> "" 9:8-9 Replace with "A shall contain exactly one . However, the main (2.2.2) of a program (2.2) may be defined by a companion processor (2.5.10)." 11:30 Replace with: "2.2 Program concepts A >program< consists of exactly one main, any number (including zero) of entities defined by other program units, and any number (including zero) of other entities defined by means other than Fortran. A >Fortran program< is a program defined exclusively by Fortran program units. [ Put Note 2.2 here. ] 2.2.1. Program unit" 11:40 "are" -> "define" 12:6-12 Replace with: "2.2.2 Main The main encapsulates a sequence of actions that is invoked when execution of the program begins. The main may be defined by a main program (11.1) or a companion processor (2.5.10)." 16:5 "If a program contains" -> "If the main is defined by" 16:6 "The" -> "If the main is defined by a companion processor, execution is begun by the companion processor. The" 235:22-23 "The main may be defined by a companion processor (2.5.10); in that case, there shall not also be a main defined by a ."