mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Let-expr to the spec
This commit is contained in:
parent
266933500a
commit
56fcd832cb
3 changed files with 29 additions and 3 deletions
BIN
lama-spec.pdf
BIN
lama-spec.pdf
Binary file not shown.
|
|
@ -141,7 +141,33 @@ There are three forms of expressions to specify composite values: arrays, lists
|
||||||
|
|
||||||
\subsection{Let Expressions}
|
\subsection{Let Expressions}
|
||||||
|
|
||||||
TODO
|
\begin{figure}[h]
|
||||||
|
\[
|
||||||
|
\begin{array}{rcll}
|
||||||
|
\defterm{letExpression} & : & \term{let}\s\nonterm{pattern}\s\term{=}\s\nonterm{expression}\s\term{in}\s\nonterm{expression}
|
||||||
|
\end{array}
|
||||||
|
\]
|
||||||
|
\caption{Let-expression syntax}
|
||||||
|
\label{let_expression}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
|
Let expression is a derived syntactic form for a one-branch case-expression. An expression
|
||||||
|
|
||||||
|
\begin{lstlisting}
|
||||||
|
let p = e in b
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
|
is equivalent to
|
||||||
|
|
||||||
|
\begin{lstlisting}
|
||||||
|
case e of
|
||||||
|
p -> b
|
||||||
|
esac
|
||||||
|
\end{lstlisting}
|
||||||
|
|
||||||
|
As let expression lacks an explicit ending specifier its scope extends to the right while possible; multiple let expressions on
|
||||||
|
the same nesting level associate to the right.
|
||||||
|
|
||||||
|
|
||||||
\FloatBarrier
|
\FloatBarrier
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,8 @@ is automatically created and closed within the call.}
|
||||||
\descr{\lstinline|fun fprintf (file, fmt, ...)|}{Same as "\lstinline|printf|", but outputs to a given file. The file argument should be that acquired
|
\descr{\lstinline|fun fprintf (file, fmt, ...)|}{Same as "\lstinline|printf|", but outputs to a given file. The file argument should be that acquired
|
||||||
by \lstinline|fopen| function.}
|
by \lstinline|fopen| function.}
|
||||||
|
|
||||||
\descr{\lstinline|fun regexp (str)|}{Compiles a string representation of a regular expression (as per POSIX-Extended Regular Expressions syntax) into
|
\descr{\lstinline|fun regexp (string)|}{Compiles a string representation of a regular expression (as per POSIX-Extended Regular Expressions syntax) into
|
||||||
an internal representation. The return value is a external pointer to the internal representation.}
|
an internal representation. The return value is an external pointer to the internal representation.}
|
||||||
|
|
||||||
\descr{\lstinline|fun regexpMatch (pattern, subj, pos)|}{Matches a string "\lstinline{subj}", starting from the position "\lstinline|pos|",
|
\descr{\lstinline|fun regexpMatch (pattern, subj, pos)|}{Matches a string "\lstinline{subj}", starting from the position "\lstinline|pos|",
|
||||||
against a pattern "\lstinline{pattern}". The pattern is an external pointer to a compiled representation, returned by the
|
against a pattern "\lstinline{pattern}". The pattern is an external pointer to a compiled representation, returned by the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue