Semantic analysis (compilers): Difference between revisions

Content deleted Content added
minor grammar changes; "complexity of a..." -> "structure of a..."
Citation bot (talk | contribs)
Alter: url. URLs might have been anonymized. | Use this bot. Report bugs. | Suggested by AManWithNoPlan | #UCB_webform 2128/2199
 
(45 intermediate revisions by 34 users not shown)
Line 1:
{{other uses|Semantic analysis (disambiguation)}}
In [[computer science]], '''semantic analysis''' is a pass that identifies the meaning of a programming language and determines how to execute it.
'''Semantic analysis''' or '''context sensitive analysis''' is a process in [[compiler]] construction, usually after [[parsing]], to gather necessary semantic information from the [[source code]].<ref name="WilhelmSeidl2013">{{cite book|author1=Reinhard Wilhelm|author2=Helmut Seidl|author3=Sebastian Hack|title=Compiler Design: Syntactic and Semantic Analysis|url=https://books.google.com/books?id=NTIkJAuytiwC&q=%22semantic+analysis%22|date=13 May 2013|publisher=Springer Science & Business Media|isbn=978-3-642-17540-4}}</ref> It usually includes [[type checking]], or makes sure a variable is declared before use which is impossible to describe in the [[extended Backus–Naur form]] and thus not easily detected during parsing.
 
== See also ==
It follows [[parsing]] and precedes [[code generation]]. This process faithfully reflects the structure of a programming language.
* [[Attribute grammar]]
* [[Context-sensitive language]]
* [[Semantic analysis (computer science)]]
 
==References==
The job of the semantic analyzer is to understand the meaning of programming language and make decisions about how to execute it, that is, to indentify the role of an expression and make the order of evaluation. In other words, semantic analysis is what defines the individual character of a programming language. Semantic analyzers usually maintain symbolic tables in order to know what a symbol refers to when it is encountered.
<references />
[[Category:Compiler construction]]
[[Category:Program analysis]]
 
The semantic analyzer usualy employs a set of tiny routines called [[semantic action routine]]s.
 
{{plt-stub}}
Task in this pass include:
* [[object binding]]
* static [[type-checking]]
* some [[optimization]] (not always)
 
'''See also''': [[compiler]], [[parsing]], [[code generation]], [[attribute grammar]], [[semantic action routine]]