Semantics (programming languages)
In programming language theory, semantics is the rigorous mathematical logic study of the meaning of programming languages. Semantics assigns computational meaning to valid strings in a programming language syntax. It is closely related to, and often crosses over with, the semantics of mathematical proofs. Semantics describes the processes a computer follows when executing a program in that specific language. This can be done by describing the relationship between the input and output of a program, or giving an explanation of how the program will be executed on a certain platform, thereby creating a model of computation.
In programming language theory, semantics is the rigorous mathematical logic study of the meaning of programming languages. Semantics assigns computational meaning to valid strings in a programming language syntax. It is closely related to, and often crosses over with, the semantics of mathematical proofs. Semantics describes the processes a computer follows when executing a program in that specific language. This can be done by describing the relationship between the input and output of a program, or giving an explanation of how the program will be executed on a certain platform, thereby creating a model of computation. ==History== In 1967, Robert W. Floyd published the paper Assigning meanings to programs; his chief aim was "a rigorous standard for proofs about computer programs, including proofs of correctness, equivalence, and termination". Floyd further wrote: In 1969, Tony Hoare published a paper on Hoare logic seeded by Floyd's ideas, now sometimes collectively called axiomatic semantics. In the 1970s, the terms operational semantics and denotational semantics emerged. ==Overview== The field of formal semantics encompasses all of the following: The definition of semantic models The relations between different semantic models The relations between different approaches to meaning The relation between computation and the underlying mathematical structures from fields such as logic, set theory, model theory, category theory, etc. It has close links with other areas of computer science such as programming language design, type theory, compilers and interpreters, program verification and model checking. ==Approaches== There are many approaches to formal semantics; these belong to three major classes: Denotational semantics, whereby each phrase in the language is interpreted as a denotation, i.e. a conceptual meaning that can be thought of abstractly. Such denotations are often mathematical objects inhabiting a mathematical space, but it is not a requirement that they should be so. As a practical necessity, denotations are described using some form of mathematical notation, which can in turn be formalized as a denotational metalanguage. For example, the denotational semantics of functional languages often translate the language into domain theory. Denotational semantic descriptions can also serve as compositional translations from a programming language into the denotational metalanguage and be used as a basis for designing compilers. Operational semantics, whereby the execution of the language is described directly (rather than by translation). Operational semantics loosely corresponds to interpretation, although again the "implementation language" of the interpreter is generally a mathematical formalism. Operational semantics may define an abstract machine (such as the SECD machine), and give meaning to phrases by describing the transitions they induce on states of the machine. Alternatively, as with the pure lambda calculus, operational semantics can be defined via syntactic transformations on phrases of the language itself; Axiomatic semantics, whereby one gives meaning to phrases by describing the axioms that apply to them. Axiomatic semantics makes no distinction between a phrase's meaning and the logical formulas that describe it; its meaning is exactly what can be proven about it in some logic. The canonical example of axiomatic semantics is Hoare logic. Apart from the choice between denotational, operational, or axiomatic approaches, most variations in formal semantic systems arise from the choice of supporting mathematical formalism. ==Variations== Some variations of formal semantics include the following: Action semantics is an approach that tries to modularize denotational semantics, splitting the formalization process in two layers (macro and microsemantics) and predefining three semantic entities (actions, data and yielders) to simplify the specification; Algebraic semantics is a form of axiomatic semantics based on algebraic laws for describing and reasoning about program semantics in a formal manner. It also supports denotational semantics and operational semantics; Attribute grammars define systems that systematically compute "metadata" (called attributes) for the various cases of the language's syntax. Attribute grammars can be understood as a denotational semantics where the target language is simply the original language enriched with attribute annotations. Aside from formal semantics, attribute grammars have also been used for code generation in compilers, and to augment regular or context-free grammars with context-sensitive conditions; Categorical (or "functorial") semantics uses category theory as the core mathematical formalism. Categorical semantics is usually proven to correspond to some axiomatic semantics that gives a syntactic presentation of the categorical structures. Also, denotational semantics are often instances of a general categorical semantics; Concurrency semantics is a catch-all term for any formal semantics that describes concurrent computations. Historically important concurrent formalisms have included the actor model and process calculi; Game semantics uses a metaphor inspired by game theory; Predicate transformer semantics, developed by Edsger W. Dijkstra, describes the meaning of a program fragment as the function transforming a postcondition to the precondition needed to establish it. ==Describing relationships== For a variety of reasons, one might wish to describe the relationships between different formal semantics. For example: To prove that a particular operational semantics for a language satisfies the logical formulas of an axiomatic semantics for that language. Such a proof demonstrates that it is "sound" to reason about a particular (operational) interpretation strategy using a particular (axiomatic) proof system. To prove that operational semantics over a high-level machine is related by a simulation with the semantics over a low-level machine, whereby the low-level abstract machine contains more primitive operations than the high-level abstract machine definition of a given language. Such a proof demonstrates that the low-level machine "faithfully implements" the high-level machine. It is also possible to relate multiple semantics through abstractions via the theory of abstract interpretation.
References
- Semantics of computation · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Semantics of computation." Goguen, Joseph A. 2026-11-21. https://en.wikipedia.org/wiki/Joseph_Goguen. Accessed 24 November 2026.
Chicago "Semantics of computation." Goguen, Joseph A. 2026-11-21. https://en.wikipedia.org/wiki/Joseph_Goguen.
APA Goguen, Joseph A. (2026). Semantics of computation. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Joseph_Goguen
- Deransart, Pierre; Jourdan, Martin; Lorho, Bernard (1988). "Attribute Grammars: Definitions, Systems and Bibliography . Lecture Notes in Computer Science 323. Springer-Verlag . ISBN 9780387500560 . Wikipedia revision 1374771897, retrieved 2026-11-22 · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Deransart, Pierre; Jourdan, Martin; Lorho, Bernard (1988). "Attribute Grammars: Definitions, Systems and Bibliography . Lecture Notes in Computer Science 323. Springer-Verlag . ISBN 9780387500560 . Wikipedia revision 1374771897, retrieved 2026-11-22." Deransart, Pierre; Jourdan, Martin; Lorho, Bernard (1988). 2026-11-21. https://en.wikipedia.org/wiki/Springer-Verlag. Accessed 24 November 2026.
Chicago "Deransart, Pierre; Jourdan, Martin; Lorho, Bernard (1988). "Attribute Grammars: Definitions, Systems and Bibliography . Lecture Notes in Computer Science 323. Springer-Verlag . ISBN 9780387500560 . Wikipedia revision 1374771897, retrieved 2026-11-22." Deransart, Pierre; Jourdan, Martin; Lorho, Bernard (1988). 2026-11-21. https://en.wikipedia.org/wiki/Springer-Verlag.
APA Deransart, Pierre; Jourdan, Martin; Lorho, Bernard (1988). (2026). Deransart, Pierre; Jourdan, Martin; Lorho, Bernard (1988). "Attribute Grammars: Definitions, Systems and Bibliography . Lecture Notes in Computer Science 323. Springer-Verlag . ISBN 9780387500560 . Wikipedia revision 1374771897, retrieved 2026-11-22. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Springer-Verlag
- Some fundamental algebraic tools for the semantics of computation: Part 3. Indexed categories · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Some fundamental algebraic tools for the semantics of computation: Part 3. Indexed categories." Andrzej Tarlecki; Rod M. 2026-11-21. https://en.wikipedia.org/wiki/Rod_Burstall. Accessed 24 November 2026.
Chicago "Some fundamental algebraic tools for the semantics of computation: Part 3. Indexed categories." Andrzej Tarlecki; Rod M. 2026-11-21. https://en.wikipedia.org/wiki/Rod_Burstall.
APA Andrzej Tarlecki; Rod M. (2026). Some fundamental algebraic tools for the semantics of computation: Part 3. Indexed categories. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Rod_Burstall
- The problem of programming language concurrency semantics · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "The problem of programming language concurrency semantics." Batty, Mark; Memarian, Kayvan; Nienhuis, Kyndylan; Pichon-Pharabod, Jean; Sewell, Peter (2015). 2026-11-21. http://kar.kent.ac.uk/50271/1/c_concurrency_challenges.pdf. Accessed 24 November 2026.
Chicago "The problem of programming language concurrency semantics." Batty, Mark; Memarian, Kayvan; Nienhuis, Kyndylan; Pichon-Pharabod, Jean; Sewell, Peter (2015). 2026-11-21. http://kar.kent.ac.uk/50271/1/c_concurrency_challenges.pdf.
APA Batty, Mark; Memarian, Kayvan; Nienhuis, Kyndylan; Pichon-Pharabod, Jean; Sewell, Peter (2015). (2026). The problem of programming language concurrency semantics. Retrieved November 24, 2026, from http://kar.kent.ac.uk/50271/1/c_concurrency_challenges.pdf
- Memorial Resolution: Robert W. Floyd (1936–2001) · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Memorial Resolution: Robert W. Floyd (1936–2001)." Knuth, Donald E. 2026-11-21. https://en.wikipedia.org/wiki/Donald_Knuth. Accessed 24 November 2026.
Chicago "Memorial Resolution: Robert W. Floyd (1936–2001)." Knuth, Donald E. 2026-11-21. https://en.wikipedia.org/wiki/Donald_Knuth.
APA Knuth, Donald E. (2026). Memorial Resolution: Robert W. Floyd (1936–2001). Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Donald_Knuth
- Semantics of interaction: An introduction to game semantics · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Semantics of interaction: An introduction to game semantics." Abramsky, Samson (2009). 2026-11-21. https://en.wikipedia.org/wiki/Samson_Abramsky. Accessed 24 November 2026.
Chicago "Semantics of interaction: An introduction to game semantics." Abramsky, Samson (2009). 2026-11-21. https://en.wikipedia.org/wiki/Samson_Abramsky.
APA Abramsky, Samson (2009). (2026). Semantics of interaction: An introduction to game semantics. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Samson_Abramsky
- Guarded commands, nondeterminacy and formal derivation of programs · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Guarded commands, nondeterminacy and formal derivation of programs." Dijkstra, Edsger W. 2026-11-21. https://en.wikipedia.org/wiki/Edsger_W._Dijkstra. Accessed 24 November 2026.
Chicago "Guarded commands, nondeterminacy and formal derivation of programs." Dijkstra, Edsger W. 2026-11-21. https://en.wikipedia.org/wiki/Edsger_W._Dijkstra.
APA Dijkstra, Edsger W. (2026). Guarded commands, nondeterminacy and formal derivation of programs. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Edsger_W._Dijkstra
- Initial algebra semantics and continuous algebras · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Initial algebra semantics and continuous algebras." a b Goguen, Joseph A. 2026-11-21. https://en.wikipedia.org/wiki/Joseph_Goguen. Accessed 24 November 2026.
Chicago "Initial algebra semantics and continuous algebras." a b Goguen, Joseph A. 2026-11-21. https://en.wikipedia.org/wiki/Joseph_Goguen.
APA a b Goguen, Joseph A. (2026). Initial algebra semantics and continuous algebras. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Joseph_Goguen
- Functorial semantics of algebraic theories · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Functorial semantics of algebraic theories." Lawvere, F. 2026-11-21. https://en.wikipedia.org/wiki/William_Lawvere. Accessed 24 November 2026.
Chicago "Functorial semantics of algebraic theories." Lawvere, F. 2026-11-21. https://en.wikipedia.org/wiki/William_Lawvere.
APA Lawvere, F. (2026). Functorial semantics of algebraic theories. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/William_Lawvere
- Mosses, Peter D. (1996). Theory and practice of action semantics (Report). BRICS Report RS9653. Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22 · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Mosses, Peter D. (1996). Theory and practice of action semantics (Report). BRICS Report RS9653. Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22." Mosses, Peter D. 2026-11-21. https://en.wikipedia.org/wiki/Peter_Mosses. Accessed 24 November 2026.
Chicago "Mosses, Peter D. (1996). Theory and practice of action semantics (Report). BRICS Report RS9653. Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22." Mosses, Peter D. 2026-11-21. https://en.wikipedia.org/wiki/Peter_Mosses.
APA Mosses, Peter D. (2026). Mosses, Peter D. (1996). Theory and practice of action semantics (Report). BRICS Report RS9653. Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Peter_Mosses
- Plotkin, Gordon D. (1981). A structural approach to operational semantics (Report). Technical Report DAIMI FN-19. Computer Science Department, Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22 · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Plotkin, Gordon D. (1981). A structural approach to operational semantics (Report). Technical Report DAIMI FN-19. Computer Science Department, Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22." Plotkin, Gordon D. 2026-11-21. https://en.wikipedia.org/wiki/Gordon_Plotkin. Accessed 24 November 2026.
Chicago "Plotkin, Gordon D. (1981). A structural approach to operational semantics (Report). Technical Report DAIMI FN-19. Computer Science Department, Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22." Plotkin, Gordon D. 2026-11-21. https://en.wikipedia.org/wiki/Gordon_Plotkin.
APA Plotkin, Gordon D. (2026). Plotkin, Gordon D. (1981). A structural approach to operational semantics (Report). Technical Report DAIMI FN-19. Computer Science Department, Aarhus University . Wikipedia revision 1374771897, retrieved 2026-11-22. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Gordon_Plotkin
- Schmidt, David A. (1986). Denotational Semantics: A Methodology for Language Development . William C. Brown Publishers. ISBN 9780205104505 . Wikipedia revision 1374771897, retrieved 2026-11-22 · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Schmidt, David A. (1986). Denotational Semantics: A Methodology for Language Development . William C. Brown Publishers. ISBN 9780205104505 . Wikipedia revision 1374771897, retrieved 2026-11-22." Schmidt, David A. 2026-11-21. https://en.wikipedia.org/wiki/ISBN_(identifier). Accessed 24 November 2026.
Chicago "Schmidt, David A. (1986). Denotational Semantics: A Methodology for Language Development . William C. Brown Publishers. ISBN 9780205104505 . Wikipedia revision 1374771897, retrieved 2026-11-22." Schmidt, David A. 2026-11-21. https://en.wikipedia.org/wiki/ISBN_(identifier).
APA Schmidt, David A. (2026). Schmidt, David A. (1986). Denotational Semantics: A Methodology for Language Development . William C. Brown Publishers. ISBN 9780205104505 . Wikipedia revision 1374771897, retrieved 2026-11-22. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/ISBN_(identifier)
- Assigning Meanings to Programs · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "Assigning Meanings to Programs." a b Floyd, Robert W. 2026-11-21. https://en.wikipedia.org/wiki/Robert_W._Floyd. Accessed 24 November 2026.
Chicago "Assigning Meanings to Programs." a b Floyd, Robert W. 2026-11-21. https://en.wikipedia.org/wiki/Robert_W._Floyd.
APA a b Floyd, Robert W. (2026). Assigning Meanings to Programs. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Robert_W._Floyd
- An axiomatic basis for computer programming · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "An axiomatic basis for computer programming." Hoare, C. 2026-11-21. https://en.wikipedia.org/wiki/Tony_Hoare. Accessed 24 November 2026.
Chicago "An axiomatic basis for computer programming." Hoare, C. 2026-11-21. https://en.wikipedia.org/wiki/Tony_Hoare.
APA Hoare, C. (2026). An axiomatic basis for computer programming. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Tony_Hoare
- a b Winskel, Glynn (1993). The formal semantics of programming languages : an introduction . Cambridge, Mass.: MIT Press. p. xv . ISBN 978-0-262-23169-5 . Wikipedia revision 1374771897, retrieved 2026-11-22 · retrieved 2026-11-21 · rev 1374771897
Cite this reference
MLA "a b Winskel, Glynn (1993). The formal semantics of programming languages : an introduction . Cambridge, Mass.: MIT Press. p. xv . ISBN 978-0-262-23169-5 . Wikipedia revision 1374771897, retrieved 2026-11-22." a b Winskel, Glynn (1993). 2026-11-21. https://archive.org/details/formalsemanticso0000wins. Accessed 24 November 2026.
Chicago "a b Winskel, Glynn (1993). The formal semantics of programming languages : an introduction . Cambridge, Mass.: MIT Press. p. xv . ISBN 978-0-262-23169-5 . Wikipedia revision 1374771897, retrieved 2026-11-22." a b Winskel, Glynn (1993). 2026-11-21. https://archive.org/details/formalsemanticso0000wins.
APA a b Winskel, Glynn (1993). (2026). a b Winskel, Glynn (1993). The formal semantics of programming languages : an introduction . Cambridge, Mass.: MIT Press. p. xv . ISBN 978-0-262-23169-5 . Wikipedia revision 1374771897, retrieved 2026-11-22. Retrieved November 24, 2026, from https://archive.org/details/formalsemanticso0000wins
- Floyd, Robert W. people.eecs.berkeley.edu . 1967. · retrieved 2026-09-12 · rev 1374771897
Cite this reference
MLA "Floyd, Robert W. people.eecs.berkeley.edu . 1967." Floyd, Robert W. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897. Accessed 24 November 2026.
Chicago "Floyd, Robert W. people.eecs.berkeley.edu . 1967." Floyd, Robert W. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897.
APA Floyd, Robert W. (2026). Floyd, Robert W. people.eecs.berkeley.edu . 1967. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1374771897
- Floyd, Robert W. books.google.com . 1967. · retrieved 2026-09-12 · rev 1374771897
Cite this reference
MLA "Floyd, Robert W. books.google.com . 1967." Floyd, Robert W. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897. Accessed 24 November 2026.
Chicago "Floyd, Robert W. books.google.com . 1967." Floyd, Robert W. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897.
APA Floyd, Robert W. (2026). Floyd, Robert W. books.google.com . 1967. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1374771897
- Memorial Resolution: Robert W. Floyd (1936–2001) . · retrieved 2026-09-12 · rev 1374771897
Cite this reference
MLA "Memorial Resolution: Robert W. Floyd (1936–2001) ." Memorial Resolution: Robert W. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897. Accessed 24 November 2026.
Chicago "Memorial Resolution: Robert W. Floyd (1936–2001) ." Memorial Resolution: Robert W. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897.
APA Memorial Resolution: Robert W. (2026). Memorial Resolution: Robert W. Floyd (1936–2001) . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1374771897
- Winskel, Glynn. The formal semantics of programming languages : an introduction . MIT Press . 1993. · retrieved 2026-09-12 · rev 1374771897
Cite this reference
MLA "Winskel, Glynn. The formal semantics of programming languages : an introduction . MIT Press . 1993." Winskel, Glynn. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897. Accessed 24 November 2026.
Chicago "Winskel, Glynn. The formal semantics of programming languages : an introduction . MIT Press . 1993." Winskel, Glynn. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897.
APA Winskel, Glynn. (2026). Winskel, Glynn. The formal semantics of programming languages : an introduction . MIT Press . 1993. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1374771897
- kar.kent.ac.uk . · retrieved 2026-09-12 · rev 1374771897
Cite this reference
MLA "kar.kent.ac.uk ." kar. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897. Accessed 24 November 2026.
Chicago "kar.kent.ac.uk ." kar. 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897.
APA kar. (2026). kar.kent.ac.uk . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1374771897
- Semantics and Logics of Computation . · retrieved 2026-09-12 · rev 1374771897
Cite this reference
MLA "Semantics and Logics of Computation ." 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897. Accessed 24 November 2026.
Chicago "Semantics and Logics of Computation ." 2026-09-12. https://en.wikipedia.org/w/index.php?oldid=1374771897.
APA encyclopegia.org. (2026). Semantics and Logics of Computation . Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1374771897
Cite this article
MLA
"Semantics (programming languages)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/semantics-programming-languages. Accessed 24 November 2026.
Chicago
"Semantics (programming languages)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/semantics-programming-languages.
APA
encyclopegia.org. (2026). Semantics (programming languages). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/semantics-programming-languages
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON