In Depth
See Also

Programming language

A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer Computer

A computer is a machine [i] for manipulating data [i] according to a list of instructions [i] ... 

. Programming languages, like human languages, have syntactic and semantic rules to define meaning. Programming languages are used to facilitate communication about the task of organizing and manipulating information, and to express algorithm Algorithm

In mathematics [i] and computing [i], an algorithm is a procedure for accomplishing some task which, gi ... 

s precisely. Some authors restrict the term "programming language" to those languages that can express all possible algorithms; sometimes the term "computer language" is used for more limited artificial languages.

Discussions

  Discussion Features

   Ask a question about 'Programming language'

   Start a new discussion about 'Programming language'

   Answer questions about 'Programming language'

   'Programming language' discussion forum

Timeline

1957   IBM IBM

company_name = International Business Machines Corporation | ... 

 makes FORTRAN Fortran

FORTRAN is a general-purpose [i], procedural [i] ... 

 scientific programming language available to customers. It becomes the most widely used computer language for technical work.

1964   At 4:00 a.m., John George Kemeny and Thomas Eugene Kurtz run the first program written in BASIC BASIC

In computer programming [i], BASIC refers to a family of high-level programming language [i]s.... 

 (Beginners' All-purpose Symbolic Instruction Code), an easy to learn high level programming language which they have created. BASIC will eventually be included on many computer Computer

A computer is a machine [i] for manipulating data [i] according to a list of instructions [i] ... 

s and even some games consoles.



Encyclopedia

A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer Computer

A computer is a machine [i] for manipulating data [i] according to a list of instructions [i] ... 

. Programming languages, like human languages, have syntactic and semantic rules to define meaning.

Programming languages are used to facilitate communication about the task of organizing and manipulating information, and to express algorithm Algorithm

In mathematics [i] and computing [i], an algorithm is a procedure for accomplishing some task which, gi... 

s precisely. Some authors restrict the term "programming language" to those languages that can express all possible algorithms; sometimes the term "computer language" is used for more limited artificial languages.

Thousands of different programming languages have been created and new ones are created every year. Few languages ever become sufficiently popular that they are used by more than a few people, but professional programmers may use dozens of different languages during their careers.

Definitions


Authors disagree on the precise definition of programming language. Traits often considered important include:

  • Function: A programming language is a language used to write computer programs, which instruct a computer to perform some kind of computation and/or organize the flow of control between mechanical devices .
  • Target: Programming languages differ from natural languages in that natural languages are only used for interaction between people, while programming languages also allow humans to communicate instructions to machines. In some cases, programming languages are used by one program or machine to program another; PostScript PostScript

    PostScript is a page description language [i] and programming language [i] used primarily in the electr ... 

     source code, for example, is frequently generated programmatically to control a computer printer Computer printer

    A computer printer, or more commonly just a printer, is a device that produces a hard copy [i] of ... 

     or display.
  • Constructs: Programming languages may contain constructs for defining and manipulating data structure Data structure

    In computer science [i], a data structure is a way of storing data [i] in a computer so that it can be u ... 

    s or for controlling the flow of execution.
  • Expressive power: The theory of computation classifies languages by the computations they can express. All Turing complete languages can implement the same algorithm Algorithm

    In mathematics [i] and computing [i], an algorithm is a procedure for accomplishing some task which, gi... 

    s. ANSI/ISO International Organization for Standardization

    The International Organization for Standardization is an international standard-setting body composed o... 

     SQL and Charity are examples of languages that are not Turing complete yet often called programming languages.


Non-computational languages, such as markup language Markup language

A markup language combines text and extra information about the text.... 

s like HTML HTML

In computing, HyperText Markup Language is a predominant markup language [i] for the creation of web page [i] ... 

 or formal grammars like BNF, are usually not considered programming languages; however, informal usage sometimes includes them.

Purpose

A prominent purpose of programming languages is to provide instructions to a computer. As such, programming languages differ from most other forms of human expression in that they require a greater degree of precision and completeness. When using a natural language to communicate with other people, human authors and speakers can be ambiguous and make small errors, and still expect their intent to be understood. However, computers do exactly what they are told to do, and cannot understand the code the programmer "intended" to write. The combination of the language definition, the program, and the program's inputs must fully specify the external behavior that occurs when the program is executed.

Many languages have been designed from scratch, altered to meet new needs, combined with other languages, and eventually fallen into disuse. Although there have been attempts to design one "universal" computer language that serves all purposes, all of them have failed to be accepted in this role. The need for diverse computer languages arises from the diversity of contexts in which languages are used:

  • Programs range from tiny scripts written by individual hobbyists to huge systems written by hundreds of programmers.
  • Programmers range in expertise from novices who need simplicity above all else, to experts who may be comfortable with considerable complexity.
  • Programs must balance speed, size, and simplicity on systems ranging from microcontroller Microcontroller

    A microcontroller is a computer [i]-on-a-chip [i] used to control electronic [i] ... 

    s to supercomputer Supercomputer

    A supercomputer is a computer [i] that leads the world in terms of processing capacity, particularly spe ... 

    s.
  • Programs may be written once and not change for generations, or they may undergo nearly constant modification.
  • Finally, programmers may simply differ in their tastes: they may be accustomed to discussing problems and expressing them in a particular language.


One common trend in the development of programming languages has been to add more ability to solve problems using a higher level of abstraction Abstraction

Abstraction is the process of reducing the information content [i] of a concept [i], typically in order... 

. The earliest programming languages were tied very closely to the underlying hardware of the computer. As new programming languages have developed, features have been added that let programmers express ideas that are more removed from simple translation into underlying hardware instructions. Because programmers are less tied to the needs of the computer, their programs can do more computing with less effort from the programmer. This lets them write more programs in the same amount of time.

Natural language processors have been proposed as a way to eliminate the need for a specialized language for programming. However, this goal remains distant and its benefits are open to debate. Edsger Dijkstra Edsger Dijkstra

Prof Dr Edsger Wybe Dijkstra was a Dutch [i] computer scientist [i]. ... 

 took the position that the use of a formal language is essential to prevent the introduction of meaningless constructs, and dismissed natural language programming as "foolish." Alan Perlis was similarly dismissive of the idea.

Elements


Syntax




A programming language's surface form is known as its syntax. Most programming languages are purely textual; they use sequences of text including words, numbers, and punctuation, much like written natural languages. On the other hand, there are some programming languages which are more graphical in nature, using spatial relationships between symbols to specify a program.

The syntax of a language describes the possible combinations of symbols that form a syntactically correct program. The meaning given to a combination of symbols is handled by semantics. Since most languages are textual, this article discusses textual syntax.

Programming language syntax is usually defined using a combination of regular expressions and Backus-Naur Form . Below is a simple grammar, based on Lisp:


expression = atom | list

atom = number | symbol

number = [+-]?['0'-'9']+

symbol = ['A'-'Z''a'-'z'].*

list =



This grammar specifies the following:
  • an expression is either an atom or a list;
  • an atom is either a number or a symbol;
  • a number is an unbroken sequence of one or more decimal digits, optionally preceded by a plus or minus sign;
  • a symbol is a letter followed by zero or more of any characters ; and
  • a list is a matched pair of parentheses, with zero or more expressions inside it.


The following are examples of well-formed token sequences in this grammar: '12345', '', ''

Not all syntactically correct programs are semantically correct. Many syntactically correct programs are nonetheless ill-formed, per the language's rules; and may result in an error on translation or execution. In some cases, such programs may exhibit undefined behavior. Even when a program is well-defined within a language, it may still have a meaning that is not intended by the person who wrote it.

Using natural language as an example, it may not be possible to assign a meaning to a grammatically correct sentence or the sentence may be false:
  • "Colorless green ideas sleep furiously Colorless green ideas sleep furiously

    "Colorless green ideas sleep furiously" is a sentence composed by Noam Chomsky [i] in 1957 as an exa ... 

    ." is grammatically well-formed but has no generally accepted meaning.
  • "John is a married bachelor." is grammatically well-formed but expresses a meaning that cannot be true.


The following C language fragment is syntactically correct, but performs an operation that is not semantically defined :

complex *p = NULL;
complex abs_p = sqrt ;

Type system


A type system defines how a programming language classifies values and expressions into types, how it can manipulate those types and how they interact. This generally includes a description of the data structure Data structure

In computer science [i], a data structure is a way of storing data [i] in a computer so that it can be u ... 

s that can be constructed in the language. The design and study of type systems using formal mathematics is known as type theory.

Internally, all data in modern digital computers are stored simply as zeros or ones . The data typically represent information in the real world such as names, bank accounts and measurements, so the low-level binary data are organized by programming languages into these high-level concepts as data types. There are also more abstract types whose purpose is just to warn the programmer about semantically meaningless statements or verify safety properties of programs.

Languages can be classified with respect to their type systems.
Typed vs untyped languages

A language is typed if operations defined for one data type cannot be performed on values of another data type. For example, "text" is a string. In most programming languages, dividing a number by a string has no meaning. Most modern programming languages will therefore reject any program attempting to perform such an operation. In some languages, the meaningless operation will be detected when the program is compiled , and rejected by the compiler, while in others, it will be detected when the program is run , resulting in a runtime exception.

By opposition, an untyped language, such as most assembly languages, allows any operation to be performed on any data type.

Consolidation and growth

The 1980s were years of relative consolidation. C++ C++

C++ is a general-purpose, high-level [i] programming language [i] with low-level [i] facilities. ... 

 combined object-oriented and systems programming. The United States government standardized Ada Ada (programming language)

Ada is a structured [i], statically typed [i] imperative [i] ... 

, a systems programming language intended for use by defense contractors. In Japan and elsewhere, vast sums were spent investigating so-called "fifth generation" languages that incorporated logic programming constructs. The functional languages community moved to standardize ML and Lisp. Rather than inventing new paradigms, all of these movements elaborated upon the ideas invented in the previous decade.

One important trend in language design during the 1980s was an increased focus on programming for large-scale systems through the use of modules, or large-scale organizational units of code. Modula-2, Ada, and ML all developed notable module systems in the 1980s. Module systems were often wedded to generic programming constructs.

The rapid growth of the Internet Internet

The Internet is the worldwide, publicly accessible network of interconnected computer network [i]s that ... 

 in the mid-1990's created opportunities for new languages. Perl Perl

Perl, also Practical Extraction and Report Language is a dynamic [i] ... 

, originally a Unix scripting tool, became common in dynamic Web site Website

A website is a collection of web page [i]s, typically common to a particular domain name [i] or subdomain [i]... 

s. Java Java (programming language)

Java is an object-oriented [i] programming language [i] developed by James Gosling [i] ... 

 came to be used for server-side programming. These developments were not fundamentally novel, rather they were refinements to existing languages and paradigms.

Programming language evolution continues, in both industry and research. Current directions include security and reliability verification, new kinds of modularity , database integration, and the "Free and Open Source Software Alternative terms for free software

Free software [i] is the term introduced by Richard Stallman [i] in 1983 for software which the user can ... 

" development philosophy.

Taxonomies

There is no overarching classification scheme for programming languages. Any given programming language does not usually have a single ancestor language. Languages commonly arise by combining the elements of several predecessor languages with new ideas in circulation at the time. Ideas that originate in one language will diffuse throughout a family of related languages, and then leap suddenly across familial gaps to appear in an entirely different family.

The task is further complicated by the fact that languages can be classified along multiple axes. For example, Java is both an object-oriented language and a concurrent language . Python Python (programming language)

Python is a programming language [i] created by Guido van Rossum [i] in 1990 [i]. ... 

 is an object-oriented scripting language.

In broad strokes, programming languages divide into programming paradigms and a classification by intended domain of use. Paradigms include procedural programming, object-oriented programming, functional programming, and logic programming; some languages are hybrids of paradigms or multi-paradigmatic. An assembly language is not so much a paradigm as a direct model of an underlying machine architecture. By purpose, programming languages might be considered general purpose, system programming languages, scripting languages, domain-specific languages, or concurrent/distributed languages . Some general purpose languages were designed largely with educational goals.

See also

  • Comparison of programming languages
  • List of hello world programs List of hello world programs

    The following is a list of hello world program [i]s. ... 

    , examples of a simple program in many different programming languages
  • Literate programming Literate programming

    Literate programming is the writing of computer program [i]s primarily for human beings to read, similar ... 

  • Programming language dialect
  • Programming language theory Programming language theory

    Programming language theory is a branch of computer science [i] which deals with the design, implementat ... 

  • Software engineering Software engineering

    Software Engineering is the discipline of designing, creating, and maintaining software [i] by applying ... 

     and List of software engineering topics

References


Further reading

  • David Gelernter, Suresh Jagannathan: Programming Linguistics, The MIT Press 1990.
  • Samuel N. Kamin: Programming Languages: An Interpreter-Based Approach, Addison-Wesley 1990.
  • Shriram Krishnamurthi: Programming Languages: Application and Interpretation, .
  • Burce J. MacLennan: Principles of Programming Languages, Harcourt Brace Jovanovich 1987.
  • John C. Mitchell: Concepts in Programming Languages, Cambridge University Press 2002.
  • Benjamin C. Pierce: Types and Programming Languages, The MIT Press 2002.
  • Ravi Sethi: Programming Languages: Concepts and Constructs, 2nd ed., Addison-Wesley 1996.
  • Richard L. Wexelblat : History of Programming Languages, Academic Press 1981.

External links

  • - a collection of implementations in many languages