Re: Typchecking for modern languages

tom@kednos.com (Tom Linden)
28 Jun 2004 20:03:51 -0400

          From comp.compilers

Related articles
Typchecking for modern languages anthonygetz@aol.com (2004-06-26)
Re: Typchecking for modern languages tom@kednos.com (2004-06-28)
Re: Typchecking for modern languages haberg@matematik.su.se (Hans Aberg) (2004-06-28)
Re: Typchecking for modern languages danwang74@hotmail.com (Daniel C. Wang) (2004-06-30)
| List of all articles for this month |
From: tom@kednos.com (Tom Linden)
Newsgroups: comp.compilers
Date: 28 Jun 2004 20:03:51 -0400
Organization: http://groups.google.com
References: 04-06-101
Keywords: types
Posted-Date: 28 Jun 2004 20:03:51 EDT

anthonygetz@aol.com (AnthonyGetz) wrote
> I'm looking for books or papers that explain how to implement
> typechecking inside a compiler.
>
> Typechecking for Pascal is easy... I need to understand how to
> implement typechecking for languages that combine inheritance with
> parametric polymorphism (such as the new proposals for Generic Java
> and Generic C#).
>
> Any pointers or other help would be appreciated.


You will need a declaration validation phase following the parse phase
which walks the symbol table. For efficient validation techniques see
the declare phase of the Multics PL/I compiler, which uses a bit matrix
ordered both row and column by data-type. The data type in the
symbol node is a bit vector with some bit set according to the data type
of the object. Thus validation is reduced to an & operation of the bit
vector with appropriate rows of the bit matrix as determined by context.


Of course, if your generic types are not statically constrained then you have
an ad hoc language and will have to employ ad hoc techniques.


Post a followup to this message

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