changed font 5 references to font CW references
This commit is contained in:
@@ -4,5 +4,5 @@ s/^$/.ft\
|
||||
.DE\
|
||||
.bp\
|
||||
.DS\
|
||||
.ft 5\
|
||||
.ft CW\
|
||||
.ta 0.65i 1.3i 1.95i 2.6i 3.25i 3.9i 4.55i 5.2i 5.85i 6.5i/'
|
||||
|
||||
@@ -16,7 +16,7 @@ no procedures in Occam).
|
||||
In addition to the normal assignment statement, Occam has two more
|
||||
information-transfer statements, the input and the output:
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
chan1 ? x -- reads a value from chan1 into x
|
||||
chan2 ! x -- writes the value of x onto chan2
|
||||
.ft
|
||||
@@ -36,7 +36,7 @@ for multiple input). The conditional and repetitive processes are normal
|
||||
.PP
|
||||
\fIProducer-consumer example:\fP
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
.nf
|
||||
CHAN buffer: -- declares the channel buffer
|
||||
PAR
|
||||
@@ -60,7 +60,7 @@ with arrays of variables and/or channels.
|
||||
.PP
|
||||
\fIExample: 20 window-sorters in series:\fP
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
.nf
|
||||
CHAN s[20]: -- 20 channels
|
||||
PAR i = [ 0 FOR 19 ] -- 19 processes
|
||||
|
||||
32
doc/occam/p2
32
doc/occam/p2
@@ -8,30 +8,30 @@ the aspect of indentation.
|
||||
.NH 2
|
||||
The LLgen Parser Generator
|
||||
.PP
|
||||
LLgen accepts a Context Free syntax extended with the operators `\f5*\fP', `\f5?\fP' and `\f5+\fP'
|
||||
LLgen accepts a Context Free syntax extended with the operators `\f(CW*\fP', `\f(CW?\fP' and `\f(CW+\fP'
|
||||
that have effects similar to those in regular expressions.
|
||||
The `\f5*\fP' is the closure set operator without an upperbound; `\f5+\fP' is the positive
|
||||
closure operator without an upperbound; `\f5?\fP' is the optional operator;
|
||||
`\f5[\fP' and `\f5]\fP' can be used for grouping.
|
||||
The `\f(CW*\fP' is the closure set operator without an upperbound; `\f(CW+\fP' is the positive
|
||||
closure operator without an upperbound; `\f(CW?\fP' is the optional operator;
|
||||
`\f(CW[\fP' and `\f(CW]\fP' can be used for grouping.
|
||||
For example, a comma-separated list of expressions can be described as:
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
expression_list:
|
||||
expression [ ',' expression ]*
|
||||
;
|
||||
.ft
|
||||
.DE
|
||||
.LP
|
||||
Alternatives must be separated by `\f5|\fP'.
|
||||
Alternatives must be separated by `\f(CW|\fP'.
|
||||
C code (``actions'') can be inserted at all points between the colon and the
|
||||
semicolon.
|
||||
Variables global to the complete rule can be declared just in front of the
|
||||
colon enclosed in the brackets `\f5{\fP' and `\f5}\fP'. All other declarations are local to
|
||||
colon enclosed in the brackets `\f(CW{\fP' and `\f(CW}\fP'. All other declarations are local to
|
||||
their actions.
|
||||
Nonterminals can have parameters to pass information.
|
||||
A more mature version of the above example would be:
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
expression_list(expr *e;) { expr e1, e2; } :
|
||||
expression(&e1)
|
||||
[ ',' expression(&e2)
|
||||
@@ -48,18 +48,18 @@ are possible, viz. the \fBalternation\fP and \fBrepetition\fP conflict.
|
||||
An alternation confict arises if two sides of an alternation can start with the
|
||||
same symbol. E.g.
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
plus: '+' | '+' ;
|
||||
.ft
|
||||
.DE
|
||||
The parser doesn't know which `\f5+\fP' to choose (neither do we).
|
||||
The parser doesn't know which `\f(CW+\fP' to choose (neither do we).
|
||||
Such a conflict can be resolved by putting an \fBif-condition\fP in front of
|
||||
the first conflicting production. It consists of a \fB``%if''\fP followed by a
|
||||
C-expression between parentheses.
|
||||
If a conflict occurs (and only if it does) the C-expression is evaluated and
|
||||
parsing continues along this path if non-zero. Example:
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
plus:
|
||||
%if (some_plusses_are_more_equal_than_others())
|
||||
'+'
|
||||
@@ -69,7 +69,7 @@ parsing continues along this path if non-zero. Example:
|
||||
.ft
|
||||
.DE
|
||||
A repetition conflict arises when the parser cannot decide whether
|
||||
``\f5productionrule\fP'' in e.g. ``\f5[ productionrule ]*\fP'' must be chosen
|
||||
``\f(CWproductionrule\fP'' in e.g. ``\f(CW[ productionrule ]*\fP'' must be chosen
|
||||
once more, or that it should continue.
|
||||
This kind of conflicts can be resolved by putting a \fBwhile-condition\fP right
|
||||
after the opening parentheses. It consists of a \fB``%while''\fP
|
||||
@@ -79,7 +79,7 @@ comma-expression if the total expression is not part of another comma-separated
|
||||
list:
|
||||
.DS
|
||||
.nf
|
||||
.ft 5
|
||||
.ft CW
|
||||
comma_expression:
|
||||
sub_expression
|
||||
[ %while (not_part_of_comma_separated_list())
|
||||
@@ -110,7 +110,7 @@ is the \fBSEQ\fP construct, which exists in two flavors, one with a replicator
|
||||
and one process:
|
||||
.DS
|
||||
.nf
|
||||
.ft 5
|
||||
.ft CW
|
||||
seq i = [ 1 for str[byte 0] ]
|
||||
out ! str[byte i]
|
||||
.ft
|
||||
@@ -119,7 +119,7 @@ and one process:
|
||||
and one without a replicator and several processes:
|
||||
.DS
|
||||
.nf
|
||||
.ft 5
|
||||
.ft CW
|
||||
seq
|
||||
in ? c
|
||||
out ! c
|
||||
@@ -129,7 +129,7 @@ and one without a replicator and several processes:
|
||||
The LLgen skeleton grammar to handle these two is:
|
||||
.DS
|
||||
.nf
|
||||
.ft 5
|
||||
.ft CW
|
||||
SEQ { line=yylineno; oind=ind; }
|
||||
[ %if (line==yylineno)
|
||||
replicator
|
||||
|
||||
22
doc/occam/p3
22
doc/occam/p3
@@ -59,10 +59,10 @@ line left 1.0 from 7/12 <2nd box.nw, 2nd box.sw>
|
||||
.DS C
|
||||
\fIFigure 1. Interprocess and outside world communication channels\fP
|
||||
.DE
|
||||
The basic channel handling is done by \f5chan_in\fP and \f5chan_out\fP. All
|
||||
other routines are based on them. The routine \f5chan_any\fP only checks if
|
||||
The basic channel handling is done by \f(CWchan_in\fP and \f(CWchan_out\fP. All
|
||||
other routines are based on them. The routine \f(CWchan_any\fP only checks if
|
||||
there's a value available on a given channel. (It does not read this value!)
|
||||
\f5C_init\fP initializes an array of interprocess communication channels.
|
||||
\f(CWC_init\fP initializes an array of interprocess communication channels.
|
||||
.LP
|
||||
The following table shows Occam statements paired with the routines used to
|
||||
execute them.
|
||||
@@ -224,7 +224,7 @@ for(;;) {
|
||||
T}
|
||||
.sp 0.5
|
||||
.TE
|
||||
The code of \f5c_init\fP, \f5chan_in\fP, \f5chan_out\fP and \f5chan_any\fP
|
||||
The code of \f(CWc_init\fP, \f(CWchan_in\fP, \f(CWchan_out\fP and \f(CWchan_any\fP
|
||||
can be found in Appendix A.
|
||||
.NH 3
|
||||
Synchronization on interprocess communication channels
|
||||
@@ -252,7 +252,7 @@ NOW
|
||||
\fBNOW\fP evaluates to the current time returned by the time(2) system call.
|
||||
The code is simply:
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
.nf
|
||||
long now()
|
||||
{
|
||||
@@ -276,14 +276,14 @@ defined:
|
||||
\fBerror\fP, that corresponds with the standard error file.
|
||||
.IP -
|
||||
\fBfile\fP, an array of channels that can be subscripted with an index
|
||||
obtained by the builtin named process ``\f5open\fP''. Note that
|
||||
obtained by the builtin named process ``\f(CWopen\fP''. Note that
|
||||
\fBinput\fP=\fBfile\fP[0], \fBoutput\fP=\fBfile\fP[1] and
|
||||
\fBerror\fP=\fBfile\fP[2].
|
||||
.LP
|
||||
Builtin named processes to open and close files are defined as
|
||||
.DS
|
||||
.nf
|
||||
.ft 5
|
||||
.ft CW
|
||||
proc open(var index, value name[], mode[]) = ..... :
|
||||
proc close(value index) = ..... :
|
||||
.fi
|
||||
@@ -291,7 +291,7 @@ proc close(value index) = ..... :
|
||||
.DE
|
||||
To open a file `junk', write nonsense onto it, and close it, goes as follows:
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
.nf
|
||||
var i:
|
||||
seq
|
||||
@@ -318,19 +318,19 @@ and lines are buffered before they are read).
|
||||
(i.e. no echoing of typed characters and no line buffering).
|
||||
.LP
|
||||
To exit an Occam program, e.g. after an error, a builtin named process
|
||||
\f5exit\fP is available that takes an exit code as its argument.
|
||||
\f(CWexit\fP is available that takes an exit code as its argument.
|
||||
.NH 2
|
||||
Replicators and slices
|
||||
.PP
|
||||
Both the base and the count of replicators like in
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
par i = [ base for count ]
|
||||
.ft
|
||||
.DE
|
||||
may be arbitrary expressions. The count in array slices like in
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
c ? A[ base for count ]
|
||||
.ft
|
||||
.DE
|
||||
|
||||
@@ -27,7 +27,7 @@ ANY
|
||||
According to the occam syntax the \fBANY\fP keyword may be the only argument of
|
||||
an input or output process. Thus,
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
c ? ANY; x
|
||||
.ft
|
||||
.DE
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
.NH
|
||||
Appendix A: Implementation of the channel routines
|
||||
.DS L
|
||||
.ft 5
|
||||
.ft CW
|
||||
.ta 0.65i 1.3i 1.95i 2.6i 3.25i 3.9i 4.55i 5.2i 5.85i 6.5i
|
||||
.so channel.h.t
|
||||
.ft
|
||||
.DE
|
||||
.bp
|
||||
.DS L
|
||||
.ft 5
|
||||
.ft CW
|
||||
.ta 0.65i 1.3i 1.95i 2.6i 3.25i 3.9i 4.55i 5.2i 5.85i 6.5i
|
||||
.so channel.c.t
|
||||
.ft
|
||||
|
||||
@@ -5,7 +5,7 @@ routines to simulate parallelism
|
||||
.PP
|
||||
Translation of the parallel construct:
|
||||
.DS
|
||||
.ft 5
|
||||
.ft CW
|
||||
par
|
||||
P0
|
||||
par i = [ 1 for n ]
|
||||
|
||||
Reference in New Issue
Block a user