내가 아버지께 내가 전산을 전공하면서 저지른 가장 큰 실수가 무엇이라고 생각하시는지 여쭤본다면... 아버지께서는 주저하지 않고, Compiler Design and Implementation이랑 Formal Lanugages 수업을 듣지 않은 것이라고 하실 것이다...

그동안 그 말을 무시했었는데, 나의 관심사가 그쪽으로 흘러가면서 좀 후회스럽다... 그래서 어제부터 아버지 책꽂이에서 쌥쳐온 Compiler 책을 무작정 보기 시작했다 !!! 독학으로 Compiler를 공부하리라 마음먹고 말이다...
바로 이 책인데... Compiler 관련 책으로는 아주 고전(참고로 나는 이책을 4살때 쯤부터 본것 같다... 다시한번 말하지만 읽지는 않고 보기만 했다... 아버지께서는 저 책 표지를 보여주시면서 컴퓨터는 이 그림처럼 재미있는것이라고 설명해 주셨었다 ㅡ.ㅡ;)으로 잘 알려져 있을것이다. 아마 이 사진을 보고 치를 떠시는 분도 있을지도 모르겠다... 어쨌든, 지금은 몇번째 에디션까지 나와있는지 모르겠지만, 저 에디션은 1988년에 수정되어서 재출간된 에디션인것 같다...

어쨌든... 어제 열공한 내용을 살짝 정리를 해보고자 한다... Just to show off what I have learned...
참 유치하다...      ^^;

Division between lexical and syntactic analysis is somewhat arbitrary, but...
  • Lexical constructs do not require recursion
  • Syntactic constructs often require recursion


Context-Free Grammars are formalization of recursive rules that can be used to guide syntactic analysis.

Analysis of the source program
  • Lexical Analysis: Detect errors where the characters remaining in the input do not form any token of the language
  • Syntax Analysis: Detects whether the token stream violates the syntax of the language
  • Semantic Analysis: Detect constructs that have the right syntactic structure but no meaning to the operation involved


Compiler Operation Phases
  1. Lexical Analysis
  2. Syntax Analysis
  3. Semantic Analysis
  4. Generate Intermediate Code
  5. Optimization
  6. Code Generation

(Symbolic-Table Manager and the Error Handler are involved in all phases)



Lexeme is a character sequence forming a token


Preprocessors produce input to compilers


Use of Preprocessors
  • Macro processing
  • File inclusion
  • Rational Preprocessing
  • language extension


Grouping Compilation Phases
  • Front-End: Phases that depend primarily on the source language and independent of the target machine. i.e. Lexical, Syntax analysis, creation of symbolic table, semantic analysis, and generation of intermediate code, (certain amount of optimization)
  • Back-End: Phases that do not depend on the source language, but just the intermediate language
Posted by Dansoonie