(* Copyright (C) 1990, Digital Equipment Corporation. *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* Last modified on Wed Mar 21 00:53:20 1990 by muller *) INTERFACE M3ASTRep; (* This interface defines the private representation of Abstract Syntax Trees. It is intended to be implementation-dependent; containing whatever decorations are appropriate for a particular compiler or programming environment. In particular, the M3ASTRep interface for SRC Modula-3 is "owned" by the compiler and interpreter; other clients would be wise to use the property list or a procedural interface implemented by ASTRep. It also reveals the representations of the other types that were left unspecified, for example, M3Entity.Variable. *) IMPORT M3AST, M3Scope, M3Value; (* Reveal the presence of scopes in those nodes that have them: *) REVEAL M3AST.Interface = M3AST.CompilationUnit OBJECT safe: BOOLEAN; name: Id; imports: REF ARRAY OF AST.Import; decls: REF ARRAY OF AST.Declaration; END OBJECT scope: Scope.T END; (* Notice that we repeat the prefix revealed in AST.i3, and then extend it with the scope field. Each node type will be treated this way. This means that if public fields are changed, then both AST and ASTRep must be edited. If either edit is forgotten, the compiler will flag the error. This is consistent with the way procedure signatures are handled in interfaces and implementations. *) AST.Module = CompilationUnit OBJECT safe: BOOLEAN; name: Id; imports: REF ARRAY OF AST.Import; exports: AST.IDlist; block: AST.Block END OBJECT scope: Scope.T END; M3AST.ProcDeclaration = ... OBJECT scope: Scope.T END; M3AST.ForStmt = ... OBJECT scope: Scope.T END; M3AST.TCase = ... OBJECT scope: Scope.T END; M3AST.Handler = ... OBJECT scope: Scope.T END; M3AST.WithBinding = ... OBJECT scope: Scope.T END; (* Reveal the presence of the fields that resolve overloading: *) AST.Application = ... OBJECT op: M3Entity.Operation END; (* Revelations concerning M3Entity.Variables: *) REVEAL M3Entity.Variable = M3Entity.T OBJECT ... END; M3Entity.Parameter = M3Entity.Variable OBJECT ... END; M3Entity.Local = M3Entity.Variable OBJECT ... END; M3Entity.Global = M3Entity.Variable OBJECT ... END; (* ... here go the other revelations needed by the compiler and interpreter ... *) END M3ASTRep.