Let-expr to the spec

This commit is contained in:
Dmitry Boulytchev 2025-03-09 21:34:17 +03:00
parent 266933500a
commit 56fcd832cb
3 changed files with 29 additions and 3 deletions

Binary file not shown.

View file

@ -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

View file

@ -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