A Sound Polymorphic Type System for a Dialect of C
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 has 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 wwe call Polymorphic C. It has the same ppointer operatins as C, including the address-of operator &, the dereferencing operator * and pointer srithmetic. 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 in executed. For example, a well-typed Polymorphic
c program may fail to terminate, or it may abortdue to a dangling pointer error. Proving such a type soundness theorem requuires a notion of an attempted program execution; we show that a natural semantics theorem gives rise quite naturally to a transition semantics, which we calla natural transtition semantics, that models program execution in terms of transformatins of partial derivation trees. This techique should be generally useful in proving type soundness for languages defined using natural semantics.
Description
The article of record as published may be found at http://dx.doi.org/
Rights
This publication is a work of the U.S. Government as defined in Title 17, United States Code, Section 101. Copyright protection is not available for this work in the United States.Collections
Related items
Showing items related by title, author, creator and subject.
-
A type inference algorithm and transition semantics for polymorphic C
Özgen, Mustafa (Monterey, California. Naval Postgraduate School, 1996-09);In an attempt to bring the ML-style type inference to the C programming language, Smith and Volpano developed a type system for a dialect of C, called PolyC SmV96a SmV95b. PolyC extends C with ML-style polymorphism and a ... -
Towards an implementation of Polymorphic C
Bonem, Peter Bryant (Monterey, California. Naval Postgraduate School, 1995-09);Functional programming languages incorporate a number of powerful features, including advanced polymorphic type systems and first-class, higher- order functions. However, these important features have had little effect ... -
Towards an ML-style Polymorphic Type System for C
Smith, Geoffrey; Volpano, Dennis (1996-04);Advanced polymorphic type systems have come to play an important role in the world of functional programming. But, curiously, these type systems have so far had little impact upon widely-used imperative programming languages ...