Re: Compiler construction in C++ and OOD (Stefan Vaillant)
Mon, 8 Feb 1993 18:22:36 GMT

          From comp.compilers

Related articles
Compiler construction in C++ and OOD (1993-02-03)
Re: Compiler construction in C++ and OOD (1993-02-04)
Re: Compiler construction in C++ and OOD (1993-02-08)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Stefan Vaillant)
Keywords: OOP, C++
Organization: Rechnerbetrieb Informatik - RWTH Aachen
References: 93-02-032
Date: Mon, 8 Feb 1993 18:22:36 GMT (Vivek Buzruk) writes:
>I will be happy if any one tells whether any complete compiler is written
>in C++ either. Also in what way C++ is used, only as a better C or flavor
>of OOD.

Sather, an Eiffel dialect, is implemented with object-orientation in mind.
The compiler is written in Sather (of course), but IMHO it is worth having
a look at it, even if you are interesseted in C++.

The compiler has the following structure: The front-end is written in
yacc. The action-parts construct an abstract syntax tree. Each node of
this tree is an object and has an individual interface. For example, the
node which represents the IF-statement has the following attributes:

class COND_STMTOB is
      test: EXPREOB; -- reference to expression node
      then_part: LST_STMTOB; -- List of statements
      else_part: LST_STMTOB;

Every node (or object) has some methods for doing a semantic check and for
generating code. (This is not quite correct. I had only a quick look at
the source
  one year ago.)

You can obtain sather (incl. source code of the compiler) from

IMHO this is not totally new, but clean and easy to understand.

You might also have a look at
    - the book of Rumbaugh et. all. "Object Oriented Modeling and Design".
        They have some examples with syntax trees representing
    - the Eiffel scanner/parser library.

Stefan Vaillant

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.