diff --git a/lama-spec.pdf b/lama-spec.pdf index fd70c4407..6ed537181 100644 Binary files a/lama-spec.pdf and b/lama-spec.pdf differ diff --git a/spec/03.04.expressions.tex b/spec/03.04.expressions.tex index 6dd536a7b..6efa836ab 100644 --- a/spec/03.04.expressions.tex +++ b/spec/03.04.expressions.tex @@ -141,7 +141,33 @@ There are three forms of expressions to specify composite values: arrays, lists \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 diff --git a/spec/08.standard_library.tex b/spec/08.standard_library.tex index 383702992..bed1b1787 100644 --- a/spec/08.standard_library.tex +++ b/spec/08.standard_library.tex @@ -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 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 - an internal representation. The return value is a external pointer to the internal representation.} +\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 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|", against a pattern "\lstinline{pattern}". The pattern is an external pointer to a compiled representation, returned by the