writiiiiing

This commit is contained in:
2024-07-09 06:16:13 +00:00
parent 9672035ba3
commit 1b7f772e1d
2 changed files with 47 additions and 1 deletions

View File

@@ -251,7 +251,7 @@ Additional typing rules to usual simply-typed lambda calculus are shown in Fig.\
In the W-calculus, a starting point of designing \lambdammm, function types can takes tuples of real numbers and return tuples of real numbers. This means that higher-order functions cannot be written. While this restriction is reasonable as a design choice for a language for signal processing since higher-order functions require data structures that require dynamic memory allocation, such as closures, for their implementation, it also lacks the generality of the lambda calculus.
In \lambdammm, the problem of memory allocation for closures is left to the implementation of the runtime, and higher-order functions are allowed. However, the $feed$ abstraction does not allow function types as its input and output. Allowing the return of function types in the $feed$ abstraction means that it is possible to define functions whose processing contents change time-to-time. While this may be interesting theoritically, there are currently no practical cases in real-world signal processing, and it is expected to further complicate implementations.
In \lambdammm, the problem of memory allocation for closures is left to the implementation of the runtime in the Section\ref{sec:vm}, and higher-order functions are allowed. However, the $feed$ abstraction does not allow function types as its input and output. Allowing the return of function types in the $feed$ abstraction means that it is possible to define functions whose processing contents change time-to-time. While this may be interesting theoritically, there are currently no practical cases in real-world signal processing, and it is expected to further complicate implementations.
\input{typing.tex}
@@ -269,10 +269,24 @@ The operational semantics of the \lambdammm is shown in Fig.\ref{fig:semantics}.
\section{VM Model and Instruction Set}
\label{sec:vm}
A model for the virtual machine and its instruction set is based on Lua 5.0\cite{ierusalimschy2005}. \textit{upvalue}
When executing a computational model based on lambda calculus, the problem is how to handle a data structure called a closure that captures the variable environment where the inner function is defined, to refer the outer variables from the inner function context. If the dictionary data of names and values of variables are paired with inner function, implementation of the compiler(intepreter) is simple, but run-time performance is limited.
On the contrary, a runtime performance can be improved by performing a process called closure transformation (or lambda lifting), which analyses all the names of outer variables referred by the inner function and transforms the inner function by adding argument so that the variables can be referred explicitly, but the compiler implementation of the transformation is relatively complex.
The Lua VM takes an intermediate approach between these two by adding the VM instructions \textit{GetUpValue/SetUpValue}, which allows the outer variables to be referenced dynamically at runtime. The implementation of compiler and VM using \textit{UpValue} is simpler than closure conversion, while at the same time preventing execution performance degradation, as outer variables can be referenced via the call stack rather than on the heap memory while the closure object is executed in the context of the original function\cite{nystrom2021}.
\subsection{Instruction Set}
\label{sec:instruction}
\begin{lstlisting}[label=lst:instruction,caption=Instruction set for VM to run \lambdammm]
Upvalue
\end{lstlisting}
\section{Discussion}