PLANC
Encyclopedia
PLANC is a high level computer programming language. The acronym stands for Programming LAnguage for Nd Computers.

Compilers were developed by Norsk Data
Norsk Data
Norsk Data was a computer manufacturer located in Oslo, Norway. Existing from 1967 to 1992, it had its most active period in the years from the early 1970s to the late 1980s...

 for several architectures, including the Motorola 68000
Motorola 68000
The Motorola 68000 is a 16/32-bit CISC microprocessor core designed and marketed by Freescale Semiconductor...

, 88000
Motorola 88000
The 88000 is a RISC instruction set architecture developed by Motorola. The 88000 was Motorola's attempt at a home-grown RISC architecture, started in the 1980s. The 88000 arrived on the market some two years after the competing SPARC and MIPS...

, x86, and the Norsk Data NORD-10
NORD-10
NORD-10 was a medium-sized general-purpose 16-bit minicomputer designed for multilingual time-sharing applications and for real-time multiprogram systems, produced by Norsk Data. It was introduced in 1973...

 minicomputer
Minicomputer
A minicomputer is a class of multi-user computers that lies in the middle range of the computing spectrum, in between the largest multi-user systems and the smallest single-user systems...

 architecture and ND-500
ND-500
The ND-500 was a 32-bit superminicomputer delivered in 1981 by Norsk Data. It relied on a ND-100 to do housekeeping tasks and run the OS, SINTRAN III.A configuration could feature up to four ND-500 CPUs, in a shared-memory configuration....

 supermini
Supermini
A superminicomputer, or supermini, is “a minicomputer with high performance compared to ordinary minicomputers.” The term was an invention used from the mid-1970s mainly to distinguish the emerging 32-bit minis from the classical 16-bit minicomputers...

.

The language was designed to be platform independent. It was mainly used internally at Norsk Data for writing high level systems software such as the upper parts of the operating systems and compilers.

PLANC basic structure

PLANC programs are structured into modules and routines.

A very simple example of a PLANC program is as follows:

MODULE mod
INTEGER ARRAY : stack (0:100)
PROGRAM : mprog
INTEGER : i, j,k, m
INISTACK stack
1 =: i
2 =: j
i+j =: k =: m
ENDROUTINE
ENDMODULE

A difference from popular programming languages is that the assignment operator goes from left to right: First you compute the value, then you store it. Compile-time initialization of variables, on the other hand, went from right to left.

The assignment operator returns the stored value, so you could store it multiple times: 5 =: a =: b would store 5 into both the A and B variables. It shares this direction with Plankalkül
Plankalkül
Plankalkül is a computer language designed for engineering purposes by Konrad Zuse between 1943 and 1945. It was the first high-level non-von Neumann programming language to be designed for a computer. Also, notes survive with scribblings about such a plan calculation dating back to 1941...

, early ALGOL
ALGOL
ALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...

 drafts, and Mary, another little known programming language developed in Norway, but also the popular C programming language.

A related distinct syntactic feature is that a function can be defined to take as input the computed value of the expression on its left side. Also, a single additional argument does not require surrounding parentheses. The resulting infix notation
Infix notation
Infix notation is the common arithmetic and logical formula notation, in which operators are written infix-style between the operands they act on . It is not as simple to parse by computers as prefix notation or postfix notation Infix notation is the common arithmetic and logical formula notation,...

 blurs the syntactical difference between functions and operators
Operator (programming)
Programming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...

. Such expressions seem conceptually as having a computed value flowing from left to the right.

PLANC data types

As with all high level languages PLANC uses variables as can be seen in the previous sample, here are the allowed data types within PLANC:
  • Simple types
    INTEGER
    Integer (computer science)
    In computer science, an integer is a datum of integral data type, a data type which represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values....

    , REAL, BOOLEAN
    Boolean datatype
    In computer science, the Boolean or logical data type is a data type, having two values , intended to represent the truth values of logic and Boolean algebra...

    , LABEL, VOID
    Void type
    The void type, in several programming languages derived from C and Algol68, is the type for the result of a function that returns normally, but does not provide a result value to its caller. Usually such functions are called for their side effects, such as performing some task or writing to their...

    , ENUMERATION
    Enumerated type
    In computer programming, an enumerated type is a data type consisting of a set of named values called elements, members or enumerators of the type. The enumerator names are usually identifiers that behave as constants in the language...

    , POINTER
  • Composite types
    ARRAY, RECORD, SET, ROUTINE
  • User defined types: declared by TYPE T = .....;


An enumeration was declared thus:
ENUMERATION (Winter, Spring, Summer, Autumn) : Seasons := Summer

This defines an enumeration of the seasons and sets the default value to Summer.

LABEL is a little different from your normal data type, this is used to pre-define a label within code and is used in conjunction with a GO statement (very much like GOTO in BASIC).

Access modifiers can be applied to make them READ or WRITE only.

For string data several predefined datatypes are used, they are:
  1. . BYTE Contains a single character
  2. . BYTES Contains character strings
  3. . BITS Contains BIT strings


Array pointers were 3-word constructs that included both the base address, the lower bound and the higher bound of the array; this made it possible to do reliable run-time checking of array boundaries, and made the kind of "pointer arithmetic" that makes C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

 such an "interesting" language much less tempting to write.

Some PLANC statements

PLANC is a language in the PASCAL family. However, it lacks the generic BEGIN END construct often found in PASCAL and favors instead forms like ROUTINE..ENDROUTINE or DO..ENDDO etc.

One feature that sets it apart from some other languages is the construction of loops:

DO .... loop statements... ENDDO

Hopefully one or more of the loop statements would be WHILE condition that allowed you to break out of the loop.

For example:

DO WHILE test
.....
ENDDO

Is similar to a C
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....

while (test) { ... } loop.

Another example:

DO
......
WHILE test

ENDDO

Is similar to a C do { .... } while (test). loop.

Sometimes programmers wrote:

DO WHILE test1
.....
WHILE test2
ENDDO

In C you would have to write something like while (test1) { .... if (! test2) break; } or some such.

For loops have the following structure:

FOR var IN low:high DO .... loop statements.... ENDDO

You can also specify a step by low:high:step. Alternatively you can specify a type (enumeration or integer ranged type) to specify a loop over a range of values or a set to loop over all elements of the set or you can specify an array to loop over an array. You can also specify a pointer:next to walk through a list. For example if defining:

TYPE node = RECORD
node POINTER : next
T : some_data
ENDRECORD

You could write:

FOR p IN first:next DO ..... ENDFOR

to loop over the list.

A for loop can have WHILE statements inside it. This provides two possible manners of exiting a for loop, either because the list of values are exhausted or because the test failed. Thus, you can write blocks to catch each of those:

routine void,node pointer (node pointer : list)
for p in first:next do while p.val >< 20
exitfor return nil
endfor
return
endroutine

This returns nil if you have exhausted the list but if you exited due to while you just ended up after the loop and returned the pointer to the element found. Alternatively you could have placed that in an exitwhile block which is identical except you would end up there if and only if the while test failed. If you have more than one while statement in the loop you could not tell those apart, they would all make a jump to the same exitwhile block.

PLANC had a primitive exception mechanism - a routine could return an exception, which was a 16-bit integer value. This could then be caught by an ON ROUTINEERROR statement in the calling scope.

Sources

Sample code and details of the PLANC programming language have been taken directly from the Norsk Data PLANC Reference Manual [ND-60.117.03]
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK