08.11.2014 Views

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

COMPILER TECHNIQUES FOR MATLAB PROGRAMS ... - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2<br />

RELATED WORK<br />

There are many examples of typeless programming languages, including APL, <strong>MATLAB</strong>,<br />

ML [GMW79], Haskell [HWA + 88], Lisp [MAE + 65], and Smalltalk [GR83]. These languages<br />

can be divided in two classes: the statically typed languages (e.g., ML and Haskell) and the<br />

dynamically typed languages (e.g., Lisp, Smalltalk, APL, and <strong>MATLAB</strong>).<br />

Statically typed languages include type constraints as part of their language denition.<br />

Hence, type inference is necessary to ensure that these type constraints are satised. These<br />

type constraints allow compilers to deduce most of the type information, thereby making<br />

run-time type-checking unnecessary.<br />

For cases in which the type-checker cannot deduce<br />

the type of a valid expression, the user must provide the type information. Normally in<br />

these languages, the type inference must be accurate enough to satisfy the language's type<br />

constraints. Thus, the type-checker may sometimes nd a more generic type assignment<br />

than expected.<br />

A classical example is the language ML, a meta-language for theorem proving, where<br />

the main motivation for strict type-checking is to ensure that every computed value of type<br />

theorem is indeed a theorem [GMW79]. To facilitate type inferencing, several restrictions<br />

are imposed to the language. For example, ML does not allow expressions with mixed types.<br />

Thus, a function denition<br />

fun successor(n) = n+1<br />

will be considered a function that takes an integer as argument (n) and returns another<br />

7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!