mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-09 16:28:47 +00:00
Pre-1.00 branch
This commit is contained in:
parent
2a412f5e04
commit
d021bb40e4
3 changed files with 56 additions and 5 deletions
|
|
@ -1,5 +1,23 @@
|
|||
\chapter{Introduction}
|
||||
|
||||
\input{01.01.general_characteristics}
|
||||
\input{01.02.notation}
|
||||
\input{01.03.values}
|
||||
\lama is a programming language developed by JetBrains Research for education purposes. Its general characteristics are:
|
||||
|
||||
\begin{itemize}
|
||||
\item procedural with first-class functions~--- functions can be passed as arguments, placed in data structures,
|
||||
returned and constructed at runtime via closures mechanism;
|
||||
\item with lexical static scoping;
|
||||
\item strict~--- all arguments of function application are evaluated before function body;
|
||||
\item imperative~--- variables can be re-assigned, function calls can have side effects;
|
||||
\item untyped~--- no static type checking is performed;
|
||||
\item with S-expressions and pattern-matching;
|
||||
\item with user-defined infix operators, including those defined in local scopes;
|
||||
\item with automatic memory management (garbage collection).
|
||||
\end{itemize}
|
||||
|
||||
The name \lama is an acronym for $\lambda\textsc{-Algol}$ since the language has borrowed the syntactic shape of
|
||||
operators from \textsc{Algol-68}; \textsc{Haskell}~\cite{haskell} and \textsc{OCaml}~\cite{ocaml} can be
|
||||
mentioned as other languages of inspiration.
|
||||
|
||||
%\input{01.01.general_characteristics}
|
||||
%\input{01.02.notation}
|
||||
%\input{01.03.values}
|
||||
|
|
|
|||
|
|
@ -94,6 +94,39 @@ where "$x$"~--- a fresh variable which does not occur free in "$e$".
|
|||
|
||||
\section{Dot Notation}
|
||||
|
||||
\section{Mutable Closures}
|
||||
A function call
|
||||
|
||||
\begin{lstlisting}
|
||||
$f$ ($e_1$, ..., $e_k$)
|
||||
\end{lstlisting}
|
||||
|
||||
where $f$~--- an identifier~--- can be rewritten as
|
||||
|
||||
\begin{lstlisting}
|
||||
$e_1$.$f$ ($e_2$, ..., $e_k$)
|
||||
\end{lstlisting}
|
||||
|
||||
In particular, a call to a one-argument function $f (e)$ can be rewritten as $e.f$.
|
||||
|
||||
\section{Patterns in Function Arguments}
|
||||
|
||||
Patterns can be used in function argument specification: a declaration
|
||||
|
||||
\begin{lstlisting}
|
||||
fun f ($p_1$, ..., $p_k$) { e }
|
||||
\end{lstlisting}
|
||||
|
||||
is equivalent to
|
||||
|
||||
\begin{lstlisting}
|
||||
fun f ($x_1$, ..., $x_k$) {
|
||||
case $x_1$ of
|
||||
$p_1$ -> case $x_2$ of
|
||||
... -> e
|
||||
esac
|
||||
esac
|
||||
}
|
||||
\end{lstlisting}
|
||||
|
||||
where $x_i$~--- fresh variables, not free in $e$.
|
||||
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ language=alm
|
|||
\tableofcontents
|
||||
|
||||
\input{01.introduction}
|
||||
\input{02.abstract_syntax_and_semantics}
|
||||
%\input{02.abstract_syntax_and_semantics}
|
||||
\input{03.concrete_syntax}
|
||||
\input{04.extensions}
|
||||
\input{05.driver_options}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue