A representation of types, type-checker, method and compiler are provided
for checking consistency in various forms of an intermediate language.
Specifically, the typed intermediate language is suitable for use in
representing programs written in multiple (heterogeneous) source
languages including typed and untyped languages, loosely and strongly
typed languages, and languages with and without garbage collection. An
unknown type representation indicates that an element of the intermediate
language is associated with an unknown type. A method of type-checking a
code segment written in a programming language is provided using a rule
set that contains rules for type-checking an unknown type. The unknown
type allows for selectively retaining type information as the compilation
process continues and allows multiple programming languages to be
type-checked by the same type system.