Skip to content

Commit 56fcd83

Browse files
committed
Let-expr to the spec
1 parent 2669335 commit 56fcd83

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

lama-spec.pdf

1.35 KB
Binary file not shown.

spec/03.04.expressions.tex

+27-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,33 @@ \subsection{Arrays, Lists, and S-expressions}
141141

142142
\subsection{Let Expressions}
143143

144-
TODO
144+
\begin{figure}[h]
145+
\[
146+
\begin{array}{rcll}
147+
\defterm{letExpression} & : & \term{let}\s\nonterm{pattern}\s\term{=}\s\nonterm{expression}\s\term{in}\s\nonterm{expression}
148+
\end{array}
149+
\]
150+
\caption{Let-expression syntax}
151+
\label{let_expression}
152+
\end{figure}
153+
154+
Let expression is a derived syntactic form for a one-branch case-expression. An expression
155+
156+
\begin{lstlisting}
157+
let p = e in b
158+
\end{lstlisting}
159+
160+
is equivalent to
161+
162+
\begin{lstlisting}
163+
case e of
164+
p -> b
165+
esac
166+
\end{lstlisting}
167+
168+
As let expression lacks an explicit ending specifier its scope extends to the right while possible; multiple let expressions on
169+
the same nesting level associate to the right.
170+
145171

146172
\FloatBarrier
147173

spec/08.standard_library.tex

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ \section{Unit \texttt{Std}}
9595
\descr{\lstinline|fun fprintf (file, fmt, ...)|}{Same as "\lstinline|printf|", but outputs to a given file. The file argument should be that acquired
9696
by \lstinline|fopen| function.}
9797

98-
\descr{\lstinline|fun regexp (str)|}{Compiles a string representation of a regular expression (as per POSIX-Extended Regular Expressions syntax) into
99-
an internal representation. The return value is a external pointer to the internal representation.}
98+
\descr{\lstinline|fun regexp (string)|}{Compiles a string representation of a regular expression (as per POSIX-Extended Regular Expressions syntax) into
99+
an internal representation. The return value is an external pointer to the internal representation.}
100100

101101
\descr{\lstinline|fun regexpMatch (pattern, subj, pos)|}{Matches a string "\lstinline{subj}", starting from the position "\lstinline|pos|",
102102
against a pattern "\lstinline{pattern}". The pattern is an external pointer to a compiled representation, returned by the

0 commit comments

Comments
 (0)