LL Parser |
LR Parser |
First L of LL is for left to right and second L is for leftmost derivation. |
L of LR is for left to right and R is for rightmost derivation. |
Context Free Grammer (CFG)
- what is CFG ?
๐**์์ด ์ค๋ช
๐ํ๊ตญ์ด ์ค๋ช
โ CFG์ ๋ํ ์ ๋ฐ์ ์ธ ์ค๋ช
์ด ๋๋ฌด ์๋์ด ์์
Context free grammar** is a formal grammar which is used to generate all possible strings in a given formal language.
- expression์ ๋ํ CFG
- EโTEโ
- Eโโ+TEโ
- TโFTโ
- Tโโ*FTโ | e
- Fโ(E) | id
Derivation
- Leftmost Derivation & Rightmost Derivation
๋ณดํต ๊ฐ๋จํ๊ฒ left nonterminal์ ์ฐ์ ์ ์ผ๋ก terminal๋ก ๋ฐ๊พธ๋ ๊ณผ์ ์ Leftmost Derivation์ด๋ผ ํ๋ฉฐ, right nonterminal์ ๋จผ์ terminal๋ก ๋ฐ๊พธ๋ ๊ณผ์ ์ Rightmost Derivation์ด๋ผ๊ณ ํ๋ค.
๐ํ๊ตญ์ด ์ค๋ช
โ CFG์ ๋ํ ์ ๋ฐ์ ์ธ ์ค๋ช
์ด ๋๋ฌด ์๋์ด ์์
๐์์ด ์ค๋ช

Tree

** **Leftmost Derivation ****

** **Rightmost Derivation ****


1) Top-down Parsing
Top-down Parsing์ ๋ํ ํ๊ธ์ค๋ช
: https://gutte.tistory.com/138
Top-down Parsing์ ๋ํ ์์ธํ!! ์์ด์ค๋ช
: **https://www.tutorialspoint.com/compiler_design/compiler_design_top_down_parser.htm**

left-recursive