[pending revision] | [accepted revision] |
Content deleted Content added
→Definitions: markup languages after the talk page discussion Tag: Reverted |
→Tradeoffs: Grammar edit Tags: Mobile edit Mobile web edit |
||
(48 intermediate revisions by 24 users not shown) | |||
Line 1:
{{Short description|Language for
{{Pp-pc1}}
{{Use dmy dates|date=September 2020}}
{{citation style|date=August 2025}}
[[File:C Hello World Program.png|thumb|right|upright=1.3|The [[source code]] for a computer program in [[C (programming language)|C]]. The gray lines are [[comment (computer programming)|comments]] that explain the program to humans. When [[compiled]] and [[Execution (computing)|run]], it will give the output "[["Hello, World!" program|Hello, world!]]".]]
A '''programming language''' is an artificial language for expressing [[computer program|computer programs]].<ref>{{Cite ISO standard|title=Information technology {{emdash}} Vocabulary|csnumber=63598}}</ref>
Programming languages typically allow software to be [[Software development|written]] in a [[Human-readable|human readable]] manner.
[[Execution (computing)|Execution]] of a program requires an [[Programming language implementation|implementation]]. There are two main approaches for implementing a programming language {{endash}} [[Compiler|compilation]], where programs are compiled ahead-of-time to [[machine code]], and [[Interpreter (computing)|interpretation]], where programs are directly executed. In addition to these two extremes, some implementations use hybrid approaches such as [[just-in-time compilation]] and [[bytecode]] interpreters.<ref>{{Cite book|title=Concepts of Programming Languages|last=Sebesta|first=Robert W.|publisher=Pearson|year=2023|isbn=978-1-292-43682-1|edition=12th global|pages=46–51|language=en}}</ref>
Programming languages differ from [[natural language]]s in that natural languages are used for interaction between people, while programming languages are designed to allow humans to communicate instructions to machines.{{Citation needed|date=October 2024}}▼
The design of programming languages has been strongly influenced by [[computer architecture]], with most [[imperative languages|imperative]] languages designed around the ubiquitous [[von Neumann architecture]].{{Sfn|Sebesta|p=18}}{{full citation needed|date=August 2025}} While early programming languages were closely tied to the [[Computer hardware|hardware]], modern languages often hide hardware details via [[abstraction (computer science)|abstraction]] in an effort to enable better software with less effort.{{Citation needed|date=August 2025}}
==Related==
▲
The term ''[[computer language]]'' is sometimes used interchangeably with ''programming language''<ref>Robert A. Edmunds, The Prentice-Hall standard glossary of computer terminology, Prentice-Hall, 1985, p. 91</ref> but some contend they are different concepts. Some contend that programming languages are a subset of computer languages.<ref>Pascal Lando, Anne Lapujade, Gilles Kassel, and Frédéric Fürst, ''[http://home.mis.u-picardie.fr/~site-ic/site/IMG/pdf/ICSOFT2007_final.pdf Towards a General Ontology of Computer Programs]'' {{webarchive|url=https://web.archive.org/web/20150707093557/http://home.mis.u-picardie.fr/~site-ic/site/IMG/pdf/ICSOFT2007_final.pdf|date=7 July 2015}}, [http://dblp.uni-trier.de/db/conf/icsoft/icsoft2007-1.html ICSOFT 2007] {{webarchive|url=https://web.archive.org/web/20100427063709/http://dblp.uni-trier.de/db/conf/icsoft/icsoft2007-1.html|date=27 April 2010}}, pp. 163–170</ref> Some use ''computer language'' to classify a language used in computing that is not considered a programming language.{{Citation needed|date=October 2024}} Some regard a programming language as a theoretical construct for programming an [[abstract machine]], and a computer language as the subset thereof that runs on a physical computer, which has finite hardware resources.<ref>R. Narasimhan, Programming Languages and Computers: A Unified Metatheory, pp. 189—247 in Franz Alt, Morris Rubinoff (eds.) Advances in computers, Volume 8, Academic Press, 1994, {{ISBN|0-12-012108-5}}, p.215: "[...] the model [...] for computer languages differs from that [...] for programming languages in only two respects. In a computer language, there are only finitely many names—or registers—which can assume only finitely many values—or states—and these states are not further distinguished in terms of any other attributes. [author's footnote:] This may sound like a truism but its implications are far-reaching. For example, it would imply that any model for programming languages, by fixing certain of its parameters or features, should be reducible in a natural way to a model for computer languages."</ref>
==History==
Line 48 ⟶ 47:
===2000s to present===
During the 2000s, there was a slowdown in the development of new programming languages that achieved widespread popularity.{{sfn|Gabbrielli|Martini|2023|p=542}} One innovation was [[service-oriented programming]], designed to exploit [[distributed systems]] whose components are connected by a network. Services are similar to objects in object-oriented programming, but run on a separate process.{{sfn|Gabbrielli|Martini|2023|pp=474–475, 477, 542}} [[C Sharp (programming language)|C#]] and [[F Sharp (programming language)|F#]] cross-pollinated ideas between imperative and functional programming.{{sfn|Gabbrielli|Martini|2023|pp=542–543}} After 2010, several new languages—[[Rust (programming language)|Rust]], [[Go (programming language)|Go]], [[Swift (programming language)|Swift]], [[Zig (programming language)|Zig]] and [[Carbon (programming language)|Carbon]] —competed for the performance-critical software for which C had historically been used.{{sfn|Gabbrielli|Martini|2023|p=544}} Most of the new programming languages use [[Type system|static typing]] while a few numbers of new languages use [[Type system|dynamic typing]] like [[Ring (programming language)|Ring]] and [[Julia_(programming_language)|Julia]].<ref>
Some of the new programming languages are classified as [[visual programming languages]] like [[Scratch_(programming_language)|Scratch]], [[LabVIEW]] and [[PWCT]]. Also, some of these languages mix between textual and visual programming usage like [[Ballerina (programming language)|Ballerina]].<ref>Sáez-López, J.M., Román-González, M. and Vázquez-Cano, E., 2016. Visual programming languages integrated across the curriculum in elementary school: A two year case study using “Scratch” in five schools. Computers & Education, 97, pp.129-141.</ref><ref>Fayed, M.S., Al-Qurishi, M., Alamri, A. and Al-Daraiseh, A.A., 2017, March. PWCT: visual language for IoT and cloud computing applications and systems. In Proceedings of the Second International Conference on Internet of things, Data and Cloud Computing (pp. 1-5).</ref><ref>Kodosky, J., 2020. LabVIEW. Proceedings of the ACM on Programming Languages, 4(HOPL), pp.1-54.</ref><ref>Fernando, A. and Warusawithana, L., 2020. Beginning Ballerina Programming: From Novice to Professional. Apress.</ref> Also, this trend lead to developing projects that help in developing new VPLs like [[Blockly]] by [[Google]].<ref>Baluprithviraj, K.N., Bharathi, K.R., Chendhuran, S. and Lokeshwaran, P., 2021, March. Artificial intelligence based smart door with face mask detection. In 2021 International Conference on Artificial Intelligence and Smart Systems (ICAIS) (pp. 543-548). IEEE.</ref> Many game engines like [[Unreal Engine|Unreal]] and [[Unity (game engine)|Unity]] added support for visual scripting too.<ref>Sewell, B., 2015. Blueprints visual scripting for unreal engine. Packt Publishing Ltd.</ref><ref>Bertolini, L., 2018. Hands-On Game Development without Coding: Create 2D and 3D games with Visual Scripting in Unity. Packt Publishing Ltd.</ref>
==
A language can be defined in terms of [[Syntax (programming languages)|syntax]] (form) and [[semantics (computer science)|semantics]] (meaning), and often is defined via a [[formal language]] specification.
===Syntax===
Line 100:
===Semantics===
{{Logical connectives sidebar}}
====Static semantics====
Static semantics defines restrictions on the structure of valid texts that are hard or impossible to express in standard syntactic formalisms.<ref name="Aaby 2004">{{cite book |last=Aaby |first=Anthony |url=http://www.emu.edu.tr/aelci/Courses/D-318/D-318-Files/plbook/intro.htm |title=Introduction to Programming Languages |year=2004 |access-date=29 September 2012 |archive-url=https://web.archive.org/web/20121108043216/http://www.emu.edu.tr/aelci/Courses/D-318/D-318-Files/plbook/intro.htm |archive-date=8 November 2012 |url-status=dead}}</ref>{{Failed verification|date=January 2023|reason=This site says nothing about "static semantics" or any connection between semantics and "structure" or "restrictions".}} For compiled languages, static semantics essentially include those semantic rules that can be checked at compile time. Examples include checking that every [[identifier]] is declared before it is used (in languages that require such declarations) or that the labels on the arms of a [[case statement]] are distinct.<ref>Michael Lee Scott, ''Programming language pragmatics'', Edition 2, Morgan Kaufmann, 2006, {{ISBN|0-12-633951-1}}, p. 18–19</ref> Many important restrictions of this type, like checking that identifiers are used in the appropriate context (e.g. not adding an integer to a function name), or that [[subroutine]] calls have the appropriate number and type of arguments, can be enforced by defining them as rules in a [[logic]] called a [[type system]]. Other forms of [[static code analysis|static analyses]] like [[data flow analysis]] may also be part of static semantics. Programming languages such as [[Java (programming language)|Java]] and [[C Sharp (programming language)|C#]] have [[definite assignment analysis]], a form of data flow analysis, as part of their respective static semantics.<ref name=":1">{{Cite book |last=Winskel |first=Glynn |url=https://books.google.com/books?id=JzUNn6uUxm0C |title=The Formal Semantics of Programming Languages: An Introduction |date=5 February 1993 |publisher=MIT Press |isbn=978-0-262-73103-4 |language=en}}</ref>
====Dynamic semantics====
Line 109:
{{unreferenced|section|date=April 2024}}
Once data has been specified, the machine must be instructed to perform operations on the data. For example, the semantics may define the [[evaluation strategy|strategy]] by which expressions are evaluated to values, or the manner in which [[control flow|control structures]] conditionally execute [[Statement (computer science)|statements]]. The ''dynamic semantics'' (also known as ''execution semantics'') of a language defines how and when the various constructs of a language should produce a program behavior. There are many ways of defining execution semantics. Natural language is often used to specify the execution semantics of languages commonly used in practice. A significant amount of academic research goes into [[formal semantics of programming languages]], which allows execution semantics to be specified in a formal manner. Results from this field of research have seen limited application to programming language design and implementation outside academia.<ref name=":1" />
==Features==
A language provides features for the [[programmer]] for develop software. Some notable features are described below.
===Type system===
Line 152 ⟶ 155:
Desirable qualities of programming languages include readability, writability, and reliability.{{sfn|Sebesta|2012|p=8}} These features can reduce the cost of training programmers in a language, the amount of time needed to write and maintain programs in the language, the cost of compiling the code, and increase runtime performance.{{sfn|Sebesta|2012|pp=16–17}}
*Although early programming languages often prioritized efficiency over readability, the latter has grown in importance since the 1970s. Having multiple operations to achieve the same result can be detrimental to readability, as is [[operator overload|overloading operators]], so that the same operator can have multiple meanings.{{sfn|Sebesta|2012|pp=8–9}} Another feature important to readability is [[orthogonality]], limiting the number of constructs that a programmer has to learn.{{sfn|Sebesta|2012|pp=9–10}} A syntax structure that is easily understood and [[reserved word|special word]]s that are immediately obvious also supports readability.{{sfn|Sebesta|2012|pp=12–13}}
*Writability is the ease of use for writing code to solve the desired problem. Along with the same features essential for readability,{{sfn|Sebesta|2012|p=13}} [[abstraction (computer science)|abstraction]]—interfaces that enable hiding details from the client—and [[Expressive power (computer science)|expressivity]]—enabling more concise programs—additionally help the programmer write code.{{sfn|Sebesta|2012|pp=14–15}} The earliest programming languages were tied very closely to the underlying hardware of the computer, but over time support for abstraction has increased, allowing programmers to express ideas that are more remote from simple translation into underlying hardware instructions. Because programmers are less tied to the complexity of the computer, their programs can do more computing with less effort from the programmer.<ref>Frederick P. Brooks, Jr.: ''The Mythical Man-Month'', Addison-Wesley, 1982, pp. 93–94</ref> Most programming languages come with a [[standard library]] of commonly used functions.<ref>{{cite journal |last1=Busbee |first1=Kenneth Leroy |last2=Braunschweig |first2=Dave |title=Standard Libraries |url=https://press.rebus.community/programmingfundamentals/chapter/standard-libraries/ |website=Programming Fundamentals – A Modular Structured Approach |access-date=27 January 2024 |language=en |date=15 December 2018}}</ref>
*Reliability means that a program performs as specified in a wide range of circumstances.{{sfn|Sebesta|2012|p=15}} [[Type checking]], [[exception handling]], and restricted [[aliasing (computing)|aliasing]] (multiple variable names accessing the same region of memory) all can improve a program's reliability.{{sfn|Sebesta|2012|pp=8, 16}}
Programming language design often involves tradeoffs.{{sfn|Sebesta|2012|pp=18, 23}} For example, features to improve reliability typically come at the cost of performance.{{sfn|Sebesta|2012|p=23}} Increased expressivity due to a large number of operators makes writing code easier but comes at the cost of readability.{{sfn|Sebesta|2012|p=23}}
{{anchor|English-like programming languages}}
[[Natural-language programming]] has 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 W. Dijkstra]] took the position that the use of a formal language is essential to prevent the introduction of meaningless constructs.<ref>Dijkstra, Edsger W. [http://www.cs.utexas.edu/users/EWD/transcriptions/EWD06xx/EWD667.html On the foolishness of "natural language programming."] {{webarchive|url=https://web.archive.org/web/20080120201526/http://www.cs.utexas.edu/users/EWD/transcriptions/EWD06xx/EWD667.html |date=20 January 2008 }} EWD667.</ref> [[Alan Perlis]] was similarly dismissive of the idea.<ref>{{cite web|last=Perlis|first=Alan|url=http://www-pu.informatik.uni-tuebingen.de/users/klaeren/epigrams.html|title=Epigrams on Programming|work=SIGPLAN Notices Vol. 17, No. 9|date=September 1982|pages=7–13|url-status=live|archive-url=https://web.archive.org/web/19990117034445/http://www-pu.informatik.uni-tuebingen.de/users/klaeren/epigrams.html|archive-date=17 January 1999}}</ref>
===Specification===
{{Main|Programming language specification}}
Line 192 ⟶ 196:
A programming language provides a structured mechanism for defining pieces of data, and the operations or transformations that may be carried out automatically on that data. A [[programmer]] uses the [[Abstraction (computer science)|abstractions]] present in the language to represent the concepts involved in a computation. These concepts are represented as a collection of the simplest elements available (called [[language primitive|primitives]]).<ref>{{cite web|url=http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html|title=Structure and Interpretation of Computer Programs|author=Abelson, Sussman, and Sussman|access-date=3 March 2009|url-status=dead|archive-url=https://web.archive.org/web/20090226050622/http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-10.html|archive-date=26 February 2009}}</ref> ''[[Computer Programming|Programming]]'' is the process by which programmers combine these primitives to compose new programs, or adapt existing ones to new uses or a changing environment.
Programs for a computer might be [[Execution (computing)|executed]] in a [[Batch processing|batch process]] without any human interaction, or a user might type [[Command (computing)|commands]] in an [[Session (computer science)|interactive session]] of an [[Interpreter (computing)|interpreter]]. In this case the "commands" are simply programs, whose execution is chained together. When a language can run its commands through an interpreter (such as a [[Unix shell]] or other [[command-line interface]]), without compiling, it is called a [[scripting language]].<ref>{{cite web
|url = http://www.mactech.com/articles/mactech/Vol.15/15.09/ScriptingLanguages/index.html
|title = Scripting Languages
Line 235 ⟶ 239:
Combining and averaging information from various internet sites, stackify.com reported the ten most popular programming languages (in descending order by overall popularity): [[Java (programming language)|Java]], [[C (programming language)|C]], [[C++]], [[Python (programming language)|Python]], [[C Sharp (programming language)|C#]], [[JavaScript]], [[Visual Basic .NET|VB .NET]], [[R (programming language)|R]], [[PHP]], and [[MATLAB]].<ref>{{cite web |url=https://stackify.com/popular-programming-languages-2018/ |title=Most Popular and Influential Programming Languages of 2018 |publisher=stackify.com |date=2017-12-18 |access-date=2018-08-29 |archive-date=30 August 2018 |archive-url=https://web.archive.org/web/20180830004924/https://stackify.com/popular-programming-languages-2018/ |url-status=live }}</ref>
As of June 2024, the top five programming languages as measured by [[TIOBE index]] are [[Python (programming language)|Python]], [[C++]], [[C (programming language)|C]], [[Java (programming language)|Java]] and [[C Sharp (programming language)|C#]]. TIOBE
==Dialects, flavors and implementations==
Line 242 ⟶ 246:
==Classifications==
{{details|Categorical list of programming languages}}
Programming languages
;Imperative
An [[imperative programming]] language supports implementing logic encoded as a sequence of ordered operations. Most popularly used languages are classified as imperative.{{sfn|Sebesta|2012|pp=21–22}}
*Functional programming languages work by successively applying functions to the given parameters. Although appreciated by many researchers for their simplicity and elegance, problems with efficiency have prevented them from being widely adopted.{{sfn|Sebesta|2012|p=12}}▼
;Functional
*Logic languages are designed so that the software, rather than the programmer, decides what order in which the instructions are executed.{{sfn|Sebesta|2012|p=22}}▼
▲
*Object-oriented programming—whose characteristic features are [[data abstraction]], [[Inheritance (object-oriented programming)|inheritance]], and [[dynamic dispatch]]—is supported by most popular imperative languages and some functional languages.{{sfn|Sebesta|2012|pp=21–22}}▼
;Logic
Although [[markup languages]] are not programming languages, some have extensions that support limited programming. Additionally, there are special-purpose languages that are not easily compared to other programming languages.{{sfn|Sebesta|2012|pp=22–23}}▼
▲
; Object-oriented
▲
; Markup
Although a [[markup language]] is not a programming language per se, it might support integration with a programming language.
; Special
▲
==See also==
Line 296 ⟶ 307:
* [[Ellis Horowitz]] (ed.): ''Programming Languages, a Grand Tour'' (3rd ed.), 1987.
* Ellis Horowitz: ''Fundamentals of Programming Languages'', 1989.
* [[Shriram Krishnamurthi]]: ''[[Programming Languages: Application and Interpretation]]'', [
*{{cite book |last1=Gabbrielli |first1=Maurizio |last2=Martini |first2=Simone |title=Programming Languages: Principles and Paradigms |date=2023 |publisher=Springer |isbn=978-3-031-34144-1 |language=en|edition=2nd}}
* [[Bruce J. MacLennan]]: ''Principles of Programming Languages: Design, Evaluation, and Implementation'', [[Oxford University Press]] 1999.
|