Content deleted Content added
Laiwoonsiu (talk | contribs) m Corrected minor typos. |
Citation bot (talk | contribs) Removed URL that duplicated identifier. | Use this bot. Report bugs. | Suggested by Dominic3203 | Category:Programming language semantics | #UCB_Category 12/17 |
||
(30 intermediate revisions by 18 users not shown) | |||
Line 1:
{{confuse|Computational semantics}}
{{Short description|
{{Semantics}}
{{Formal languages}}
In [[programming language theory]], '''semantics''' is the field concerned with the rigorous mathematical study of the meaning of [[programming language]]s.<ref>{{cite book |author=[[Joseph Goguen|Joseph A. Goguen]] |chapter=Semantics of computation |title=Category Theory Applied to Computation and Control |publisher=[[Springer Publishing|Springer]] |date=1975 |pages=151-163 |doi=10.1007/3-540-07142-3_75}}</ref> It does so by evaluating the meaning of [[programming language syntax|syntactically]] valid [[string (computer science)|strings]] defined by a specific programming language, showing the computation involved. In such a case that the evaluation would be of syntactically invalid strings, the result would be non-computation. Semantics describes the processes a computer follows when executing a program in that specific language. This can be shown by describing the relationship between the input and output of a program, or an explanation of how the program will be executed on a certain [[computer platform|platform]], hence creating a [[model of computation]].▼
▲In [[programming language theory]], '''semantics''' is
'''Semantics''' describes the processes a computer follows when [[Execution (computing)|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 [[computer platform|platform]], thereby creating a [[model of computation]].
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 [[formal verification|proofs of correctness]], equivalence, and termination".<ref name=floyd>{{cite book |year=1967 |author-link=Robert W. Floyd |first=Robert W. |last=Floyd |chapter=Assigning Meanings to Programs |chapter-url=https://people.eecs.berkeley.edu/~necula/Papers/FloydMeaning.pdf |editor-first=J.T. |editor-last=Schwartz |title=Mathematical Aspects of Computer Science |publisher=American Mathematical Society |isbn=0821867288 |pages=19–32 |url=https://books.google.com/books?id=ynigSICJflYC |series=Proceedings of Symposium on Applied Mathematics |volume=19 }}</ref><ref>{{cite web |author-link=Donald Knuth|author-first=Donald E.|author-last=Knuth |title=Memorial Resolution: Robert W. Floyd (1936–2001) |url=https://stacks.stanford.edu/file/druid:zy788sr3998/SC0193_MemorialResolution_Floyd_Robert.pdf |work=Stanford University Faculty Memorials |publisher=Stanford Historical Society }}</ref> Floyd further wrote:{{r|floyd}}
<blockquote>
A semantic definition of a programming language, in our approach, is founded on a [[Syntax (programming languages)|syntactic]] definition. It must specify which of the phrases in a syntactically correct program represent [[Command (computing)|commands]], and what [[Conditional (computer programming)|conditions]] must be imposed on an interpretation in the neighborhood of each command.
</blockquote>
In 1969, [[Tony Hoare]] published a paper on [[Hoare logic]] seeded by Floyd's ideas, now sometimes collectively called ''[[axiomatic semantics]]''.<ref name="hoare">{{Cite journal
|last=Hoare
|first=C. A. R.
|authorlink=Tony Hoare
|title=An axiomatic basis for computer programming
|doi=10.1145/363235.363259
|journal=[[Communications of the ACM]]
|volume=12
|issue=10
|pages=576–580
|date=October 1969
|s2cid=207726175
|doi-access=free
}}</ref>{{r|winskel}}
In the 1970s, the terms ''[[operational semantics]]'' and ''[[denotational semantics]]'' emerged.<ref name=winskel>{{cite book |last1=Winskel |first1=Glynn |title=The formal semantics of programming languages : an introduction |date=1993 |publisher=MIT Press |location=Cambridge, Mass. |isbn=978-0-262-23169-5 |page=[https://archive.org/details/formalsemanticso0000wins/page/n17 xv] |url=https://archive.org/details/formalsemanticso0000wins}}</ref>
==Overview==
Line 16 ⟶ 44:
There are many approaches to formal semantics; these belong to three major classes:
* '''[[Denotational semantics]]''',<ref name=Schmidt1986>{{cite book |author-first=David A.
* '''[[Operational semantics]]''',<ref name=Plotkin1981>{{cite
* '''[[Axiomatic semantics]]''',<ref name=Goguen77>{{cite
Apart from the choice between denotational, operational, or axiomatic approaches, most variations in formal semantic systems arise from the choice of supporting mathematical formalism.{{cn|date=April 2024}}
==Variations==
Some variations of formal semantics include the following:
* '''[[Action semantics]]'''<ref name=Mosses1996>{{cite
* '''[[Algebraic semantics (computer science)|Algebraic semantics]]'''<ref name=Goguen77/> is a form of [[axiomatic semantics]] based on [[algebra]]ic laws for describing and reasoning about [[program semantics]] in a [[formal methods|formal]] manner. It also supports [[denotational semantics]] and [[operational semantics]];
* '''[[Attribute grammar]]s'''<ref>{{cite book |author1-first=Pierre
* '''[[Categorical semantics|Categorical]] (or "functorial") semantics'''<ref name=Lawvere1963>{{cite
* '''[[Concurrency semantics]]'''<ref>{{cite conference |author1-first=Mark
* '''[[Game semantics]]'''<ref name=Abramsky2009>{{cite book |author-link=
* '''[[Predicate transformer semantics]]''',<ref name=Dijkstra1975>{{cite
==Describing relationships==
Line 38 ⟶ 66:
*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 [[abstraction (computer science)#Semantics|abstractions]] via the theory of [[abstract interpretation]].{{cn|date=April 2024}}
▲== History ==
== See also ==
Line 63 ⟶ 87:
*{{cite book |year=1991 |author-link=Robert D. Tennent |first=Robert D. |last=Tennent |title=Semantics of Programming Languages |url=https://books.google.com/books?id=K7N7QgAACAAJ |publisher=Prentice Hall |isbn=978-0-13-805599-8}}
*{{cite book |year=1992 |author-link=Carl Gunter (computer scientist) |first=Carl |last=Gunter |title=Semantics of Programming Languages |publisher=MIT Press |isbn=0-262-07143-6 }}
*{{cite book |year=1992 |
*{{cite book |year=1993 |author-link=Glynn Winskel |first=Glynn |last=Winskel |title=The Formal Semantics of Programming Languages: An Introduction |publisher=MIT Press |isbn=0-262-73103-7 }}
*{{cite book |year=1995 |author-link=John C. Mitchell |last=Mitchell |first=John C. |url=http://www.lix.polytechnique.fr/~catuscia/teaching/cg520/papers_and_books/Mitchell_book.ps.gz |title=Foundations for Programming Languages |format=Postscript}}
*{{cite book |year=1995 |author-link=Kenneth Slonneger |
*{{cite book |year=1998 |author-link=John C. Reynolds |first=John C. |last=Reynolds |title=Theories of Programming Languages |url=https://archive.org/details/theoriesofprogra0000reyn |url-access=registration |publisher=Cambridge University Press |isbn=0-521-59414-6 }}
*{{cite book |year=2006 |author-link=Robert Harper (computer scientist) |first=Robert |last=Harper |title=Practical Foundations for Programming Languages |url=https://www.cs.cmu.edu/~rwh/plbook/book.pdf
*{{cite book |
*{{cite book |year=2014 |author-link=Aaron Stump |first=Aaron |last=Stump |title=Programming Language Foundations |publisher=Wiley |isbn=978-1-118-00747-1 }}
*{{cite web |author-link=Shriram Krishnamurthi |first=Shriram |last=Krishnamurthi |title=Programming Languages: Application and Interpretation |date=2012 |edition=2nd |url=http://cs.brown.edu/courses/cs173/2012/book/}}
; Lecture notes
*{{cite web |first=Glynn |last=Winskel |title=Denotational Semantics |publisher=University of Cambridge |url=http://www.cl.cam.ac.uk/~gw104/dens.pdf
{{refend}}
== External links ==
* {{cite book|last=Aaby|first=Anthony|title=Introduction to Programming Languages|year=2004|url=http://www.emu.edu.tr/aelci/Courses/D-318/D-318-Files/plbook/semantic.htm|url-status=
{{DEFAULTSORT:Semantics Of Programming Languages}}
|