Petra Operators CommAnd Language
, a dialect of
NODAL.
A bastard child of FOCAL, SNOBOL4 and BASIC.
Both POCAL and NODAL are languages that were written to control storage ring accelerators. While NODAL was written at CERN for SPS, POCAL was used for PETRA at DESY in Hamburg, Germany. Both languages are interpreted and run on top of SINTRAN-III, the operating system for Norsk Data's NORD-10 minicomputers, who in the 1970'2, were rather popular in the european high energy physics community.
POCAL for beginners
Commands in pocal can either typed in directly or by prepending them with block and line numbers, used to write programs. The most basic command is TYPE
TYPE 3.1415*3+17
would calculate the expression above and print the result.
TYPE "Hello World !"
emulates a well-known piece of
C code, while
TYPE "The square of three is " 3^2
combines a
string and an expression.
Some additional output formatting is possible.
New lines can be forced with !, printing in octal uses ] and binary can be printed using ?. Mantissa and exponent take %,.
TYPE 100 ! ]100 ! ?100 ! %,100
will output :
100
000144
000000001100100
1.0000000E2
Pocal also allows for variables :
SET PI=3.1415
TYPE PI
will work as you believe it does...
SET is actually a simplified form of FOR, which looks like this :
FOR I=-1,2; TYPE I!
which will output
-1
0
1
2
Inputting data from the console
ASK is the command of choice for that task, as in :
ASK "How many grompiks per Oblo ?" G
IF, GOTO and DO
IF R=10; TYPE "YAY ! R equals 10"
will print a text when R for some reason equals 10.
DO 10!11.20
Will execute block 10. If that fails, it will execute line 20 in block 11.
GOTO 23.11
will continue execution on line 23.11.
Of course, a variable can be placed whereever you have a numerical
constant :
10.10 SET PI=3.1415
10.20 SET T=PI+20
10.30 DO PI+10!T
10.40 GOTO 5+5.3
would execute line 14 in block 13. If that fails for some reason, line 23.14 is executed.
A note for people who stare at POCAL in disbelief: It has been used in a number of highly-sophisticated projects. The language is slightly larger than shown above and was also mainly used as a shell to call process control functions written in MAC, the Norsk Data assembler. Stuff like this was considered cool, even if most of the concepts befind POCAL are now horribly outdated and frowned upon.