Semantic analysis (compilers): Difference between revisions

Content deleted Content added
Pearle (talk | contribs)
m Changing {{cleanup}} to {{cleanup-date|November 2005}}
Citation bot (talk | contribs)
Alter: url. URLs might have been anonymized. | Use this bot. Report bugs. | Suggested by AManWithNoPlan | #UCB_webform 2128/2199
 
(37 intermediate revisions by 27 users not shown)
Line 1:
{{other uses|Semantic analysis (disambiguation)}}
{{cleanup-date|November 2005}}
'''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 ==
In [[computer science]], '''semantic analysis''' is a pass by a [[compiler]] that adds semantical information to the [[parse tree]] and performs certain checks based on this information. It logically follows the [[parsing]] phase, in which the parse tree is generated, and logically precedes the [[code generation]] phase, in which executable code is generated. (In a compiler implementation, it may be possible to fold different phases into one pass.) Typical examples of semantical information that is added and checked is typing information ([[type checking]]) and the binding of variables and function names to their definitions ([[object binding]]). Sometimes also some early code optimization is done in this phase.
* [[Attribute grammar]]
* [[Context-sensitive language]]
* [[Semantic analysis (computer science)]]
 
==References==
For this phase the compiler usually maintains so-called ''symbolic tables'' in which it stores what each symbol (variable names, function names, etc.) refers to.
<references />
[[Category:Compiler construction]]
[[Category:ComputingProgram analysis]]
 
----
 
{{compuplt-stub}}
In [[linguistics]], '''semantic analysis''' is the process of unpacking [[clause]], sentence and paragraph structure, and even the structure of the work as a whole, to remove features specific to the language in which it is written and also the culture in which it was intended to be read. [[Figure of speech|Figures of speech]], being cultural, must also be eliminated. See [[translation]], [[structured semantic analysis]].
 
[[Category:Computing]]
{{compu-stub}}