4 |
\label{chap:lang} |
\label{chap:lang} |
5 |
|
|
6 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
7 |
|
\section{Program structure} |
8 |
|
|
9 |
|
\begin{Grammar} |
10 |
|
\ProgramRULES{} |
11 |
|
\end{Grammar}% |
12 |
|
|
13 |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
14 |
\section{Global declarations} |
\section{Global declarations} |
15 |
|
|
16 |
|
\begin{Grammar} |
17 |
|
\GlobalDeclRULES{} |
18 |
|
\end{Grammar}% |
19 |
|
|
20 |
|
\subsection{Global variable declarations} |
21 |
|
|
22 |
|
\begin{Grammar} |
23 |
|
\VarDeclRULES{} |
24 |
|
\end{Grammar}% |
25 |
|
|
26 |
|
\subsection{Input variable declarations} |
27 |
|
|
28 |
|
\begin{Grammar} |
29 |
|
\InputDeclRULES{} |
30 |
|
\end{Grammar}% |
31 |
|
|
32 |
|
\subsection{Function declarations} |
33 |
|
\begin{Grammar} |
34 |
|
\FuncDeclRULES{} |
35 |
|
\ParamsRULES{} |
36 |
|
\ParamRULES{} |
37 |
|
\end{Grammar}% |
38 |
|
|
39 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
40 |
\section{Strand definitions} |
\section{Strand definitions} |
41 |
|
|
42 |
|
\begin{Grammar} |
43 |
|
\StrandDeclRULES{} |
44 |
|
\end{Grammar}% |
45 |
|
|
46 |
\subsection{Strand state} |
\subsection{Strand state} |
47 |
|
|
48 |
|
\begin{Grammar} |
49 |
|
\StrandStateDeclRULES{} |
50 |
|
\end{Grammar}% |
51 |
|
|
52 |
\subsection{The update method} |
\subsection{The update method} |
53 |
|
|
54 |
\subsection{The stabilize method} |
\subsection{The stabilize method} |
59 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
60 |
\section{Statements} |
\section{Statements} |
61 |
|
|
62 |
|
\begin{Grammar} |
63 |
|
\BlockRULES{} |
64 |
|
\StmtRULES{} |
65 |
|
\end{Grammar}% |
66 |
|
|
67 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
68 |
\section{Expressions} |
\section{Expressions} |
69 |
|
|
77 |
The syntax of these is given by the following grammar fragment: |
The syntax of these is given by the following grammar fragment: |
78 |
\begin{Grammar} |
\begin{Grammar} |
79 |
\ExprRULES{} |
\ExprRULES{} |
80 |
\TestExprRULES{} |
\OrExprRULES{} |
81 |
\AndExprRULES{} |
\AndExprRULES{} |
82 |
\end{Grammar}% |
\end{Grammar}% |
83 |
|
|
109 |
e_1\;\mkw{||}\;e_2 \quad \equiv \quad \mkw{true}\;\mkw{if}\;e_1\;\mkw{else}\;e_2 |
e_1\;\mkw{||}\;e_2 \quad \equiv \quad \mkw{true}\;\mkw{if}\;e_1\;\mkw{else}\;e_2 |
110 |
\end{displaymath}% |
\end{displaymath}% |
111 |
|
|
112 |
\subsubsection{If-else expressions} |
\subsubsection{And-also expressions} |
113 |
\begin{displaymath} |
\begin{displaymath} |
114 |
\infer{ |
\infer{ |
115 |
\HasTy{\ENV}{e_1\;\mkw{\&\&}\;e_2}{\TYbool} |
\HasTy{\ENV}{e_1\;\mkw{\&\&}\;e_2}{\TYbool} |