Safekipedia
Mathematical notationNotationProgramming language classificationProgramming languages

Programming language

Adapted from Wikipedia · Adventurer experience

A simple C programming code that prints 'Hello World' when run.

A programming language is an engineered language for expressing computer programs. It helps people tell computers what to do by using words and symbols that are easier for humans to understand.

Programming languages allow software to be written in a human readable manner. This makes it possible for people to create games, apps, and many other tools we use every day. Without programming languages, computers would not know how to run the programs we rely on.

The source code for a computer program in C. The gray lines are comments that explain the program to humans. When compiled and run, it will give the output "Hello, world!".

To make a program work, it needs an implementation. There are two main ways to do this: compilation and interpretation. In compilation, programs are prepared ahead of time into a form the computer can understand quickly, called machine code. In interpretation, the program is executed directly by another program as it reads the code. Some systems use a mix of both methods, like just-in-time compilation and bytecode interpreters.

The way programming languages are designed has been shaped by how computers are built. Early languages were very close to the computer's hardware, but modern languages try to hide complicated details. This makes it easier for people to write good software without needing to know everything about the computer's inner workings, thanks to something called abstraction.

Relation to natural languages

Programming languages are like natural languages because they help people share ideas in programs that humans can read and understand. They can express complex thoughts, but only for problems that computers can solve.

Sometimes, the words "computer language" and "programming language" are used as if they mean the same thing, but they can be different. Some people think programming languages are a type of computer language. Others use "computer language" for any language used with computers that isn’t a programming language. A programming language can be a set of rules for guiding a computer’s actions, even if it isn’t able to do everything a full programming language can.

History

Main article: History of programming languages

The first programmable computers were made in the 1940s, and the first programming languages came with them. Early computers used simple codes called machine language, which were hard to understand and use. To make programming easier, assembly languages were created. These were still close to the computer’s basic language but easier for people to use.

Two people using an IBM 704 mainframe—the first hardware to support floating-point arithmetic—in 1957. Fortran was designed for this machine.

Later, high-level programming languages changed everything. These languages let people write programs in easier-to-understand ways, like using math symbols. One of the first was Fortran, created in 1957. It is still used today.

In the 1960s and 1970s, new computers allowed more interaction, leading to new languages. Lisp was one of the first languages to support new ways of solving problems. ALGOL helped shape many later languages. C became very popular because it could handle more detailed tasks.

The 1980s brought personal computers, which led to new languages like C++. The growth of the Internet in the 1990s introduced languages like Java and JavaScript, which made it easier to create web pages and applications.

In recent years, new languages have kept evolving. Some focus on making programming easier for beginners, like Scratch, and others aim for high performance, like Rust and Go.

Definition

A programming language is a special way to tell a computer what to do. It has two main parts: syntax and semantics.

Parse tree of Python code with inset tokenization

Syntax is like the grammar of a language. It tells us how to write words, numbers, and symbols so the computer can understand. Most programming languages use text, like English writing, but some use pictures and symbols instead.

Semantics is about what those words and symbols mean. It explains how the computer should act when it reads the program. For example, it decides how to add numbers or make choices in a program.

Features

A programming language gives a programmer tools to build software. It has ways to organize and manage data, called data types. These types tell the computer what kind of information it is working with, like numbers or words.

Programming languages also have ways to handle surprises, like when a program tries to do something it can't. They can stop the program or try to fix the problem and keep going.

Design and implementation

Programming languages are made to match how computers work. Most languages fit well with a computer's basic setup. Memory stores both data and instructions, and the CPU (Central Processing Unit) runs those instructions. These languages use ideas such as variables, assigning values, and repeating actions to help programs run well.

When people create a programming language, they have to balance different goals. They want the language to be easy to read and understand, simple to use for writing programs, and reliable so programs do what they should. Sometimes, improving one part can make another part harder. For example, making a language very powerful might make it a bit harder to read. Designers also decide how carefully the language checks for mistakes and how it handles surprises. These choices affect how programmers write and use the language.

Proprietary languages

Some programming languages are owned by a single company. These are called proprietary languages. They are only available from one vendor and might be used for specific tasks or inside a company. For example, Oracle Corporation has some rights to the Java programming language, and Microsoft’s C# has some parts that are not fully open.

Even though these languages are owned by companies, many people still use them. Examples include MATLAB, VBScript, and the Wolfram Language. Sometimes, a language that starts as proprietary can become open to everyone, like Erlang, which began as an internal language for Ericsson. Open source programming languages are very useful for open science because they allow people to share and repeat work easily.

Use

Many different programming languages have been made for use in computers. Software projects often use five or more languages together.

Programming languages are special because they must be very clear and exact. Unlike talking with friends, where you can be vague, computers follow instructions exactly. Programmers use these languages to tell computers what to do by combining simple building blocks into new programs. Programs can run on their own or let a user type in commands. Some languages can run commands right away and are called scripting languages.

Different languages are good for different jobs. For example, COBOL is often used in big companies, Fortran for science, and C for controlling machines. Some popular languages today include Python, C++, C, Java, and C#.

Dialects, flavors and implementations

A dialect of a programming language is a small change or addition that keeps the language’s basic nature the same. Some languages, like Scheme and Forth, often have different versions because their rules aren’t always followed exactly. Dialects can also be made for special uses, like in a domain-specific language. In the Lisp family, many languages with similar rules are called Lisp dialects, even though they can be quite different from each other, such as Racket and Clojure. Because one language can have many dialects, it might be hard for a new programmer to find the right information. The BASIC language, for example, has many dialects.

Classifications

Further information: Categorical list of programming languages

Programming languages can be grouped in different ways based on how they work. Imperative programming languages let you write steps in a specific order to solve a problem. Many common languages are imperative. Functional programming languages focus on using functions and their inputs to get results.

Other types include logic programming, where the computer decides the order of steps, and object-oriented programming, which uses ideas like data hiding and sharing features between objects. There are also markup languages, which aren’t full programming languages but help mix programming with content, and special-purpose languages made for specific tasks.

Images

Books for sale in a bookstore in Bangalore, India.

This article is a child-friendly adaptation of the Wikipedia article on Programming language, available under CC BY-SA 4.0.

Images from Wikimedia Commons. Tap any image to view credits and license.