A Rewriting Logic Approach to Type Inference

  • Authors:
  • Chucky Ellison;Traian Florin Şerbănuţă;Grigore Roşu

  • Affiliations:
  • Department of Computer Science, University of Illinois at Urbana-Champaign, ;Department of Computer Science, University of Illinois at Urbana-Champaign,;Department of Computer Science, University of Illinois at Urbana-Champaign,

  • Venue:
  • Recent Trends in Algebraic Development Techniques
  • Year:
  • 2009

Quantified Score

Hi-index 0.00

Visualization

Abstract

Meseguer and Roş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 term-rewriting 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 $\mathcal{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 $\mathcal{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.