SuperPascal
≈ 4 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
SuperPascal is an imperative, concurrent computing programming language developed by Per Brinch Hansen. It was designed as a publication language: a thinking tool to enable the clear and concise expression of concepts in parallel programming. This is in contrast with implementation languages which are often complicated with machine details and historical conventions. It was created to address the need at the time for a parallel publication language. Arguably, few languages today are expressive and concise enough to be used as thinking tools.
SuperPascal is an imperative, concurrent computing programming language developed by Per Brinch Hansen. It was designed as a publication language: a thinking tool to enable the clear and concise expression of concepts in parallel programming. This is in contrast with implementation languages which are often complicated with machine details and historical conventions. It was created to address the need at the time for a parallel publication language. Arguably, few languages today are expressive and concise enough to be used as thinking tools. forall i := 0 to 10 do something() type channel = *(boolean, integer); var c: channel; which defines a new (mixed) type named channel and a variable of this type named c. A mixed type channel is restricted to transmitting only the specified types, in this case boolean and integer values. The channel c is initialised by the open statement: open(c) Message communication is then achieved with the send(channel, value) and receive(channel, variable) statements. The expression or variable providing the value for send , and the variable in receive , must both be of the same type as the first channel argument. The following example shows the use of these functions in a process that receives a value from the left channel and outputs it on the right one. var left, right: channel; a: number; receive(left, a); send(right, a) The functions send and receive can both take multiple input and output arguments respectively: send(channel, e1, e2,..., en); receive(channel, v1, v2,..., vn) The following runtime communication errors can occur: Channel contention occurs when two parallel processes both attempt to send or receive on the same channel simultaneously. A message type error occurs when two parallel processes attempt to communicate through the same channel and the output expression and input variable are of different types. Deadlock occurs when a send or receive operation waits indefinitely for completion. procedure pipeline(min, max: integer; left, right: channel); var middle: channel; begin if min Another example is the recursive definition of a process tree: procedure tree(depth: integer, bottom: channel); var left, right: channel; begin if depth > 0 then begin open(left, right); parallel tree(depth - 1, left) | tree(depth - 1, right) | root(bottom, left, right) end end else leaf(bottom) program pipeline; const len = 100; type channel = *(integer); var left, right: channel; value: integer; procedure node(i: integer; left, right: channel); var value: integer; begin receive(left, value); send(right, value+1) end; procedure create(left, right: channel); type row = array [0..len] of channel; var c: row; i: integer; begin c[0] := left; c[len] := right; for i := 1 to len-1 do open(c[i]); forall i := 1 to len do node(i, c[i-1], c[i]) end; begin open(left, right); parallel send(left, 0) | create(left, right) | receive(right, value) end; writeln('The resulting value is ', value) end. { Time code for readtime in Freepascal on unix systems } Function FpTime(var tloc : integer): integer; external name 'FPC_SYSC_TIME'; procedure readtime( var t: integer); begin { A nonstandard function reads the processor time in ms } t:=fptime(t); end;
Text derived from https://en.wikipedia.org/w/index.php?oldid=1207422957 under CC BY-SA 4.0; modifications have been made.