Context Navigation


Changeset 187


Ignore:
Timestamp:
Jan 24, 2008, 6:20:09 PM (18 years ago)
Author:
neil.c.c.brown
Message:

Added explanation of Specification in Structured

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/trunk/hacking-guide/tock-intro.tex

    r186 r187
    184184I have used `rep' as a short-hand for the replicator (which is not the focus here). Hopefully it is
    185185now clear how Structured is used as a body for things. There is only one more aspect to explain,
    186which is definitions.
    187
    188%TODO explain definitions
    186which is definitions, or rather specifications.
    187
    188\occamsettings\begin{lstlisting}
    189SEQ
    190 proc1
    191 INT x:
    192 proc2
    193\end{lstlisting}
    194
    195According to occam scoping rules, `\lstinline|x|' is in scope for proc2. This is represented in the
    196AST as follows:
    197
    198\haskellsettings\begin{lstlisting}
    199A.Seq m
    200 (A.Several m
    201 [A.OnlyP m proc1
    202 ,A.Specification m spec (A.OnlyP m proc2)
    203 ]
    204 )
    205\end{lstlisting}
    206
    207Where `spec' is shorthand for the full specification of `x'. The specification (third argument)
    208is in scope for the whole of the body (the fourth argument). Multiple specifications lead to
    209nested Specifications:
    210
    211\occamsettings\begin{lstlisting}
    212SEQ
    213 proc1
    214 INT x:
    215 INT16 y:
    216 proc2
    217\end{lstlisting}
    218
    219\haskellsettings\begin{lstlisting}
    220A.Seq m
    221 (A.Several m
    222 [A.OnlyP m proc1
    223 ,A.Specification m specX
    224 (A.Specification m specY (A.OnlyP m proc2))
    225 ]
    226 )
    227\end{lstlisting}
    228
    229Note that each of the actual items in a Structured is named OnlyP (Process), OnlyA (ALT guard), etc.
    230To be valid, any SEQ must contain no Only* items except OnlyP. Similarly, an ALT must contain
    231no Only* items except OnlyA, and so on.
    189232
    190233\subsection{Monadic Code}
Note: See TracChangeset for help on using the changeset viewer.

AltStyle によって変換されたページ (->オリジナル) /