Type Inference for Action Semantics
Abstract
In a series of papers [11,12,13,14,15,25,26], Mosses and Watt defme action semantics, a metalanguage for high level, domain-independent formulation of denotational semantics definitions. Action semantics was designed to support readability, abstraction, modularity, and modifiability of language definitions [13,15]. In our recent work [5], we studied a combinator-based version of action semantics. We developed a typing system for actions based on types and k/nds. The types within a kind are partially ordered to reflect subtyping. We then defined a category-sorted algebra model [18,20] for the system where actions are natural transformations over interpretation functors (which map the type names and their ordering to predomains and coercion functions). Thus, an action is a family of continuous functions that behave consistently with respect to the subtyping relation. Coercion functions-even nonembeddings-disappear. The typing system and its interpretation support an ML-style type inference algorithm for action expressions. Type inference must respect the subtyping laws, so we encounter the problems discovered by Mitchell [10], Fuh and Mishra [6], and Wand [24] regarding constraints sets. But action notation and its model are formulated so that the major problems regarding constraints are "restricted away." In particular, the monotonic behavior of actions with respect to the subtyping ordering keeps the cardinality of constraints sets small and makes constraints on record types unnecessary, even in the presence of record union and concatenation operations. This paper presents our variant of action semantics and its typing system. We give the type inference algorithms, state properties that action semantics expressions satisfy, give soundness and completeness properties and explain why they hold for type inference on action semantics expressions. We also present a small example.