Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!zen!ucbvax!ac.UK!COK2%UK.AC.DURHAM.MTS
From: COK2%UK.AC.DURHAM.MTS@ac.UK (Barry_Cornelius)
Newsgroups: comp.lang.modula2
Subject: One-pass Compilers (again)
Message-ID: <8707231338.AA27020@jade.berkeley.edu>
Date: Wed, 22-Jul-87 11:18:05 EDT
Article-I.D.: jade.8707231338.AA27020
Posted: Wed Jul 22 11:18:05 1987
Date-Received: Sat, 25-Jul-87 06:46:20 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Distribution: world
Organization: The ARPA Internet
Lines: 48

I remember that, last October, there was some discussion about
one-pass compilers for Modula-2.   The language defined by Wirth in his
Report (see back of "Programming in Modula-2") is unable to be compiled
by a one-pass compiler for a number of reasons:
   1. The Report allows use of an identifier before its declaration
      provided the use appears in a statement.
   2. The Report permits mutually recursive procedures (but there is no
      mention of a FORWARD declaration in the Report).
   3. The Report allows two local modules which are mutually importing.
I would be interested to hear of any other difficulties that a one-pass
compiler would have in compiling the language defined by the Report.

I would also be interested to hear from those who use mutually importing
local modules.   Are there examples of real code out there that use this
facility?

Here is an abstract example of a mutually importing local module:
   ...
   MODULE m1;
      IMPORT x;
      EXPORT y;
      VAR y:INTEGER;
      ...
   END m1;
   ...
   MODULE m2;
      IMPORT y;
      EXPORT x;
      VAR x:INTEGER;
      ...
   END m2;
   ...
These two module declarations form part of the block of a program
(or a procedure/function/module declaration).
==
Barry Cornelius
==
Address:
   Computer Science Group, School of Engineering and Applied Science,
   University of Durham, Durham, DH1 3LE, England
Telephone:
   My office: Durham (091 or +44 91) 374 2638
   Secretary: Durham (091 or +44 91) 374 2630
Electronic Mail Addresses:
   JANET:       Barry_Cornelius@uk.ac.dur.mts
   ARPANET:     Barry_Cornelius%mts.dur.ac.uk@cs.ucl.ac.uk
   UUCP:        ...ukc!mts.dur.ac.uk!Barry_Cornelius
   BITNET/EARN: Barry_Cornelius%DUR.MTS@AC.UK