Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Semantics
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Computer science === {{main|Semantics (computer science)}} In computer science, the semantics of a [[Computer program|program]] is how it behaves when a computer runs it. Semantics contrasts with syntax, which is the particular form in which instructions are expressed. The same behavior can usually be described with different forms of syntax. In [[JavaScript]], this is the case for the commands <code>i += 1</code> and <code>i = i + 1</code>, which are syntactically different expressions to increase the value of the variable ''i'' by one. This difference is also reflected in different [[programming languages]] since they rely on different syntax but can usually be employed to create programs with the same behavior on the semantic level.<ref>{{multiref | {{harvnb|Fernández|2014|pp=[https://books.google.com/books?id=dzi5BQAAQBAJ&pg=PA10 10, 14–15]}} | {{harvnb|Dale|Weems|Headington|2003|pp=[https://books.google.com/books?id=VbyCFuJLgOMC&pg=PA42 42, 44]}} | {{harvnb|O’Regan|2020|p=[https://books.google.com/books?id=hnLJDwAAQBAJ&pg=PA193 193]}} }}</ref> Static semantics focuses on semantic aspects that affect the [[compile time|compilation]] of a program. In particular, it is concerned with detecting errors of syntactically correct programs, such as [[type error]]s, which arise when an operation receives an incompatible [[data type]]. This is the case, for instance, if a function performing a numerical calculation is given a [[String (computer science)|string]] instead of a number as an argument.<ref>{{multiref | {{harvnb|Fernández|2014|pp=[https://books.google.com/books?id=dzi5BQAAQBAJ&pg=PA14 14–15]}} | {{harvnb|Fritzson|2010|p=[https://books.google.com/books?id=doNqLi7279wC&pg=PA703 703]}} | {{harvnb|Mosses|2003|p=[https://books.google.com/books?id=tMlrCQAAQBAJ&pg=PA167 167]}} }}</ref> Dynamic semantics focuses on the run time behavior of programs, that is, what happens during the [[Execution (computing)|execution]] of instructions.<ref>{{multiref | {{harvnb|Fernández|2014|pp=[https://books.google.com/books?id=dzi5BQAAQBAJ&pg=PA15 15–16]}} | {{harvnb|Fritzson|2010|p=[https://books.google.com/books?id=doNqLi7279wC&pg=PA703 703]}} | {{harvnb|Mosses|2003|p=[https://books.google.com/books?id=tMlrCQAAQBAJ&pg=PA167 167]}} }}</ref> The main approaches to dynamic semantics are [[denotational semantics|denotational]], [[axiomatic semantics|axiomatic]], and [[operational semantics]]. Denotational semantics relies on mathematical formalisms to describe the effects of each element of the code. Axiomatic semantics uses deductive logic to analyze which conditions must be in place before and after the execution of a program. Operational semantics interprets the execution of a program as a series of steps, each involving the transition from one [[State (computer science)|state]] to another state.<ref>{{multiref | {{harvnb|Fernández|2014|p=[https://books.google.com/books?id=dzi5BQAAQBAJ&pg=PA16 16]}} | {{harvnb|O’Regan|2020|pp=[https://books.google.com/books?id=hnLJDwAAQBAJ&pg=PA193 193–194]}} }}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)