[Next] [Up] [Previous]

The RESERVE Statement

RESERVE statement
(RES)

The RESERVE statement has the form

       RESERVE word:text,word:text,word:text

and has the function of providing YAL with reserved words if that is desired by the programmer. Each reserved word operates only if it is an isolated group of identifier characters, delimited by special characters or spaces, outside of quotation marks, and is replaced by the text (a character or string constant) given for it.

For example, the statement

       RESERVE begin:'{', end:'}', else:"&'else'", not:'&not', 
               then:"&'then' @="

would cause

       if not x<y then
        begin
         . r=3
         . u=u+1
        end 
       else
        begin
         . r=5
        end @;

to be translated into the legal IF statement

       if &not x<y &'then' @=
        {
         . r=3
         . u=u+1
        }
       &'else'
        {
         . r=5
        } @;

Note the use of @= to remove the need for a continuation line indicator between the first end and the else by instead creating the need for an explicit @; to end the statement. This technique, however, creates difficulties in using then as a substitute for &'then' in other statements using that keyword for which no change in statement termination is desired.

It is therefore preferable to note that the fact that end-of-record may terminate YAL statements requires programmers to place else on the same line as the end it follows.

Also, note that

       RESERVE UTYP:'&"UTYP"'

creates the UTYP statement, allowing the user-defined type UTYP to be referred to without the &"..." syntax as a statement keyword as well as in parenthetical type modifiers.


[Next] [Up] [Previous]