06.1. Semantic Analysis - http/usecurity.hanyang.ac.kr...

This preview shows page 1 - 13 out of 42 pages.

Chapter 6 Semantic Analysis 한양대학교 컴퓨터공학부 컴파일러 2014 2 학기
Image of page 1

Subscribe to view the full document.

Overview also called “ static semantic analysis involves building a symbol table To keep track of the meanings of names performing type inference and type checking 2
Image of page 2
Can be divided into two categories Analysis of a program required by the rules of the PLs To establish correctness To guarantee proper execution Analysis performed by a compiler To enhance the efficiency of execution A.K.A. “optimization” Semantic Analysis 3 Ada Static Pascal, C, … LISP, Smalltalk Dynamically oriented lang
Image of page 3

Subscribe to view the full document.

Static semantic analysis description of the analyses identify attributes write attribute equations, or semantic rules implementation of the analyses not clearly expressible 4
Image of page 4
Attributes any property of a programming language construct data type of a variable static or dynamic value of an expression usually dynamic location of a variable in memory static or dynamic obj code of a procedure static the number of significant digits in a number static binding of the attribute Process of computing an attribute and associating its computed value 5
Image of page 5

Subscribe to view the full document.

Attribute grammar (semantic rules) a set of attributes and equations Useful to describe the syntax-directed semantics An attribute is computed to a nonterminal or a terminal Attribute grammars 6
Image of page 6