Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!wuarchive!sdd.hp.com!ucsd!ucbvax!dog.ee.lbl.gov!pasteur!ICSI.Berkeley.EDU!hws From: hws@ICSI.Berkeley.EDU (Heinz Schmidt) Newsgroups: comp.object Subject: Re: Ideas for OO approaches to parsing Message-ID: <11471@pasteur.Berkeley.EDU> Date: 27 Feb 91 00:04:10 GMT References: <66193@brunix.UUCP> Sender: news@pasteur.Berkeley.EDU Reply-To: hws@ICSI.Berkeley.EDU (Heinz Schmidt) Organization: International Computer Science Institute, Berkeley, CA Lines: 32 In article <66193@brunix.UUCP>, dkb@cs.brown.edu (Dilip Barman) writes: |> |> |> This is somewhat an open-ended question, but I would like suggestions as to |> what an appropriate way might be to view parsing (from a grammar through |> to semantics, so I really mean lexical analysis, parsing, and maybe syntax- |> directed translation) from the OO perspective. Thanks in advance. |> |> Dilip Barman dkb@cs.brown.edu |> Brown University Dept. of Comp. Sci., Box 1910 |> Providence, RI 02912 (401)863-7666 One way to look at parsing and translations from an OO perspective is described in B.Kraemer,H.Schmidt: Developing Integrated Environments with ASDL IEEE Software Jan 1989 Particularly we consider syntax-directed translation schemes there: syntactic categories become classes and translation schemes are messages that are passed on from objects to their instance variables (substructures or semantic attributes) and either recursively construct new structures (translation) or update them (attributation). If you have parameterized classes in your OO language (or if you can simulate them) you may write translation rules for list, option and other extended BNF constructs and take advantage of inheritance. For instance LIST[X] can inherit from LIST. Typically this saves many rules. Cf. the article for more details. -------------------------------------------------------------------------- Heinz W. Schmidt hws@icsi.berkeley.edu International Computer Science Institute, Berkeley (415) 642-4274 x175 Brought to you by Super Global Mega Corp .com