🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.mod2
Article #541

Re: Single Pass Modula-2 Compiler

#541
From: Marc W. Mengel
Date: Thu, 02 Oct 1986 15:48
25 lines
1802 bytes
In article <12243102365.25.KURKURE@Sushi.Stanford.EDU> KURKURE@SUSHI.STANFORD.EDU (Uday Kurkure) writes:
>    Having merged Logitech's Modula-2 compiler's pass1 and pass2 into
>    a single pass,  I think that if you have identifiers used in
>    statments before declaring them, it is not possible to have 
>    a one pass compiler because you can not do the type checking in a 
>    reasonable way.

	Actually, you can note the fact that whatever type the symbol has
    must be compatable with how it is being used, and check that against
    the actual declaration when you see it.  For example, if I see a
    function call:

    intvar := funct( 5.0, "test", 7 );

    I can note that funct must return a type that can be assigned to an int,
    and accept a floating point, char array, and integer argument;  then,
    when I see a declaration of funct, I can check against this usage, and
    determine whether the previous usage was correct.  While this may seem
    to be a lot of bookkeeping, it seems to me the gains in speed for a 
    one pass compiler are sufficient to warrant it.  I may also need to
    back-patch some appropriate type conversions (i.e. integer->real, etc.).

-- 
 Marc Mengel
 ...!ihnp4!cuuxb!mwm
Technical Details
Message-ID: <841@cuuxb.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cuae2!ltuxa!cuuxb!mwm
References: <12243102365.25.KURKURE@Sushi.Stanford.EDU>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cuae2!ltuxa!cuuxb!mwm
From: mwm@cuuxb.UUCP (Marc W. Mengel)
Newsgroups: net.lang.mod2
Subject: Re: Single Pass Modula-2 Compiler
Message-ID: <841@cuuxb.UUCP>
Date: Thu, 2-Oct-86 11:48:09 EDT
Article-I.D.: cuuxb.841
Posted: Thu Oct  2 11:48:09 1986
Date-Received: Sat, 4-Oct-86 08:49:43 EDT
References: <12243102365.25.KURKURE@Sushi.Stanford.EDU>
Reply-To: mwm@cuuxb.UUCP (Marc W. Mengel)
Organization: AT&T-IS, Software Support, Lisle IL
Lines: 25