LARA

Accessing and Storing Variables

Local Variables

Instructions to load and store local variables:

Assigning indices (called slots) to local variables:

Function $slot : Var \to Int$

  • maps variable ocurrence, not name (part of symbol table)

Translation Rules for Local Variables

If $x$ is local variable and we translate expression, then

\begin{equation*}
   [\![ x ]\!] = \textbf{iload}(slot(x))
\end{equation*}

For assignment to local variable $x=e$, we have

\begin{equation*}
  [\![x=e]\!] = [\![e]\!] ::: \textbf{istore}(slot(x))
\end{equation*}

Static Variables

Instance Variables (Fields)