Kind analysis for MATLAB

  • Authors:
  • Jesse Doherty;Laurie Hendren;Soroush Radpour

  • Affiliations:
  • McGill University, Montreal, PQ, Canada;McGill University, Montreal, PQ, Canada;McGill University, Montreal, PQ, Canada

  • Venue:
  • Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

MATLAB is a popular dynamic programming language used for scientific and numerical programming. As a language, it has evolved from a small scripting language intended as an interactive interface to numerical libraries, to a very popular language supporting many language features and libraries. The overloaded syntax and dynamic nature of the language, plus the somewhat organic addition of language features over the years, makes static analysis of modern MATLAB quite challenging. A fundamental problem in MATLAB is determining the kind of an identifier. Does an identifier refer to a variable, a named function or a prefix? Although this is a trivial problem for most programming languages, it was not clear how to do this properly in MATLAB. Furthermore, there was no simple explanation of kind analysis suitable for MATLAB programmers, nor a publicly-available implementation suitable for compiler researchers. This paper explains the required background of MATLAB, clarifies the kind assignment program, and proposes some general guidelines for developing good kind analyses. Based on these foundations we present our design and implementation of a variety of kind analyses, including an approach that matches the intended behaviour of modern MATLAB 7 and two potentially better alternatives. We have implemented all the variations of the kind analysis in McLab, our extensible compiler framework, and we present an empirical evaluation of the various analyses on a large set of benchmark programs.