skip to main content
research-article

Kind analysis for MATLAB

Published:22 October 2011Publication History
Skip Abstract Section

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.

References

  1. G. Almási and D. Padua. MaJIC: compiling MATLAB for speed and responsiveness. In PLDI '02: Proceedings of the ACM SIGPLAN 2002 Conference on Programming language design and implementation, pages 294--303, New York, NY, USA, 2002. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. M. Chevalier-Boisvert, L. Hendren, and C. Verbrugge. Optimizing MATLAB through Just-In-Time Specialization. In International Conference on Compiler Construction, pages 46--65, March 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. INRIA. Scilab, 2009. http://www.scilab.org/platform/.Google ScholarGoogle Scholar
  4. P. G. Joisha and P. Banerjee. Correctly detecting intrinsic type errors in typeless languages such as MATLAB. In APL '01: Proceedings of the 2001 conference on APL, pages 7--21, New York, NY, USA, 2001. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. J. Li. McFOR: A MATLAB to FORTRAN 95 compiler. Master's thesis, McGill University, Montreal, Canada, 2009.Google ScholarGoogle Scholar
  6. MathWorks. MATLAB Documentation, 2010. http://www.mathworks.com/.Google ScholarGoogle Scholar
  7. McLab. McLab. http://www.sable.mcgill.ca/mclab/.Google ScholarGoogle Scholar
  8. Octave. GNU Octave. http://www.gnu.org/software/octave/index.html.Google ScholarGoogle Scholar
  9. L. D. Rose and D. Padua. Techniques for the translation of MATLAB programs into Fortran 90. ACM Trans. Program. Lang. Syst., 21(2):286--323, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Kind analysis for MATLAB

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 46, Issue 10
      OOPSLA '11
      October 2011
      1063 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2076021
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications
        October 2011
        1104 pages
        ISBN:9781450309400
        DOI:10.1145/2048066

      Copyright © 2011 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 22 October 2011

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!