Implementing polymorphic typing in a logic programming language

  • Authors:
  • Keehang Kwon;Gopalan Nadathur;Debra Sue Wilson

  • Affiliations:
  • Department of Computer Science, Duke University, Durham, NC 27706, U.S.A.;Department of Computer Science, Duke University, Durham, NC 27706, U.S.A.;Department of Computer Science, Duke University, Durham, NC 27706, U.S.A.

  • Venue:
  • Computer Languages
  • Year:
  • 1994

Quantified Score

Hi-index 0.00

Visualization

Abstract

Introducing types into a logic programming language leads to the need for typed unification within the computation model. In the presence of polymorphism and higher-order features, this aspect forces analysis of types at run-time. We propose extensions to the Warren Abstract Machine (WAM) that permit such analysis to be done with reasonable efficiency. Much information about the structures of types is present at compile-time, and we show that this information can be used to considerably reduce the work during execution. We illustrate our ideas in the context of a typed version of Prolog. We describe a modified representation for terms, new instructions and additional data areas that in conjunction with existing WAM structures suffice to implement this language. The nature of compiled code is illustrated through examples, and the kind of run-time overheads that are incurred for processing types is analyzed, especially in those cases where others have shown that type checking can be eliminated during execution. The ideas presented here are being used in an implementation of the higher-order language called @l Prolog.