A Sound Polymorphic Type System for a Dialect of C (PREPRINT)

Abstract

Advanced polymorphic type systems have come to play an important role in the world of functional programming. But, so far, these type systems have had little impact upon widely-used imperative programming languages like C and C++. We show that ML-style polymorphism can be integrated smoothly into a dialect of C, which we call Polymorphic C. It has the same pointer operations as C, including the address-of operator &, the dereferencing operator *, and pointer arithmetic. We give a natural semantics for Polymorphic C, and prove a type soundness theorem that gives a rigorous and useful characterization of what can go wrong when a well-typed Polymorphic C program is executed. For example, a well-typed Polymorphic C program may fail to terminate, or it may abort due to a dangling pointer error. Proving such a type soundness theorem requires a notion of an attempted program execution; we show that a natural semantics gives rise quite naturally to a transition semantics, which we call a natural transition semantics, that models program execution in terms of transformations of partial derivation trees. This technique should be generally useful in proving type soundness theorems for languages defined using natural semantics.

Open PDF

Document Details

Document Type
Technical Report
Publication Date
Mar 31, 1997
Accession Number
ADA495127

Entities

People

  • Dennis Volpano
  • Geoffrey B. Smith

Organizations

  • Florida International University

Tags

DTIC Thesaurus Topics

  • C Programming Language
  • Computational Science
  • Computer Programming
  • Computer Science
  • Computers
  • Cybersecurity
  • Grammars
  • Information Processing
  • Java Programming Language
  • Judgment
  • Language
  • Linguistics
  • New York
  • Procedural Programming Language
  • Programming Languages

Fields of Study

  • Computer science

Readers

  • Computational Linguistics
  • Educational Psychology