Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site loral.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!houxm!mhuxl!ulysses!allegra!mit-eddie!genrad!decvax!ittvax!dcdwest!sdcsvax!sdcc6!loral!ian From: ian@loral.UUCP Newsgroups: net.lang.mod2 Subject: Re: Compiling Modula-2 in one pass? Message-ID: <474@loral.UUCP> Date: Thu, 6-Sep-84 11:23:16 EDT Article-I.D.: loral.474 Posted: Thu Sep 6 11:23:16 1984 Date-Received: Wed, 12-Sep-84 03:19:33 EDT References: <3432@decwrl.UUCP>, <57100006@hpfclo.UUCP> Organization: Loral Instruments, San Diego Lines: 47 A previous article by Jacob Gore suggested that forward references in Modula are confined to references to procedures. Mr. Gore suggests that since this is the case, a one pass compiler could be constructed, since only simple "back patching" of the symbol table would be necessary. As discussed in a previous net article by Mike Powell, forward references are NOT confined to procedures. The following program is allowed in Modula: MODULE ForwardReference; PROCEDURE LookForward; BEGIN SomeHairyRec.Num := 0; END LookForward; VAR (* note that this is global scope *) SomeHairyRec : RECORD Num : INTEGER; AString : ARRAY[ 0..79 ] OF CHAR; TheRealThing : REAL; END; BEGIN LookForward; END ForwardReference. Please forgive any syntax errors, I don't have a Modula compiler on the VAX I use. Note that the statement which sets the record field to zero can not be checked until the record is entered in the symbol table. No reasonable amount of "back patching" can take care of this problem. Ian Kaplan ucbvax!sdcc3!loral Loral Data Flow Group Loral Instrumentation 8401 Aero Dr. San Diego, CA 92123 (619) 560-5888 x4812 PS: note name change of UC San Diego UNIX Systems (i.e., sdccsu3 => sdcc3).