Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!pt.cs.cmu.edu!f.gp.cs.cmu.edu!rpd From: rpd@f.gp.cs.cmu.edu (Richard Draves) Newsgroups: net.lang.mod2 Subject: Re: ETH Modula2 Single Pass Message-ID: <5@f.gp.cs.cmu.edu> Date: Mon, 22-Sep-86 12:27:22 EDT Article-I.D.: f.5 Posted: Mon Sep 22 12:27:22 1986 Date-Received: Mon, 22-Sep-86 21:26:52 EDT References: <6@fornax.uucp> Distribution: net Organization: Carnegie-Mellon University, CS/RI Lines: 20 I don't believe a true one-pass Modula-2 compiler is possible. I have some experience with the language, having implemented the front-end (first-pass) for a compiler. I have also discussed this issue with Mike Powell, implementor of the famed Powell compiler, and he concurs. The problem is that identifiers may be used in statements before they are declared (although identifiers used in declarations must be declared before use). Page 145 of the 3rd edition of Wirth's book is very clear. You may think a back-patching scheme can overcome this, but I have some sample programs that I think can convince anyone that the problems with such an approach are intractable. Does this purported one-pass compiler compile the whole language or a subset? If it does compile the whole language, does anyone know how it accomplishes this in a single pass? Let me mention that reading a program into memory, perhaps in the form of a syntax tree, and then generating code is *not* one pass. Rich