Implementing types in a compiler (Paulo Jose Pinto - LEI)
29 Jan 1997 12:04:59 -0500

          From comp.compilers

Related articles
Implementing types in a compiler (1997-01-29)
Re: Implementing types in a compiler pertsserver! (1997-01-30)
Re: Implementing types in a compiler (John Lilley) (1997-01-30)
| List of all articles for this month |

From: (Paulo Jose Pinto - LEI)
Newsgroups: comp.compilers
Date: 29 Jan 1997 12:04:59 -0500
Organization: Faculdade de Ciencias e Tecnologia, U.N.L., Portugal
Keywords: types, question

I'm implementing an Object Pascal (Turbo Pascal v7.0 variant) compiler
in C++ and have implemented the information regarding the types in the
class Type which uses an union to represent all the kinds of types
(Pointers, Methods, Constants, etc) and I use the methods to acess the

But I DON'T LIKE this design, when I look at the code it always makes
more sense to me to create an abstract class Type and then use
ProcedureType, ConstType and other for all kinds of information. After
all when we have an union in C, that should be implement in C++ as an
abstract class and all the cases as descendents of that class. But
this requires some sort of dynamic_cast so that I know which member
function I can call, after all doesn't make sense to use a member
function GetParameter (....) in ConstType.

I would like to know what solutions you may have implemented in your

| Paulo Pinto, |

Post a followup to this message

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