move *.md to notes/*.md and add lecture pdf
This commit is contained in:
62
notes/1.md
Normal file
62
notes/1.md
Normal file
@@ -0,0 +1,62 @@
|
||||
컴파일러 1
|
||||
===
|
||||
|
||||
|
||||
# Interpreter in Modern Processors
|
||||
|
||||
|
||||
# Compiler
|
||||
|
||||
* Front-End
|
||||
|
||||
보이는 부분(HW에 신경을 안써도 됨)
|
||||
|
||||
* Back-End
|
||||
|
||||
HW에 밀접한 최적화를 해줌
|
||||
|
||||
|
||||
## General Structure of a Modern Compiler
|
||||
|
||||
* Front-End
|
||||
* Lexial Analysis
|
||||
* Syntax Analysis
|
||||
* Semantic Analysis
|
||||
* Code Generation - 1
|
||||
* Back-End
|
||||
* Control/DataFlow Analysis
|
||||
* Optimization
|
||||
* Code Generation - 2
|
||||
|
||||
이런 모듈식 구조는 다양한 언어와 하드웨어에 쉽게 적용할 수 있도록 도운다.
|
||||
|
||||
### Lexical Analysis (Scanner)
|
||||
|
||||
프로그램을 `token`의 의미 단위로 나눔.
|
||||
그리고 의미가 없는 단위를 지움.
|
||||
|
||||
보통 FSA로 구현함.
|
||||
|
||||
### Syntax Analysis (Parser)
|
||||
|
||||
미리 있는 Grammar를 바탕으로 Syntax Correctness를 진행함.
|
||||
|
||||
### Semantic Analysis
|
||||
|
||||
* identifier 정의 등
|
||||
* 타입 체크
|
||||
* 스코프 체크
|
||||
* 오버로딩 모호화 해소
|
||||
* IR로 변환
|
||||
|
||||
### Optimization
|
||||
|
||||
최적화함
|
||||
* 상수 최적화
|
||||
* 안쓰는 변수
|
||||
* loop에서 안바뀌는 변수
|
||||
* 다시 똑같이 계산하는 변수 제거
|
||||
* ...
|
||||
|
||||
### Code Generation
|
||||
|
||||
Reference in New Issue
Block a user