\section{C-Code Instruction Representation}
\label{representation}

{\tt DOTS(X)} represents a pointer to the object {\tt X}. It is used
descriptively.  It is actually represented by the preprocessor
macros DEF, REF and DOT.

\begin{verbatim}
DEF(X) = & data[X]
REF(X) = data[x]
DOT(Y) = .value.record->data[Y]

indices ::= index | indices'.index

DOTS(indices)  ::= DEF(index) |  DOTS(indices')DOT(index)
*DOTS(indices) ::= REF(index) | *DOTS(indices')DOT(index)
\end{verbatim}

e.g. {\tt DOTS(1.3.2)} is:

\begin{verbatim}
     & data[1].value.record->data[3]).value.record->data[2]
\end{verbatim}

In {\bf C}-code, {\tt dst, src, src1, src2,} $\ldots$ are {\tt indices}.

\begin{verbatim}
TSDR(indices) ::= (*DOTS(indices)).tsdr

VALCELL(indices) ::= (*DOTS(indices)).value

SCALAR(indices) ::= (VALCELL(indices)).value.FAMILY |
		    *(VALCELL(indices)).value.real |
                    <constant operand value>
\end{verbatim}

The ubiquitous operations are:

\begin{verbatim}
DISCARD(dst) ::= fin_DATAREP(VALCELL(dst), F_DISCARD, args->sched); |
                 empty;

EQUAL(src1, src2) ::= eq_DATAREP(VALCELL(src1), VALCELL(src2)) |
                      (SCALAR(src1) == SCALAR(src2))

COPY(dst, src) ::=
  if ((ch_returncode = cp_DATAREP(& ch_dst, VALCELL(src))) != Normal)
    goto ch_raise_exception;
  DISCARD(dst);
  VALCELL(dst) = ch_dst;
  TSDR(dst) = & dr_DATAFAMILY; |
  *DOTS(dst) = *DOTS(src);
\end{verbatim}

Where {\tt DATAREP} is one of [{\tt callmessage, inport, nominal,
outport, polymorph,\newline program, real, record, table, variant,
unknown}].\footnote{ A special case could be made for {\tt EQUAL} of
{\tt nominal}.} When {\tt DATAREP} is {\tt unknown}:\footnote{
Of course {\tt DATAREP} would never be unknown if {\em type} and {\em
typestate} information were available.}
\begin{itemize}
\item {\tt fin{\uline}DATAREP} is expanded
{\tt (TSDR(dst)$\rightarrow$finalize)};\footnote{
This is almost always the case, since compact scalars can be finalized
in line, and only rarely are other objects locally known to be initialized.}
\item {\tt eq{\uline}DATAREP} is expanded {\tt (TSDR(src1)$\rightarrow$equal)};
\item {\tt cp{\uline}DATAREP} is expanded
{\tt (TSDR(dst)$\rightarrow$copy)}.
\item {\tt dr{\uline}DATAFAMILY} is replaced by {\tt TSDR(src)}.
\end{itemize}

The notation above is used to describe the representation of
specific {\bf li}-code instruction (see, so that:

\begin{verbatim}
    move 3.1 4
\end{verbatim}

represented as:

\begin{verbatim}
    DISCARD(3.1)
    *DOTS(3.1) = *DOTS(4);
    TSDR(4) = & dr_bottom;
\end{verbatim}

produces {\bf C}-code:

\begin{verbatim}
    (*(DEF(3)DOT(1).tsdr)->finalize)(DEF(3)DOT(1),F_DISCARD,sched);
    REF(3)DOT(1) = REF(4);
    REF(4).tsdr = & dr_bottom;
\end{verbatim}
