defined trait Expr defined class N defined class Var defined class Assign defined class Deref defined class A defined function isValue
Tuesday, December 3, 2024
What questions does your neighbor have?
What are procedures?
\[ \begin{array}{rrrl} \text{expressions} & e& \mathrel{::=}& \cdots \mid x \mathrel{\texttt{=}}e_1 \end{array} \]
What if we applied substitution as before?
Without procedure call, dynamically-allocated memory addresses seems overkill. \[ \begin{array}{rrrl} \text{memories} & m& \mathrel{::=}& \cdot\mid m[x \mapsto v] \end{array} \]
\[ \begin{array}{rrrl} \text{types} & \tau& \mathrel{::=}& \texttt{number}\mid\texttt{(}x\texttt{:}\, \mathbf{var}\,\tau \texttt{)} \mathrel{\texttt{=}\!\texttt{>}} \tau' \\ \text{values} & v& \mathrel{::=}& n\mid\texttt{(}x\texttt{:}\, \mathbf{var}\,\tau \texttt{)} \mathrel{\texttt{=}\!\texttt{>}} e_1 \\ \text{expressions} & e& \mathrel{::=}& n\mid\texttt{(}x\texttt{:}\, \mathbf{var}\,\tau \texttt{)} \mathrel{\texttt{=}\!\texttt{>}} e_1 \mid x \mid e_1\texttt{(}e_2\texttt{)} \mid x \mathrel{\texttt{=}}e_1 \mid\mathord{\texttt{*}}a \end{array} \]
defined trait Expr defined class N defined class Var defined class Assign defined class Deref defined class A defined function isValue
defined class Mem defined object Mem
defined class DoWith defined object DoWith import DoWith._
defined function memalloc
defined function substitute
defined function step
Small changes in \(\TirName{DoCall}\).
\[ \begin{array}{rrrl} \text{types} & \tau& \mathrel{::=}& \texttt{number}\mid\texttt{(}x\texttt{:}\, m\,\tau \texttt{)} \mathrel{\texttt{=}\!\texttt{>}} \tau' \\ \text{values} & v& \mathrel{::=}& n\mid\texttt{(}x\texttt{:}\, m\,\tau \texttt{)} \mathrel{\texttt{=}\!\texttt{>}} e_1 \\ \text{expressions} & e& \mathrel{::=}& n\mid\texttt{(}x\texttt{:}\, m\,\tau \texttt{)} \mathrel{\texttt{=}\!\texttt{>}} e_1 \mid x \mid e_1\texttt{(}e_2\texttt{)} \mid m\;x\;\texttt{=}\;e_1\texttt{;}\;e_2 \\ \text{parameter modes} & m& \mathrel{::=}& \mathbf{const}\mid\mathbf{name} \end{array} \]
Reference parameters (as in C++ and C#)?
Out parameters (as in C#)?
In-out parameters (as in Ada)?
First-class addresses (i.e., when “addresses are values”).
\[ \begin{array}{rrrl} \text{expressions} & e& \mathrel{::=}& n \mid\texttt{\{} \overline{ f\texttt{:}\,e } \texttt{\}} \mid e_1 \mathrel{\texttt{=}}e_2 \mid e_1\texttt{.}f \mid x \mid\mathbf{const}\;x\;\texttt{=}\;e_1\texttt{;}\;e_2 \\ \text{values} & v& \mathrel{::=}& n\mid a \\ \text{location values} & l& \mathrel{::=}& a\texttt{.}f \\ \text{addresses} & a \end{array} \]