Basic Combined Programming Language

from Wikipedia, the free encyclopedia
BCPL
Paradigms : imperative , structured
Publishing year: 1967
Designer: Martin Richards
Developer: Martin Richards
Typing : typeless
Influenced by: CPL
Affected: B.

The Basic Combined Programming Language ( BCPL ) is a compiled, system-level programming language developed by Martin Richards in 1966 and implemented for the first time in the spring of 1967 at the Massachusetts Institute of Technology , derived from the Combined / Cambridge Programming Language CPL . It is a language from the ALGOL family. A further development of BCPL was the programming language B , which in turn the basis for the development of permanently important programming language C showed.

general description

The advantages of BCPL are quick learnability, simple implementation and easy portability. It is mainly intended for compiler construction, system programming and as a "pioneering language", i.e. as the first language for a new system.

A BCPL program consists of individual functions that can also be defined recursively; the function is called with value parameters .

BCPL only knows the word as a data type. All variables are references to a memory cell. Depending on the operator, the variable can be viewed as an integral value, memory reference, vector or entry point of a function. There are only local identifiers and a global vector in which identifiers visible in the entire program (including the function names) are summarized.

The content of a variable is referred to as the R value (may only be on the right-hand side of an assignment), the storage location as the L-value (may only be on the left side of an assignment.)

The operators lv and rv allow an L-value to be interpreted as an R-value and vice versa (i.e. to dereference a variable).

BCPL itself practically only provides functions for bit and word manipulation. All other functions are combined in additional libraries.

Ken Thompson developed the B language in 1969 , which is heavily influenced by BCPL. Since B was developed for the interpretation on a PDP-7 with 8 kB RAM , B has a simpler structure than BCPL. For example, nested function definitions are not possible. From the development of the programming language B was C .

There are BCPL implementations for practically every operating system ; the various implementations are not source- code compatible.

The BCPL philosophy is illustrated by the following quote from the book BCPL-The language and its compiler , which is only available in English :

“The philosophy of BCPL is not one of the tyrant who thinks he knows best and lays down the law on what is and what is not allowed; rather, BCPL acts more as a servant offering his services to the best of his ability without complaint, even when confronted with apparent nonsense. The programmer is always assumed to know what he is doing and is not hemmed in by petty restrictions. "

“The BCPL philosophy is not that of the tyrant who knows everything better and issues rules about what is allowed and what is forbidden. Instead, BCPL behaves more like the servant who offers his services in the best possible way without grumbling, even when he is told apparently nonsense. It is always assumed that the programmer knows what he is doing. It is therefore not restricted by petty restrictions. "

- BCPL-The language and its compiler

O code

Richards developed an intermediate code in the late 1960s that was supposed to make BCPL machine independent. The BCPL compiler generates O code, where the O stands for object, ie object code .

The O code can then either be interpreted by another program or translated into specific machine code . This idea was and is also used in newer compilers, e.g. B. in the form of the RTL (Register Transfer Language) intermediate code in GCC or the P code of UCSD Pascal . Java with the Java Virtual Machine also uses its own intermediate code, which, however, lies somewhere between O code and machine code.

O-Code allows the separation of general and processor-specific translation requirements. The porting of the BCPL compiler was extremely facilitated by its use, and BCPL was readily available on different machines.

Sample program

GET "LIBHDR"
 
LET START () BE
$(WRITES ("Hello, world!*N") $)

Operating systems

Parts of the AmigaOS (the AmigaDOS component) are based on TRIPOS , a multi-user operating system from MetaComCo , which was developed in the BCPL programming language, and therefore still bear traces of BCPL today. For example, BCPL pointers in AmigaDOS data structures inevitably end up at 32-bit limits, because they are shifted by 2 bits to the right, which corresponds to division by 4. Furthermore, character strings are often used in AmigaDOS, which use a prefixed length byte instead of the zero termination usual in the C programming language.

MARTOS (Multi Access Real Time Operating System) was an operating system developed in BCPL by AEG (System Software Department Konstanz) for its own machines AEG 80-40 and AEG 80-60 (number of units below 100, around 1980 ). The programming language SL3 (System Low Level Language) implemented in BCPL and related to C and PL / I was also developed for these machines, which were only used in a few projects and were actually very modern at the time , but on the other hand was also able to program with complex and nested structures.

literature

Individual evidence

  1. ^ Dennis Ritchie : The Development of the C Language . In: History of Programming Languages . ACM Press and Addison-Wesley, New York 1996, ISBN 0-201-89502-1 ( online [accessed March 27, 2009]).

Web links