| | |
Summary: Properties of a Firstorder Functional Language with Sharing
Zena M. Ariola
Computer & Information Science Department
University of Oregon
Arvind
Laboratory for Computer Science
Massachusetts Institute of Technology
A calculus and a model for a firstorder functional language with sharing is presented. In most implementations
of functional languages, argument subexpressions in a function application are shared to avoid their repeated
evaluation. Recursive functions are typically implemented using graphs with cycles. Compilers for these lan
guages sometimes employ nonleftlinear and leftcyclic rules for optimizations. A Graph Rewriting System
(GRS) to address these concerns is developed. It is shown that a GRS without interfering rules is confluent.
Along the lines of L'evy's term model for the –calculus, a semantics of such a GRS is also presented. An
application of the term model to compiler optimizations is discussed.
1. Introduction
Sharing of subexpressions is of utmost importance in the implementation of functional languages. Consider
the function definition F x = x+x and the expression F(2+3). Any decent implementation, independently of
the evaluation strategy (normalorder or applicativeorder) it employs, will evaluate the subexpression 2 + 3
only once. Several compiler optimizations are about increasing the sharing of subexpressions to avoid their
repeated evaluation. In this paper, we discuss the syntactic and semantic properties of a calculus, which is
|