programming language

term

programming

Kept in this browser · My desk

A formal notation for describing computations so that a machine can carry them out and a person can read them, defined by a syntax, a semantics, a type system and a runtime.

Konrad Zuse completed Plankalkül in 1945, long before it could run. Short Code (1950) and Grace Hopper's A-0 (1951 to 1952) followed, and FORTRAN's compiler of April 1957 proved that a program written in formulas could run almost as fast as hand-written machine code. Algol 60 gave languages a precise grammar notation, and every language since, from C and Lisp to Python and Rust, is defined the same way: rules for which texts are programs and what they do.

Four parts. A programming language is a notation precise enough for a machine to carry out and clear enough for a person to read, and every one is defined by the same four parts. The syntax decides which strings are programs; the Algol 60 report wrote it with Backus's metalinguistic formulae, now called Backus-Naur form (BNF), so that a rule like an identifier is a letter, or an identifier followed by a letter or a digit, makes every name that starts with a digit impossible. The semantics decides what a valid program does: "5" + 2 is an error in Python, "52" in JavaScript and 7 in Perl. The type system decides which mistakes are refused, before running (static) or while running (dynamic). The runtime supplies memory management, exceptions and input and output.

A short history. Konrad Zuse completed Plankalkül in 1945, before any machine could run it. Short Code (1950) and Grace Hopper's A-0 (1951 to 1952) followed, and FORTRAN's compiler of April 1957 answered the question that mattered most to its designers, whether a program written in formulas could run almost as fast as hand-written machine code. The Computer History Museum's timeline then runs through COBOL (1960), BASIC (1964), Simula (1965), Pascal (1970), C (1972) and Perl (1987). Dennis Ritchie dated C to the years 1969 to 1973, "in parallel with the early development of the Unix operating system", with the most creative period in 1972; it was derived from the typeless language BCPL through B and "evolved a type structure" on the way. Each generation answered a problem of its time: speed for scientists, readable records for business, teaching for students, simulation for engineers, systems programming for an operating system.

From notation to grammar. The tool that made languages precise came from the ALGOL effort. John Backus invented in 1959 what is now called Backus-Naur form, "a standard notation to describe the syntax of a high level programming language", and Peter Naur, who edited the Algol 60 report, used a similar scheme in 1960. Since then a language's grammar can be handed to a parser generator, and two compilers written from the same report accept the same programs. FORTRAN, older than BNF, still carried the punched card in its rules, with statements in columns 7 to 72; its successors removed that layer as the card disappeared.

The language is not its implementation. The Java Virtual Machine specification says the Java Virtual Machine (JVM) "knows nothing of the Java programming language", only class files, which is why Kotlin can run on it. Python the language is mostly CPython the program, and Lua is a small C library embedded in other programs. A language can have a compiler, an interpreter, a bytecode virtual machine with a just-in-time (JIT) compiler, or all of them; performance, error messages and even some behaviour belong to the implementation rather than the definition.

Who defines a language. Some languages are defined by International Organization for Standardization (ISO) or Ecma standards (C, C++, Fortran, COBOL, Ada, ECMAScript, C#), others by a foundation or a reference implementation (Python, Perl, Lua, Rust, Go). The standards are alive: the working group for C, ISO/IEC JTC1/SC22/WG14 (the C committee of the joint technical committee of ISO and the International Electrotechnical Commission), states that the current C standard, C23, ISO/IEC 9899, "was adopted by ISO and IEC in 2024"; Fortran 2023, COBOL's ISO/IEC 1989:2023 and Ada's ISO/IEC 8652:2023 are equally recent. A standard fixes what portable programs may rely on; everything it leaves "undefined" or "implementation-defined" is where portability and security bugs live.

The Brazilian angle. Lua, one of the languages most embedded in other software, is described by its own Portuguese-language site as "entirely designed, implemented and developed in Brazil", by a team at the Pontifícia Universidade Católica do Rio de Janeiro (PUC-Rio); it was born and grew up at Tecgraf, the university's computer graphics technology group, and is developed today at the LabLua laboratory of its Department of Informatics. Its authors' history traces its birth in 1993 to work for Petrobras under the market reserve.

The choice is also a security decision. The White House report of February 2024 calls the programming language a primary building block of secure software, because languages without memory safety, such as C and C++, carry whole classes of vulnerability, spatial and temporal: reading past the end of a buffer, using memory after it was freed. A language's semantics also decide which inputs are code: languages that evaluate strings at run time make injection possible where a stricter one would refuse.

What goes wrong. Most language-related failures are mismatches between what the programmer believes a construct means and what the definition says: implicit conversions, integer overflow, undefined behaviour in C, differences between two implementations of the same language. Reading the specification, not only tutorials, is the cure.

Neighbours. A language is made concrete by a compiler, an interpreter, bytecode and JIT compilation; it is classified by its type system and its programming paradigm; and it descends from ancestors such as FORTRAN, Lisp, COBOL, ALGOL, BASIC, Simula, Smalltalk, Prolog and ML. Brazilian practice says linguagem de programação.

Also known as: programming languages, computer language, linguagem de programação

Sources

← Back to P Back to the glossary