Re: Object-oriented compiler construction: ideas?

Jerry Leichter <leichter@smarts.com>
27 Jun 1996 11:23:25 -0400

          From comp.compilers

Related articles
[8 earlier articles]
Re: Object-oriented compiler construction: ideas? euahjn@eua.ericsson.se (1996-06-14)
Re: Object-oriented compiler construction: ideas? kalsow@winternet.com (1996-06-14)
Re: Object-oriented compiler construction: ideas? darius@phidani.be (Darius Blasband) (1996-06-21)
Re: Object-oriented compiler construction: ideas? rwatson@CAM.ORG (Richard Edward Watson) (1996-06-23)
Re: Object-oriented compiler construction: ideas? bronnikov@aol.com (1996-06-24)
Re: Object-oriented compiler construction: ideas? bobduff@world.std.com (1996-06-26)
Re: Object-oriented compiler construction: ideas? leichter@smarts.com (Jerry Leichter) (1996-06-27)
Re: Object-oriented compiler construction: ideas? jgm@CS.Cornell.EDU (Greg Morrisett) (1996-06-27)
Re: Object-oriented compiler construction: ideas? cliffc@ami.sps.mot.com (1996-06-30)
Re: Object-oriented compiler construction: ideas? compres@world.std.com (1996-06-30)
Re: Object-oriented compiler construction: ideas? jdean@cs.washington.edu (1996-06-30)
Re: Object-oriented compiler construction: ideas? solution@gate.net (1996-07-01)
Re: Object-oriented compiler construction: ideas? robison@kai.com (Arch Robison) (1996-07-01)
[2 later articles]
| List of all articles for this month |

From: Jerry Leichter <leichter@smarts.com>
Newsgroups: comp.compilers
Date: 27 Jun 1996 11:23:25 -0400
Organization: System Management ARTS
References: 96-06-047 96-06-064 96-06-117
Keywords: OOP

I'm surprised no one has mentioned the SRC Modula-3 compiler. It uses
an object-oriented design in which each construct has a corresponding
module that is responsible for everything having to do with that
construct. Here, for example, is the interface definition file
AssignStmt.i3 (the copyright permits redistribution):


(* Copyright (C) 1992, Digital Equipment Corporation *)
(* All rights reserved. *)
(* See the file COPYRIGHT for a full description. *)


(* File: AssignStmt.i3 *)
(* Last Modified On Fri Jun 24 08:56:06 PDT 1994 By kalsow *)
(* Modified On Tue Mar 20 01:30:09 1990 By muller *)


INTERFACE AssignStmt;


IMPORT Expr, Stmt, Type;


PROCEDURE Parse (): Stmt.T;


PROCEDURE Check (tlhs: Type.T; rhs: Expr.T; VAR cs: Stmt.CheckState);
(* check that rhs is assignable to a variable of type tlhs. *)


PROCEDURE Emit (tlhs: Type.T; rhs: Expr.T);
(* emit code to assign (s0.A).tlhs := rhs.
      Note that Emit assumes that TypeOf(rhs) is assignable to tlhs
      and that Expr.Prep(rhs) has been called. *)


PROCEDURE EmitCheck (tlhs: Type.T; rhs: Expr.T);
(* emit code to evaluate "rhs" and generate whatever
      runtime checks would be needed if it were assigned to
      a value of type 'tlhs'. The new value is left on the stack.
      Note that Emit assumes that TypeOf(rhs) is assignable to tlhs
      and that Expr.Prep(rhs) has been called. 'tlhs' may not be
      an open array type. *)


END AssignStmt.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.