Browse Prior Art Database

GOTO Implementation Modes

IP.com Disclosure Number: IPCOM000075914D
Original Publication Date: 1971-Dec-01
Included in the Prior Art Database: 2005-Feb-24
Document File: 3 page(s) / 51K

Publishing Venue

IBM

Related People

Bandat, KF: AUTHOR [+5]

Abstract

In general, the interpretation of a GOTO statement causes transfer of control to a statement identified by the label in the GOTO statement. In a compilable language, the label resolution is performed as a phase of the compilation. In an interpretive language, this may be undesirable because statements need not be inspected before their semantic interpretation. In a control language having dynamic scope rules for names, thus also for labels, name resolution is first attempted in the current text level, then in the dynamically predeceasing text level, etc.

This text was extracted from a PDF file.
At least one non-text object (such as an image or picture) has been suppressed.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 3

GOTO Implementation Modes

In general, the interpretation of a GOTO statement causes transfer of control to a statement identified by the label in the GOTO statement. In a compilable language, the label resolution is performed as a phase of the compilation. In an interpretive language, this may be undesirable because statements need not be inspected before their semantic interpretation. In a control language having dynamic scope rules for names, thus also for labels, name resolution is first attempted in the current text level, then in the dynamically predeceasing text level, etc.

The following problems arise when trying to process a GOTO in a dynamic control language:

1) When it is possible to dynamically modify the syntax of the language, there is no way of detecting what the search for labels should be in text which has not yet been interpreted. Thus a GOTO that does not point backward may be impossible to successfully interpret.

2) When severe size limitations make it impossible to store already interpreted statements, a GOTO which points backward may be impossible to interpret.

In general the processing of a GOTO is closely allied to the ability to locate and interpret labels - the objects that GOTO points to.

The restrictions which must apply to GOTO in a dynamic interpretive environment do not necessarily apply to processing of conditional clauses, such as the conventional IF...THEN...ELSE or DO...END. These forms give clear scope to the branching process and do not depend on the syntax of labels, nor on the availability of past text. The characteristics of IF...THEN...ELSE and DO...END are that they declare the intention to branch forward (IF...THEN... ELSE) or backward (DO...END) in advance and with severely localized effect.

An interpretive control language can have three distinct modes for the interpretation of a GOTO statement, thus making the language more convenient for use in environments with different needs. A PROCESS statement is used to identify under which mode a GOTO statement is to be interpreted. 1. The STATIC mode.

The STATIC mode is the most general implementation where the GOTO process considers both declared and undeclared labels. A label has been declared if the statement identified by the label has once in the program been interpreted successfully. For each text level a label directory is created, where each declared label is associated with a pointer to the identified statement. An undeclared label is a label identifying a statement which has not yet been interpreted.

For the interpretation of a GOTO statement within one text level, it is first checked whether the label given in the GOTO statement is a declared label in the

1

Page 2 of 3

label directory of the current text level. If this is the case, control is transferred to the corresponding stat...