Re: Typchecking for modern languages (Tom Linden)
28 Jun 2004 20:03:51 -0400

          From comp.compilers

Related articles
Typchecking for modern languages (2004-06-26)
Re: Typchecking for modern languages (2004-06-28)
Re: Typchecking for modern languages (Hans Aberg) (2004-06-28)
Re: Typchecking for modern languages (Daniel C. Wang) (2004-06-30)
| List of all articles for this month |

From: (Tom Linden)
Newsgroups: comp.compilers
Date: 28 Jun 2004 20:03:51 -0400
References: 04-06-101
Keywords: types
Posted-Date: 28 Jun 2004 20:03:51 EDT (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.