# HG changeset patch # User Adam Chlipala # Date 1227817637 18000 # Node ID 74dd4dca9e32eb9cd49e7daace13b020a7e9d23c # Parent f87fd1549c33c70480d99bd9b980b7d43f8afdab Expressions diff -r f87fd1549c33 -r 74dd4dca9e32 doc/manual.tex --- a/doc/manual.tex Thu Nov 27 15:06:29 2008 -0500 +++ b/doc/manual.tex Thu Nov 27 15:27:17 2008 -0500 @@ -5,6 +5,8 @@ \newcommand{\mt}[1]{\mathsf{#1}} \newcommand{\rc}{+ \hspace{-.075in} + \;} +\newcommand{\rcut}{\; \texttt{--} \;} +\newcommand{\rcutM}{\; \texttt{---} \;} \begin{document} @@ -26,7 +28,7 @@ $\times$ & \cd{*} \\ $\lambda$ & \cd{fn} \\ $\Rightarrow$ & \cd{=>} \\ - $\rc$ & \cd{++} \\ + & \cd{---} \\ \\ $x$ & Normal textual identifier, not beginning with an uppercase letter \\ $X$ & Normal textual identifier, beginning with an uppercase letter \\ @@ -37,6 +39,8 @@ We write $\ell$ for literals of the primitive types, for the most part following C conventions. There are $\mt{int}$, $\mt{float}$, and $\mt{string}$ literals. +This version of the manual doesn't include operator precedences; see \texttt{src/urweb.grm} for that. + \subsection{Core Syntax} \emph{Kinds} classify types and other compile-time-only entities. Each kind in the grammar is listed with a description of the sort of data it classifies. @@ -47,6 +51,7 @@ &&& \kappa \to \kappa & \textrm{type-level functions} \\ &&& \{\kappa\} & \textrm{type-level records} \\ &&& (\kappa\times^+) & \textrm{type-level tuples} \\ + &&& \_ & \textrm{wildcard} \\ &&& (\kappa) & \textrm{explicit precedence} \\ \end{array}$$ @@ -80,6 +85,7 @@ \\ &&& \lambda [c \sim c] \Rightarrow c & \textrm{guarded constructor} \\ \\ + &&& \_ & \textrm{wildcard} \\ &&& (c) & \textrm{explicit precedence} \\ \end{array}$$ @@ -116,9 +122,42 @@ &&& \hat{X} \; p & \textrm{unary constructor} \\ &&& \{(x = p,)^*\} & \textrm{rigid record pattern} \\ &&& \{(x = p,)^+, \ldots\} & \textrm{flexible record pattern} \\ + &&& (p) & \textrm{explicit precedence} \\ \\ \textrm{Qualified capitalized variable} & \hat{X} &::=& X & \textrm{not from a module} \\ &&& M.X & \textrm{projection from a module} \\ \end{array}$$ +\emph{Expressions} are the main run-time entities, corresponding to both ``expressions'' and ``statements'' in mainstream imperative languages. +$$\begin{array}{rrcll} + \textrm{Expressions} & e &::=& e : \tau & \textrm{type annotation} \\ + &&& x & \textrm{variable} \\ + &&& \ell & \textrm{constant} \\ + \\ + &&& e \; e & \textrm{function application} \\ + &&& \lambda x : \tau \Rightarrow e & \textrm{function abstraction} \\ + &&& e [c] & \textrm{polymorphic function application} \\ + &&& \lambda x \; ? \; \kappa \Rightarrow e & \textrm{polymorphic function abstraction} \\ + \\ + &&& \{(c = e,)^*\} & \textrm{known-length record} \\ + &&& e.c & \textrm{record field projection} \\ + &&& e \rc e & \textrm{record concatenation} \\ + &&& e \rcut c & \textrm{removal of a single record field} \\ + &&& e \rcutM c & \textrm{removal of multiple record fields} \\ + &&& \mt{fold} & \textrm{fold over fields of a type-level record} \\ + \\ + &&& \mt{let} \; ed^* \; \mt{in} \; e \; \mt{end} & \textrm{local definitions} \\ + \\ + &&& \mt{case} \; e \; \mt{of} \; (p \Rightarrow e|)^+ & \textrm{pattern matching} \\ + \\ + &&& \lambda [c \sim c] \Rightarrow e & \textrm{guarded expression} \\ + \\ + &&& \_ & \textrm{wildcard} \\ + &&& (e) & \textrm{explicit precedence} \\ + \\ + \textrm{Local declarations} & ed &::=& \cd{val} \; x : \tau = e & \textrm{non-recursive value} \\ + &&& \cd{val} \; \cd{rec} \; (x : \tau = e \; \cd{and})^+ & \textrm{mutually-recursive values} \\ +\end{array}$$ + + \end{document} \ No newline at end of file