A Rewriting Logic Approach to Type Inference [chapter]

Chucky Ellison, Traian Florin Şerbănuţă, Grigore Roşu
2009 Lecture Notes in Computer Science  
Meseguer and Ros , u proposed rewriting logic semantics (RLS) as a programing language definitional framework that unifies operational and algebraic denotational semantics. RLS has already been used to define a series of didactic and real languages, but its benefits in connection with defining and reasoning about type systems have not been fully investigated. This paper shows how the same RLS style employed for giving formal definitions of languages can be used to define type systems. The same
more » ... ermrewriting mechanism used to execute RLS language definitions can now be used to execute type systems, giving type checkers or type inferencers. The proposed approach is exemplified by defining the Hindley-Milner polymorphic type inferencer W as a rewrite logic theory and using this definition to obtain a type inferencer by executing it in a rewriting logic engine. The inferencer obtained this way compares favorably with other definitions or implementations of W . The performance of the executable definition is within an order of magnitude of that of highly optimized implementations of type inferencers, such as that of OCaml. WADT'08, LNCS 5486, pp 135-151. 2009 UNIFY is a procedure that delivers no result, but has a side effect on a global substitution E. If UNIFY(σ, τ ) changes E to E , and if U (Eσ, Eτ ) = U , then E = U E, where U is a unification generator. Fig. 8. Milner's J Algorithm WADT'08, LNCS 5486, pp 135-151. 2009
doi:10.1007/978-3-642-03429-9_10 fatcat:v5zmfibm5jerhpmxtcw4xn6hgq