Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!ginosko!usc!henry.jpl.nasa.gov!elroy.jpl.nasa.gov!hacgate!ashtate!markg From: markg@ashtate (Mark Grand) Newsgroups: comp.object Subject: Re: OOD applied to interpreters and compilers Summary: Compilers can need multiple instances of their components Keywords: OOD interpreters Message-ID: <754@ashton.UUCP> Date: 4 Oct 89 21:33:39 GMT References: <26873@genrad.UUCP> <5472@portia.Stanford.EDU> Organization: Ashton-Tate, Torrance, CA Lines: 29 dchapman@portia.Stanford.EDU (David Chapman) writes: > Sure. I'm working on a compiler for an internal language that has two > different code generators. I defined a "code generator" interface (the > language, MAINSAIL, isn't quite object-oriented in the sense that > Smalltalk or C++ are) and wrote two different modules that implemented > that interface. > > The primary reason that you don't think in terms of objects for > something like a compiler is that you only have _one_ of the "objects" > at a time - one lexical analyzer feeds one parser feeds one optimizer Some years ago I was writing a compiler for a language that really did need to be able to have muliple instances of its lexical analyzer, parser, and friends. The reason for this was that when an undefined reference to a certain class of object was encountered in the source, the compiler was supposed to suspend what it was doing and go compile another file that was supposed to define the object. This compiler was written in MAINSAIL. ---------------- Mark Grand Ashton-Tate markg@alexis.a-t.com Walnut Creek Development Center ...!ashtate!alexis!markg 2033 N. Main Street, Suite 980 Walnut Creek, CA 94596-3722 (415) 746-1570