06.3. Semantic Analysis III - http/usecurity.hanyang.ac.kr...

This preview shows page 1 - 8 out of 23 pages.

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

Subscribe to view the full document.

Scope Rules and Block Structure Declaration before use C and Pascal 파싱 과정에서 symbol table 생성되고 name reference 있으면 symbol table lookup if lookup fails, a violation of declaration 2
Image of page 2
Block Structure common property of modern languages any construct that can contain declarations C: compilation units, procedure/function declarations, compound statements, struct/union a language is block structured if nesting of blocks permitted most closely nested rule 3
Image of page 3

Subscribe to view the full document.

int i, j int f(int size) { char i, temp; { double j; } { char *j; } } Figure 6.14 nested scopes 4
Image of page 4
Figure 6.15 nest scopes (Pascal) program Ex; var i, j: integer; function f(size: integer): integer; var i, temp: char; procedure g; var j: real; begin end; procedure h; var j: ^char; begin end; begin (* f *) end; begin (* main *) end. 5
Image of page 5

Subscribe to view the full document.

nested scopes symbol table operations insert : must not overwrite previous declarations lookup : find the most recently inserted declaration delete : delete only the most recent one 6
Image of page 6
Figure 6.16
Image of page 7

Subscribe to view the full document.

Image of page 8
  • Spring '16
  • ko
  • http://usecurity.hanyang.ac.kr

{[ snackBarMessage ]}

Get FREE access by uploading your study materials

Upload your study materials now and get free access to over 25 million documents.

Upload now for FREE access Or pay now for instant access
Christopher Reinemann
"Before using Course Hero my grade was at 78%. By the end of the semester my grade was at 90%. I could not have done it without all the class material I found."
— Christopher R., University of Rhode Island '15, Course Hero Intern

Ask a question for free

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern