dkb@cs.brown.edu (Dilip Barman) (02/26/91)
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
hws@ICSI.Berkeley.EDU (Heinz Schmidt) (02/27/91)
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
hoelzle@Neon.Stanford.EDU (Urs Hoelzle) (02/27/91)
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. Look at "Incremental Attribute Evaluation with Side Effects" (the exact title may differ somewhat) by Gorel Hedin in the ECOOP'89 proceedings. It contains a nice OO grammar system which is used, among other things, for incremental semantic checking of Simula programs. There's also a corresponding TR from Lund Univ. -Urs -- ------------------------------------------------------------------------------ Urs Hoelzle hoelzle@cs.stanford.EDU Center for Integrated Systems, CIS 42, Stanford University, Stanford, CA 94305