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.
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- INRIA. Scilab, 2009. http://www.scilab.org/platform/.Google Scholar
- 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 Scholar
Digital Library
- J. Li. McFOR: A MATLAB to FORTRAN 95 compiler. Master's thesis, McGill University, Montreal, Canada, 2009.Google Scholar
- MathWorks. MATLAB Documentation, 2010. http://www.mathworks.com/.Google Scholar
- McLab. McLab. http://www.sable.mcgill.ca/mclab/.Google Scholar
- Octave. GNU Octave. http://www.gnu.org/software/octave/index.html.Google Scholar
- 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 Scholar
Digital Library
Index Terms
Kind analysis for MATLAB
Recommendations
Taming MATLAB
OOPSLA '12MATLAB is a dynamic scientific language used by scientists, engineers and students worldwide. Although MATLAB is very suitable for rapid prototyping and development, MATLAB users often want to convert their final MATLAB programs to a static language ...
Kind analysis for MATLAB
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsMATLAB 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 ...
PID Control of Inverted Pendulum Using Adams and Matlab Co-Simulation
ICCMA '16: Proceedings of the 4th International Conference on Control, Mechatronics and AutomationThis research is aimed at developing a multi-body simulation model and control of an inverted pendulum. A virtual prototype of the inverted pendulum is built by using MSC Adams software and the plant model is exported to MATLAB. It is co-simulated in ...







Comments