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.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.