 |
 |
MAGICA is used through a front-end, which is a
separate operating system process that builds a Mathematica
representation of an input MATLAB program. The front-end
transfers the representation to MAGICA for type analysis; the
type inferences that MAGICA generates are transferred back, for
use in type-related optimizations, code generation or simply
for code annotation and visualization. Exchanges between the
front-end and MAGICA happen across an interprocess
communication link using the MathLink
protocol. The figure below shows three existing front-ends to
MAGICA. Two of these - the GUI-based notebook and the
text-based interface - are shipped with Mathematica.
Interacting with MAGICA using them requires either the
handcrafting of the program representations that are to be type
inferred, or the availability of those representations on disk.
(In[6] and
In[18] in the
tutorial are examples of
handcrafted representations;
In[46] in the same uses
prefabricated representations.) The third front-end, called
MAT2C, is a custom-built one that takes a MATLAB program in its
native form and translates it to optimized C; it uses MAGICA as
the inference engine to obtain the necessary type information.
In fact, it was by using MAT2C that the M-file contexts for
some of the examples in the
tutorial were produced in
advance. The figure below also shows the disk image of a sample
M-file context.
|
 |
 |
|
|
|
|
 |