Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site decwrl.UUCP Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!zehntel!dual!decwrl!powell From: powell@decwrl.UUCP (Mike Powell) Newsgroups: net.lang.mod2 Subject: Compiling Modula-2 in one pass? Message-ID: <3432@decwrl.UUCP> Date: Fri, 24-Aug-84 19:25:48 EDT Article-I.D.: decwrl.3432 Posted: Fri Aug 24 19:25:48 1984 Date-Received: Wed, 29-Aug-84 01:25:04 EDT Sender: powell@decwrl.UUCP Organization: DEC Western Research Lab, Los Altos, CA Lines: 30 In the Report on The Programming Language Modula-2 (p.143 of Wirth's Programming in Modula-2, Springer-Verlag, 1982), Section 4, paragraph 2, it says: In general, the scope [of an identifier] extends over the entire block (procedure or module declaration) to which the declaration belongs and to which the object is local. The scope rule is augmented by the following cases: 1. If an identifier x defined by a declaration D1 is used in another declaration (not statement[!]) D2, then D1 must textually precede D2. ... From the general rule, and the "not statement" comment, it seems that a statement may make a forward reference to a declaration. Case 1 does prevent declarations from making forward references to other declarations. The absence of a forward procedure declaration, and the usefulness of allowing two local modules to import each other's exports both argue that this was an intentional decision to require a multi-pass compiler. Note that I, too, had a one-pass compiler until I compiled some of the ETH software and found it had forward references from statements to declarations. I have heard that the Volition compiler permits forward declarations of at least procedures and perhaps modules and other things, but I don't have direct knowledge of it. Michael L. Powell Digital Equipment Corporation Western Research Laboratory Los Altos, CA 94022 {decvax,ucbvax}!decwrl!powell powell@decwrl