Affiliation:
1. Northwestern University, IL
Abstract
In recent times, the MATLAB language has emerged as a popular alternative for programming in diverse application domains such as signal processing and meteorology. The language has a powerful array syntax with a large set of pre-defined operators and functions that operate on arrays or array sections, making it an ideal candidate for applications involving substantial array-based processing.Yet, for all the programming convenience that the language offers, designing a parser and scanner capable of mimicking the language's syntax has proven to be an acutely difficult task. The language has many context-sensitive constructions, and though numerous front-end implementations of MATLAB and MATLAB-like languages exist, not much has been discussed regarding the efficient compile-time parsing of such languages or how its syntax impacts the parsing process.In this paper, we present the design and implementation of a compiler front-end for the MATLAB language. We discuss in detail both the indigenously designed grammar responsible for syntax analysis as well as the lexical specification that complements the grammar. In the course of our attempts to emulate MATLAB's syntax, we were able to unravel certain key issues relating to its syntax, such as the complications arising in parsing command-form function invocations within a compile-time environment, the context-sensitive interpretation of the single quote character, and the translation of white space within matrices into element separators.The front-end effects a conversion of the original source to an intermediate form in which statements are represented as abstract syntax trees and the flow of control between statements by a control-flow graph. All subsequent compiler passes work on this intermediate representation.The front-end was designed and implemented as part of the MATCH project, which addresses the translation of a MATLAB program by a compiler onto a heterogeneous target consisting of embedded and commerical-off-the-shelf processors.
Publisher
Association for Computing Machinery (ACM)
Reference13 articles.
1. http://www.ece.nwu.edu/cpdc/Match/Match. html The MATCH Project Home Page. http://www.ece.nwu.edu/cpdc/Match/Match. html The MATCH Project Home Page.
2. http://www.mathworks.com/ The MathWorks: Developers of MATLAB Simulink and Stateflow for Technical Computing. http://www.mathworks.com/ The MathWorks: Developers of MATLAB Simulink and Stateflow for Technical Computing.
3. http://www.che.wisc.edu/octave/ The Octave Home Page. http://www.che.wisc.edu/octave/ The Octave Home Page.
4. Does APL really need run-time checking?