-
Notifications
You must be signed in to change notification settings - Fork 3
/
report.tex
1364 lines (1142 loc) · 44 KB
/
report.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% THE PROGRAMMING LANGUAGE SUPERPASCAL
% PER BRINCH HANSEN
% School of Computer and Information Science
% Syracuse University, Syracuse, NY 13244, USA
% 10 November 1993
% Copyright(c) 1993 Per Brinch Hansen
% LATEX PREAMBLE
% For 11pt, 1em = 3.83mm
\documentstyle[twoside,11pt]{article}
\pagestyle{myheadings}
\setlength{\topmargin}{7mm}
\setlength{\textheight}{200mm}
\setlength{\textwidth}{140mm}
\setlength{\oddsidemargin}{14mm}
\setlength{\evensidemargin}{12mm}
\newcommand{\acknowledgements}
{\section*{Acknowledgements}
\addcontentsline{toc}{section}
{Acknowledgements}
}
\newcommand{\blank}
{\mbox{\hspace{1.8em}}}
\newcommand{\blankline}
{\medskip}
\newcommand{\Copyright}
{Copyright {\copyright}}
\newcommand{\entry}
{\bibitem{}}
\newcommand{\example}
{{\it Example:}}
\newcommand{\examples}
{{\it Examples:}}
\newcommand{\mytitle}[3]
% [title,month,year]
{\markboth{Per Brinch Hansen}{#1}
\thispagestyle{empty}
\begin{center}
{\Large\bf #1}\\
% TITLE
\blankline
PER BRINCH HANSEN
\footnote{
\Copyright #3 % Year
Per Brinch Hansen. All rights reserved.}\\
\blankline
{\it
School of Computer and Information Science \\
Syracuse University, Syracuse, NY 13244, USA\\
}
\blankline
#2 #3\\
% Month Year
\end{center}
}
\newcommand{\Superpascal}
{\it SuperPascal}
\newenvironment{grammar}
{\begin{small}}
{\end{small}}
\newenvironment{myabstract}
{\begin{rm}
\noindent{\bf Abstract:}}
{\end{rm}}
\newenvironment{mybibliography}[1]
% [widestlabel]
{\begin{small}
\begin{thebibliography}{#1}
\addcontentsline{toc}
{section}{References}}
{ \end{thebibliography}
\end{small}}
\newenvironment{mykeywords}
{\begin{small}
\noindent{\bf Key Words:}}
{\end{small}}
\newenvironment{mytabular}[1]
% [columns]
{\begin{small}
\begin{center}
\begin{tabular}{#1}}
{ \end{tabular}
\end{center}
\end{small}}
\newenvironment{program}[1]
% [width]
{\begin{center}
\begin{minipage}{#1}}
{ \end{minipage}
\end{center}}
% Program Tokens
\newcommand{\token}[1]
{{\bf#1}}
\newcommand{\And}
{\token{and}}
\newcommand{\Array}
{\token{array}}
\newcommand{\Assume}
{\token{assume}}
\newcommand{\Begin}
{\token{begin}}
\newcommand{\Case}
{\token{case}}
\newcommand{\Const}
{\token{const}}
\newcommand{\Div}
{\token{div}}
\newcommand{\Do}
{\token{do}}
\newcommand{\Downto}
{\token{downto}}
\newcommand{\Else}
{\token{else}}
\newcommand{\End}
{\token{end}}
\newcommand{\For}
{\token{for}}
\newcommand{\Forall}
{\token{forall}}
\newcommand{\Function}
{\token{function}}
\newcommand{\If}
{\token{if}}
\newcommand{\Mod}
{\token{mod}}
\newcommand{\Not}
{\token{not}}
\newcommand{\Of}
{\token{of}}
\newcommand{\Or}
{\token{or}}
\newcommand{\Parallel}
{\token{parallel}}
\newcommand{\Procedure}
{\token{procedure}}
\newcommand{\Program}
{\token{program}}
\newcommand{\Record}
{\token{record}}
\newcommand{\Repeat}
{\token{repeat}}
\newcommand{\Sic}
{\token{sic}}
\newcommand{\Then}
{\token{then}}
\newcommand{\To}
{\token{to}}
\newcommand{\Type}
{\token{type}}
\newcommand{\Until}
{\token{until}}
\newcommand{\Var}
{\token{var}}
\newcommand{\While}
{\token{while}}
% Program Indentation
\newcommand{\PA}
{\noindent}
\newcommand{\PB}
{\mbox{\hspace{1em}}}
\newcommand{\PC}
{\mbox{\hspace{2em}}}
\newcommand{\PD}
{\mbox{\hspace{3em}}}
\newcommand{\PE}
{\mbox{\hspace{4em}}}
% Grammar Indentation
\newcommand{\GA}
{\noindent}
\newcommand{\GB}
{\mbox{\hspace{1.6em}}}
\newcommand{\GC}
{\mbox{\hspace{3.2em}}}
\newcommand{\GD}
{\mbox{\hspace{4.8em}}}
\hyphenation{
syn-chron-ous
}
% DOCUMENT TEXT
\begin{document}
\mytitle
{The Programming Language SuperPascal}
{November}{1993}
\begin{myabstract}
This paper defines {\Superpascal}---a secure programming
language for publication of parallel scientific
algorithms. {\Superpascal} extends a subset of IEEE Standard
Pascal with deterministic statements for parallel
processes and synchronous message communication. A parallel
statement denotes parallel execution of a fixed number of
statements. A {\it forall} statement denotes parallel execution
of the same statement by a dynamic number of processes.
Recursive procedures may be combined with parallel and {\it
forall} statements to define recursive parallel processes.
Parallel processes communicate by sending typed messages
through channels created dynamically. {\Superpascal} omits
ambiguous and insecure features of Pascal. Restrictions on
the use of variables enable a single-pass compiler to check
that parallel processes are disjoint, even if the processes
use procedures with global variables.
\end{myabstract}
\blankline
\begin{mykeywords}
Programming languages, Parallel programming, Recursive
parallelism, Synchronous communication, SuperPascal.
\end{mykeywords}
%\tableofcontents
\section{Introduction}
This paper defines {\Superpascal}---a secure programming
language for publication of parallel scientific algorithms.
{\Superpascal} extends a subset of IEEE Standard Pascal with
deterministic statements for parallel processes and
synchronous message communication. A parallel statement
denotes parallel execution of a fixed number of statements.
A {\it forall} statement denotes parallel execution of the
same statement by a dynamic number of processes. Recursive
procedures may be combined with parallel and {\it forall}
statements to define recursive parallel processes. Parallel
processes communicate by sending typed message through
channels created dynamically. {\Superpascal} omits ambiguous
and insecure features of Pascal. Restrictions on the use of
variables enable a single-pass compiler to check that
parallel processes are disjoint, even if the processes use
procedures with global variables.
This paper defines the parallel features of {\Superpascal}
using the terminology and syntax notation of the Standard
Pascal report [IEEE 1983]. Brinch Hansen [1993a]
illustrates {\Superpascal} by examples. The syntactic
checking of parallel statements is discussed further in
[Brinch Hansen 1993b].
A {\it portable implementation} of {\Superpascal} has been
developed on a Sun workstation under Unix. It consists of
a compiler and an interpreter written in Pascal. To obtain
the {\Superpascal} software, use anonymous FTP from the
directory {\it pbh} at {\it top.cis.syr.edu}.
\section{Processes and Variables}
\begin{grammar}
{\GA}command = \\
{\GB}variable-access $|$ expression $|$
statement $|$ statement-sequence .
\end{grammar}
The evaluation or execution of a {\it command} is called a
{\it process}. A structured process is a sequential or
parallel composition of processes. The components of a
parallel composition are called {\it parallel processes}.
They proceed independently at unpredictable speeds until all
of them have terminated.
In a program text an {\it entire variable} is a syntactic
entity that has an identifier, a type, and a scope.
During program execution a {\it block} is activated when a
process evaluates a function designator or executes a
procedure statement or program. Every activation of a block
$B$ creates a new instance of every variable that is local
to $B$. When an activation terminates, the corresponding
variable instances cease to exist.
During recursive and parallel activations of a block,
multiple instances of the local variables exist. Each
variable instance is a dynamic entity that has a location, a
current value, and a finite lifetime in memory.
The distinction between a {\it variable} as a syntactic
entity in the program text and a class of dynamic entities
in memory is usually clear from the context. Where it is
necessary, this paper distinguishes between {\it syntactic
variables} and {\it variable instances}.
Parallel processes are said to be {\it disjoint} if they
satisfy the following condition: Any variable instance that
is assigned a value by one of the processes is not
accessed by any of the other processes. In other words, any
variable instance that is accessed by more than one process
is not assigned a value by any of the processes.
\section{Type Definitions}
Every type has an identifier. Two types are the same if they
have the same identifier and the same scope.
\blankline
\examples
\blankline
The following types are used in the examples of this paper:
\begin{program}{20.4em}
{\PA}{\Type} \\
{\PB}vector = {\Record} x, y: real {\End}; \\
{\PB}body = {\Record} m: real; r, v, f: vector {\End};\\
{\PB}system = {\Array} [1..n] {\Of} body; \\
{\PB}channel = $*$(body); \\
{\PB}net = {\Array} [0..p] {\Of} channel; \\
{\PB}mixed = $*$(body, integer); \\
{\PB}two = {\Array} [0..1] {\Of} mixed; \\
{\PB}four = {\Array} [0..1] {\Of} two;
\end{program}
\subsection{Channel Types}
Processes communicate by means of values called {\it
messages} transmitted through entities called {\it
channels}. A {\it communication} takes place when one
process is ready to {\it output} a message of some type
through a channel and another process is ready to {\it
input} a message of the same type through the same channel.
Processes create channels dynamically and access them by
means of values known as {\it channel references}. The type
of a channel reference is called a {\it channel type}.
\blankline
\begin{grammar}
{\GA}channel-type = \\
{\GB}``$*$'' ``('' message-type-list ``)'' . \\
{\GA}message-type-list = \\
{\GB}type-identifier \{ ``,'' type-identifier \} .\\
\end{grammar}
A channel type
\begin{center}
$*(T_1,T_2,\ldots,T_n)$
\end{center}
\noindent
denotes an unordered set of channel references created
dynamically. Each channel reference denotes a distinct
channel which can transmit messages of distinct types
$T_1,T_2,\ldots,T_n$ only (the {\it message types}).
A type definition cannot be of the recursive form:
\begin{center}
$T = *(\ldots,T,\ldots)$
\end{center}
\examples
\begin{program}{6.9em}
{\PA}$*$(body) \\
{\PA}$*$(body, integer)
\end{program}
\section{Variables}
\subsection{Entire Variables}
An {\it entire variable} is a variable denoted by one of the
following kinds of identifiers:
\begin{enumerate}
\item
A variable identifier introduced by a variable declaration
or a {\it forall} statement.
\item
A function identifier that occurs as the left part of an
assignment statement in the statement part of the
corresponding function block.
\end{enumerate}
\examples
\blankline
The following entire variables are used in the examples of
this paper:
\begin{program}{8.9em}
{\PA}{\Var} \\
{\PB}inp, out: channel;\\
{\PB}c: net; \\
{\PB}a: system; \\
{\PB}ai, aj: body; \\
{\PB}left: mixed; \\
{\PB}top: four; \\
{\PB}i, j, k: integer;
\end{program}
A {\it variable context} is associated with each command
$C$. This context consists of two sets of entire variables
called the {\it target} and {\it expression variables} of
$C$. If the process denoted by $C$ may assign a value to an
entire variable $v$ (or one of its components), then $v$ is
a target variable of $C$. If the process may use the value
of $v$ (or one of its components) as an operand, then $v$ is
an expression variable of $C$.
\subsection{Block Parameters}
Consider a procedure or function block $B$ with a statement
part $S$. An {\it implicit parameter} of $B$ is an entire
variable $v$ that is global to $B$ and is part of the
variable context of $S$. If $v$ is a target variable of $S$,
then $v$ is an {\it implicit variable parameter} of $B$. If
$v$ is an expression variable of $S$, then $v$ is an {\it
implicit value parameter} of $B$.
A {\it function} block cannot use formal variable parameters
or implicit variable parameters.
A {\it recursive procedure} or {\it function} block cannot
use implicit parameters.
\subsection{Target Variables}
An entire variable $v$ is a target variable of a command $C$
in the following cases:
\begin{enumerate}
\item
The variable identifier $v$ occurs in an assignment
statement $C$ that denotes assignment to $v$ (or one of
its components).
\item
The variable identifier $v$ occurs in a {\it for}
statement $C$ that uses $v$ as the control variable.
\item
The variable identifier $v$ occurs in a procedure
statement $C$ that uses $v$ (or one of its components) as
an actual variable parameter.
\item
The variable $v$ is an implicit variable parameter of a
procedure block $B$, and $C$ is a procedure statement that
denotes activation of $B$.
\item
The variable $v$ is a target variable of a command $D$,
and $C$ is a structured command that contains $D$.
\end{enumerate}
\subsection{Expression Variables}
An entire variable $v$ is an expression variable of a
command $C$ in the following cases:
\begin{enumerate}
\item
The variable identifier $v$ occurs in an expression $C$
that uses $v$ (or one of its components) as an operand.
\item
The variable identifier $v$ occurs in the element
statement $C$ of a {\it forall} statement that introduces
$v$ as the index variable.
\item
The variable $v$ is an implicit value parameter of a
function block $B$, and $C$ is a function designator that
denotes activation of $B$.
\item
The variable $v$ is an implicit value parameter of a
procedure block $B$, and $C$ is a procedure statement that
denotes activation of $B$.
\item
The variable $v$ is an expression variable of a command
$D$, and $C$ is a structured command that contains $D$.
\end{enumerate}
\subsection{Channel Variables}
A {\it channel variable} is a variable of a channel type.
The value of a channel variable is undefined unless a
channel reference has been assigned to the variable.
\blankline
\begin{grammar}
{\GA}channel-variable-access = \\
{\GB}variable-access . \\
\end{grammar}
\examples
\begin{program}{2.9em}
{\PA}inp \\
{\PA}c[0] \\
{\PA}top[i,j]
\end{program}
\section{Expressions}
\subsection{Channel Expressions}
\begin{grammar}
{\GA}channel-expression =\\
{\GB}expression . \\
\end{grammar}
A channel expression is an expression of a channel type. The
expression is said to be {\it well-defined} if it denotes a
channel; otherwise, it is {\it undefined}.
\blankline
\examples
\begin{program}{2.4em}
{\PA}out \\
{\PA}c[k$-$1]
\end{program}
\subsection{Relational Operators}
If $x$ and $y$ are well-defined channel expressions of the
same type, the following expressions denote boolean values:
\begin{center}
x = y{\blank}x $<>$ y
\end{center}
The value of x = y is true if $x$ and $y$ denote the same
channel, and is false otherwise. The value of x $<>$ y is
the same as the value of
\begin{center}
{\Not} (x = y)
\end{center}
\example
\begin{center}
left = top[i,j]
\end{center}
\section{Message Communication}
The required procedures for message communication are
\begin{center}
open{\blank}send{\blank}receive
\end{center}
\subsection{The Procedure Open}
\begin{grammar}
{\GA}open-statement = \\
{\GB}``{\it open}'' ``('' open-parameters ``)'' .\\
{\GA}open-parameters = \\
{\GB}open-parameter \{ ``,'' open-parameter \} . \\
{\GA}open-parameter = \\
{\GB}channel-variable-access . \\
\end{grammar}
If $v$ is a channel variable, the statement
\begin{center}
open(v)
\end{center}
\noindent
denotes creation of a new channel.
The {\it open} statement is executed by creating a new
channel and assigning the corresponding reference to the
channel variable $v$. The channel reference is of the same
type as the channel variable. The channel exists until the
program execution terminates.
The abbreviation
\begin{center}
open($v_1,v_2,\ldots,v_n$)
\end{center}
\noindent
is equivalent to
\begin{center}
{\Begin} open($v_1$); open($v_2,\ldots,v_n$) {\End}
\end{center}
\examples
\begin{program}{6.3em}
{\PA}open(c[k]) \\
{\PA}open(inp, out)
\end{program}
\subsection{The Procedures Send and Receive}
\begin{grammar}
{\GA}send-statement = \\
{\GB}``{\it send}'' ``('' send-parameters ``)'' . \\
{\GA}send-parameters = \\
{\GB}channel-expression ``,'' output-expression-list . \\
{\GA}output-expression-list = \\
{\GB}output-expression \{ ``,'' output-expression \} . \\
{\GA}output-expression = \\
{\GB}expression . \\
{\GA}receive-statement = \\
{\GB}``{\it receive}'' ``('' receive-parameters ``)'' . \\
{\GA}receive-parameters = \\
{\GB}channel-expression ``,'' input-variable-list . \\
{\GA}input-variable-list = \\
{\GB}input-variable-access \{ ``,'' input-variable-access \} .\\
{\GA}input-variable-access = \\
{\GB}variable-access . \\
\end{grammar}
The statement
\begin{center}
send(b, e)
\end{center}
\noindent
denotes output of the value of an expression $e$ through
the channel denoted by an expression $b$. The expression
$b$ must be of a channel type $T$, and the type of the
expression $e$ must be a message type of $T$.
The statement
\begin{center}
receive(c, v)
\end{center}
\noindent
denotes input of the value of a variable $v$ through the
channel denoted by an expression $c$. The expression $c$
must be of a channel type $T$, and the type of the variable
$v$ must be a message type of $T$.
The {\it send} and {\it receive} operations defined by the
above statements are said to {\it match} if they satisfy the
following conditions:
\begin{enumerate}
\item
The channel expressions $b$ and $c$ are of the same type
$T$ and denote the same channel.
\item
The output expression $e$ and the input variable $v$ are
of the same type, which is a message type of $T$.
\end{enumerate}
The execution of a {\it send} operation delays a process
until another process is ready to execute a matching {\it
receive} operation (and vice versa). If and when this
happens, a {\it communication} takes place as follows:
\begin{enumerate}
\item
The sending process obtains a value by evaluating the
output expression $e$.
\item
The receiving process assigns the value to the input
variable $v$.
\end{enumerate}
After the communication, the sending and receiving processes
proceed independently.
\blankline
{\it Communication Errors:}
\begin{enumerate}
\item
{\it Undefined channel reference}: A channel expression
does not denote a channel.
\item
{\it Channel contention}: Two parallel processes both
attempt to send (or receive) through the same channel at
the same time.
\item
{\it Message type error}: Two parallel processes attempt
to communicate through the same channel, but the output
expression and the input variable are of different message
types.
\end{enumerate}
The abbreviation
\begin{center}
send($b,e_1,e_2,\ldots,e_n$)
\end{center}
\noindent
is equivalent to
\begin{center}
{\Begin} send($b,e_1$); send($b,e_2,\ldots,e_n$) {\End}
\end{center}
The abbreviation
\begin{center}
receive($c,v_1,v_2,\ldots,v_n$)
\end{center}
\noindent
is equivalent to
\begin{center}
{\Begin} receive($c,v_1$); receive($c,v_2,\ldots,v_n$) {\End}
\end{center}
\examples
\begin{program}{8.1em}
{\PA}send(out, ai) \\
{\PA}receive(inp, aj) \\
{\PA}send(top[i,j], 2, ai)
\end{program}
\section{Statements}
\subsection{Assignment Statements}
If $x$ is a channel variable access and $y$ is a
well-defined channel expression of the same type, the effect
of the assignment statement
\begin{center}
x := y
\end{center}
\noindent
is to make the values of $x$ and $y$ denote the same
channel.
\blankline
\example
\begin{center}
left := top[i,j]
\end{center}
\subsection{Procedure Statements}
The {\it restricted actual parameters} of a procedure
statement are the explicit variable parameters that occur in
the actual parameter list and the implicit parameters of the
corresponding procedure block.
\blankline
{\it Restriction}: The restricted actual parameters of a
procedure statement must be distinct entire variables (or
components of such variables).
\blankline
A procedure statement cannot occur in the statement part of
a function block. This rule also applies to a procedure
statement that denotes activation of a required procedure.
\subsection{Parallel Statements}
\begin{grammar}
{\GA}parallel-statement = \\
{\GB}``{\Parallel}'' process-statement-list ``{\End}'' .\\
{\GA}process-statement-list = \\
{\GB}process-statement \{ ``$|$'' process-statement \} .\\
{\GA}process-statement = \\
{\GB}statement-sequence . \\
\end{grammar}
A {\it parallel} statement denotes parallel processes. Each
process is denoted by a separate process statement.
The effect of a parallel statement is to execute the process
statements as parallel processes until all of them have
terminated.
\blankline
{\it Restriction}: In a parallel statement, a target
variable of one process statement cannot be a target or
expression variable of another process statement.
\blankline
\example
\begin{program}{13.6em}
{\PA}{\Parallel} \\
{\PB}source(a, c[0]); sink(a, c[p])$|$\\
{\PB}{\Forall} k := 1 {\To} p {\Do} \\
{\PC}node(k, c[k$-$1], c[k]) \\
{\PA}{\End}
\end{program}
\subsection{Forall Statements}
\begin{grammar}
{\GA}forall-statement = \\
{\GB}``{\Forall}'' index-variable-declaration ``{\Do}''\\
{\GC}element-statement . \\
{\GA}index-variable-declaration = \\
{\GB}variable-identifier ``:='' process-index-range . \\
{\GA}process-index-range = \\
{\GB}expression ``{\To}'' expression . \\
{\GA}element-statement = \\
{\GB}statement . \\
\end{grammar}
The statement
\begin{center}
{\Forall} $i$ := $e_1$ {\To} $e_2$ {\Do} $S$
\end{center}
\noindent
denotes a (possibly empty) array of parallel processes,
called {\it element processes}, and a corresponding range of
values, called {\it process indices}. The lower and upper
bounds of the process index range are denoted by two
expressions, $e_1$ and $e_2$, of the same simple type (the
{\it index type}). Every index value corresponds to a
separate element process defined by an {\it index variable
i} and an {\it element statement S}.
The {\it index variable declaration}
\begin{center}
$i$ := $e_1$ {\To} $e_2$
\end{center}
\noindent
introduces the index variable $i$ which is local to the
element statement $S$.
A {\it forall} statement is executed as follows:
\begin{enumerate}
\item
The expressions $e_1$ and $e_2$ are evaluated. If
$e_1 > e_2$, the execution of the {\it forall} statement
terminates; otherwise, step 2 takes place.
\item
$e_2-e_1+1$ element processes run in parallel until all of
them have terminated. Each element process creates a local
instance of the index variable $i$, assigns the
corresponding process index to the variable, and executes
the element statement $S$. When an element process
terminates, its local instance of the index variable
ceases to exist.
\end{enumerate}
{\it Restriction}: In a {\it forall} statement, the element
statement cannot use target variables.
\blankline
\examples
\begin{program}{11.8em}
{\PA}{\Forall} k := 1 {\To} p {\Do} \\
{\PB}node(k, c[k$-$1], c[k]) \\
{\PA} \\
{\PA}{\Forall} i := 0 {\To} 1 {\Do} \\
{\PB}{\Forall} j := 0 {\To} 1 {\Do}\\
{\PC}quadtree(i, j, top[i,j])
\end{program}
\subsection{Unrestricted Statements}
\begin{grammar}
{\GA}unrestricted-statement = \\
{\GB}sic-clause statement . \\
{\GA}sic-clause = \\
{\GB}``['' ``{\Sic}'' ``]'' .\\
\end{grammar}
A statement $S$ is said to be {\it unrestricted} in the
following cases:
\begin{enumerate}
\item
The statement $S$ is prefixed by a {\it sic} clause.
\item
The statement $S$ is a component of an unrestricted
statement.
\end{enumerate}
All other statements are said to be {\it restricted}.
Restricted statements must satisfy the rules labeled as
{\it restrictions} in this paper. These rules restrict the
use of entire variables in procedure statements, parallel
statements, and {\it forall} statements to make it possible
to check the disjointness of parallel processes during
single-pass compilation (see 7.2, 7.3 and 7.4).
The same rules do {\it not} apply to unrestricted
statements. Consequently, the programmer must prove that
each unrestricted statement preserves the disjointness of
parallel processes; otherwise, the semantics of unrestricted
statements are beyond the scope of this paper.
\blankline
\examples
\begin{program}{14.9em}
{\PA}[{\Sic}] \{ i $<>$ j \} \\
{\PB}swap(a[i], a[j]) \\
{\PA} \\
{\PA}[{\Sic}] \{ i $<>$ j \} \\
{\PB}{\Parallel} a[i] := ai$|$a[j] := aj {\End}\\
{\PA} \\
{\PA}[{\Sic}] \{ disjoint elements a[i] \} \\
{\PB}{\Forall} i := 1 {\To} n {\Do} a[i] := ai
\end{program}
\subsection{Assume Statements}
\begin{grammar}
{\GA}assume-statement = \\
{\GB}``{\Assume}'' assumption .\\
{\GA}assumption = \\
{\GB}expression . \\
\end{grammar}
The effect of an {\it assume} statement is to test an
assumption denoted by a boolean expression. If the
assumption is true, the test terminates; otherwise, program
execution stops.
\blankline
\example
\begin{center}
{\Assume} i $<>$ j
\end{center}
\section{SuperPascal versus Pascal}
The following summarizes the differences between
{\Superpascal} and Pascal.
\subsection{Added Features}
Table~1 lists the {\Superpascal} features that were added
to Pascal.
\begin{table}[p]
\caption{Added features}
\begin{mytabular}{ll}
\hline
Language & Required \\
concepts & identifiers\\
\hline
channel types & null \\
structured function types & maxstring \\
parallel statements & string \\
forall statements & open \\
unrestricted statements & send \\
assume statements & receive \\
\hline
\end{mytabular}
\end{table}
\subsection{Excluded Features}
Table~2 lists the Pascal features that were excluded from
{\Superpascal}.
\begin{table}[p]
\caption{Excluded features}
\begin{mytabular}{ll}