1.4 Sentences and Programs A Refal program is a list of function definitions. It may also contain externalreferences (which will be discussed in Chapter 2) and commentlines. A comment line starts with an asterisk * , and has no effect on the execution of the program. Comment lines may appear both between and inside function definitions. The order in which function definitions enter the program has no significance. A function definition has one of these forms: function-name { block } $ENTRYfunction-name { block } The significance of the prefix $ENTRY will be discussed in Chapter 2 together with the use of external references. A functionname is an identifier. A block is a list of sentences separated by semicolons; the last sentence may be followed by a semicolon, also. The order of sentences in a function definition is significant. A sentence has the form:
<function-name argument> The following restriction on the right side is important: the right side can include only such free variables which also enter the left side (see next section). There is also a technical restriction: variable indexes must be unique, i.e., you can use eX and s1 any number of times but if you use eX you cannot use sX or tXin the same sentence; using s1 excludes e- and t-variables with index 1 . In addition to comment lines, sentences may include comments which start with /* and end with */ . They can appear anywhere provided that they do not break up lexical elements (identifiers, numbers, strings, variables) and do not tear a left evaluation bracket from the following function name. |