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
Programming language
(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!
====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"/>{{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>
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)