B (programming language)

from Wikipedia, the free encyclopedia
B.
Paradigms : imperative , structured
Publishing year: 1969
Designer: Ken Thomas
Developer: Ken Thompson , Dennis Ritchie
Typing : typeless (everything is a data word )
Influenced by: BCPL , PL / I
Affected: C.

The programming language B was developed in 1969 by Ken Thompson and Dennis Ritchie . B is strongly influenced by BCPL and is the predecessor of the C programming language .

B is particularly interesting for linguistic historical reasons, as it documents the development from BCPL to C in more detail. It was developed for translation on a DEC PDP-7 with 8 kB RAM. It was later on PDP-11 machines and Honeywell - mainframe ported, where for example the well-known AberMUD by Alan Cox until the 1990s was used -years.

Due to the limited hardware resources on the target machine PDP-7, some BCPL features are missing, which would make the translation more complex. For example, nested function definitions are not possible. Also because of the limited resources, the B compiler generated a simple intermediate code on the PDP-7 , which has to be interpreted by an interpreter at runtime.

In B, as in BCPL or Forth, there was only one data type , the meaning of which only emerged from the operators and functions used. So B is typeless. There were already many language properties that can be found in C. Some programs can still be compiled with today's C compilers .

At B the assignment operator became "=" again, as in Heinz Rutishauser's original language Superplan , which influenced Algol 58 , where Algol 58 added a colon (": =").

Code example

main()
{
    auto c;
    auto d;

    d=0;

    while(1)
    {
        c=getchar();
        d=d+c;
        putchar(c);
    }
}

This program can also be compiled with today's C compilers (in K&R or traditional mode). However, it is not ANSI C .

Individual evidence

  1. ^ D. Ritchie, The Development of the C Language in History of Programming Languages, ACM Press and Addison-Wesley, 1996, ISBN 0-201-89502-1

Web links