SlideShare a Scribd company logo
제 2 장
형식 언어
컴파일러 입문
목 차
2.1 언어(Language)
2.2 문법(Grammar)
2.3 문법의 분류
Inroduction to FL theory
Page 2
꼭 기억해야 할 세 가지 개념
1. 언어의 정의
2. 문법의 정의 및 개념
3. 인식기의 의미
Language
 Basic definitions
(1) alphabet
 a finite set of symbols.
 ex) T1 = {ㄱ,ㄴ,ㄷ,...,ㅎ,ㅏ,ㅑ, … ,ㅡ,ㅣ}
T2 = {A,B,C, … ,Z, a, b, c, …, z}
T3 = {main, int, char, …, while}
(2) string(or sentence, word)
 a sequence of symbols from some alphabet T.
(3) length
 the number of symbols in the string.
 denoted by |ω|
Inroduction to FL theory
Page 3
(4) empty string
 a string consisting of no symbols.
 denoted by ε or λ.
(5) T*
denotes the set of all strings of symbols over the
alphabet T, including the empty string.
T+
= T*
- {ε}
T*
: T star
T+
: T dagger
(6) Language is any set of strings over an alphabet.(Text p.40)
(or A Language L over the alphabet T is a subset of T*
.)
L ⊆ T*
Inroduction to FL theory
Page 4
 Two problems
(1) How do we represent a language ?
If the language is finite, the answer is easy.
If the language is infinite, we are faced with the problem
of finding a finite representation for the language.
 Set description
 Grammar : Generating Scheme
 Recognizer : Recognition Scheme
(2) Does there exist a finite representation for every language ?
No !
 This is not always possible.
Inroduction to FL theory
Page 5
L1 = {a, ab, ba, aba}
L2 = T* = {, a, b, aa, ab, ….}
L3 = {anbn | n1}
L4 = {wwR | wT*}
 More definitions
(1) concatenation
 u = a1a2a3...an, v = b1b2b3...bm , u • v = a1a2a3...anb1b2b3...bm
 u • v를 보통 uv로 표기.
 uε= u = εu
 ∀u,v ∈ T*
, uv ∈ T*
.
 |uv| = |u| + |v|
(2) an
represents n a's.
a0
= ε
(3) the reversal of a string ω, denoted ωR
is the string ω
written in reverse order:
i.e., if ω = a1a2...an then ωR
= anan-1...a1.
Inroduction to FL theory
Page 6
(ωR)R=ω
(4) language product
LL' = {xy| x ∈ L and y ∈ L'}
(5) The powers of a language L are defined recursively by:
L0
= {ε}
Ln
= LLn-1
for n  1.
(6) L*
: reflexive transitive closure
= L0
∪ L1
∪ L2
∪ ...∪ Ln
∪… =
(7) L+
: transitive closure
= L1
∪ L2
∪... ∪ Ln
∪ ...
= L*
- L0


0i
i
L
Inroduction to FL theory
Page 7
L = {a, ab, ba, aba}
L0 = {}
L2 = {aa, aab, aba, aaba, …}
Grammar
 Language
 문장(sentence)들을 원소로 갖는 집합
 언어를 어떻게 표현할 것인가 ?
 Grammar
 terminal : 정의된 언어의 알파벳
 nonterminal :
 스트링을 생성하는 데 사용되는 중간 과정의 심볼
 언어의 구조를 정의하는데 사용
 grammar symbol (V)
Inroduction to FL theory
Page 8
Inroduction to FL theory
Page 9
 G = (VN, VT, P, S)
 VN : a finite set of nonterminal symbols
 VT : a finite set of terminal symbols
VN ∩ VT =  , VN∪ VT = V
 P : a finite set of production rules
α → β, α∈ V+
, β∈ V*
lhs rhs
 S : start symbol(sentence symbol)
 [예] G = ( {S, A}, {a, b}, P, S ) Text p.47 [예 8]
 P : S → aAS S → a
A → SbA A → ba A → SS
⇒ S → aAS | a
A → SbA | ba | SS
Inroduction to FL theory
Page 10
 Derivation
1. ⇒ : “directly produce” or “directly derive”
if α → β∈ P and  , δ∈ V*
then
 αδ ⇒  βδ
2. ⇒ : Suppose α1,α2,...,αn ∈ V*
and α1 ⇒α2 ⇒… ⇒αn,
then α1 ⇒ αn
(zero or more derivations)
3. ⇒ : one or more derivations.
cf) → : production rule에서 사용.
“may be replaced by”
⇒ : derivation할 때 사용한다.
Inroduction to FL theory
Page 11
*
+
*
Ex. P : S → aA | bB | ε
A → bS
B → aS
S ⇒ abba 유도 과정
Inroduction to FL theory
Page 12
S ⇒ aA (생성규칙 S → aA)
⇒ abS (생성규칙 A → bS)
⇒ abbB (생성규칙 S → bB)
⇒ abbaS (생성규칙 B → aS)
⇒ abba (생성규칙 S → )
 L(G) : Language generated by grammar G
L(G) = {ω | S ⇒ ω, ω ∈ VT
*
}
☞ ω is a sentential form of G if S ⇒ ω and ω ∈ V*
.
ω is a sentence of G if S ⇒ ω and ω ∈ VT
*
.
Inroduction to FL theory
Page 13
*
*
*
S ⇒ aA ( 생성규칙 S → aA를 적용 )
⇒ abS ( 생성규칙 A → bS를 적용 )
⇒ abbB ( 생성규칙 S → bB를 적용 )
⇒ abbaS ( 생성규칙 B → aS를 적용 )
⇒ abba ( 생성규칙 S → 를 적용 )
S ⇒ abba
sentential form : aA, abS, abbB, abbaS, abba
sentence : abba
 G1 = ( {S}, {a}, P, S ) 을 이용하여 L(G1)
P : S → a | aS
L (G1) = { an
| n  1 }
 Language design
Grammar Language
generation
design
Inroduction to FL theory
Page 14
 주어진 문법으로부터 생성되는 언어 발견 과정
 1. start symbol로부터 길이가 짧은 순으로 생성규칙 적용
 2. 생성된 문장들의 형태를 고려하여 일정한 규칙 발견
 G = ( {A, B, C}, {a, b, c}, P, A)
P : A → abc A → aBbc
Bb → bB Bc → Cbcc
bC → Cb aC → aaB
aC → aa
Inroduction to FL theory
Page 15
L(G) = { anbncn | n  1 }
(===>) ex1) S → 0S1 | 01
ex2) S → aSb | c
ex3) A → aB
B → bB | b
ex4) O → a
O → aE
E → aO
ex5) A → abc A → aBbc
Bb → bB Bc → Cbcc
bC → Cb aC → aaB
aC → aa
Inroduction to FL theory
Page 16
 문법 기술 방법
 embedded rule : S → aSb
 right-recursive rule : A → aA
 left-recursive rule : A → Aa
 L = { an
| n  0 } 일 때 문법 : A → aA | ε
 L = { an
| n  1 } 일 때 문법 : A → aA | a
 Embedded production A → aAb
ex1) L1 = { an
bn
| n  0 }
ex2) L2 = { 0i
1j
| i  j, i,j  1 }
ex3) Constructs of Conventional PL
Inroduction to FL theory
Page 17
ex) C 언어의 정수 선언 부분 :
 정수선언 부분은 여러 개의 정수선언으로 구성되며 하나의 선
언은 int a,a,a;와 같은 형태를 갖는다. 여기서 a는 임의의
identifier를 나타낸다.
 그리고 ; 으로 각각의 선언을 구분한다. 예를 들어, int i,j; int sum;
과 같다.
※ 문법을 고안할 때, nonterminal의 이름은 구문 구조를
대변할 수 있는 명칭으로 쓰는 것이 바람직하다.
Inroduction to FL theory
Page 18
 In order to prove that a grammar generates a
language L
i) Every sentence generated by the grammar is in L.
ii) Every string in L can be generated by the grammar.
교과서 55쪽
[예16]
proof) (=>) Every sentence derivable from S is balanced.
(<=) Every balanced string is derivable from S.
Inroduction to FL theory
Page 19
G = ( { S }, { ( , ) }, {S → (S)S |ε}, S )
⇔ All strings of balanced parentheses.
(=>) Every sentence derivable from S is balanced.
(i.e., S ⇒ ω, ω: balanced)
By induction on the number of steps in a derivation.
i) n = 1 일 때, S ⇒ ε, ε is surely balanced.
ii) Suppose that all derivations of fewer than n steps
produce balanced sentences.
iii) Consider a leftmost derivation of exactly n steps.
S ⇒ (S)S ⇒ (x)S ⇒ (x)y
By the hypothesis x, y : balanced.
Thus (x)y balanced.
Inroduction to FL theory
Page 20
*
* *
*
(<=) Every balanced string is derivable from S.
By induction on the length of a string.
i) |ω| = 0, S ⇒ ε
(the empty string is derivable from S.)
ii) Assume that every balanced string of length less than 2n is derived from S.
iii) Consider a balanced string ω of length 2n.
Let (x) : shortest prefix of ω being balanced.
Thus ω = (x)y, where x, y : balanced.
Since |x|, |y | < 2n, they are derivable from S by inductive hypothesis.
Thus S ⇒ (S)S ⇒ (x)S ⇒ (x)y = ω
Therefore, (x)y is also derivable from S.
Inroduction to FL theory
Page 21
* *
Chomsky Hierarchy
 Noam Chomsky
 According to the form of the productions.
α → β ∈ P
 Type 0 : No restrictions(unrestricted grammar)
 Type 1 : Context-sensitive grammar(CSG).
 → β, |  |  | β|
 Type 2 : Context-free grammar(CFG).
A → , where A : nonterminal,  ∈ V*
.
 Type 3 : Regular grammar(RG).
A → tB or A → t, (right-linear)
A → Bt or A → t, (left-linear)
where, A, B : nonterminal, t ∈ VT
*.
Inroduction to FL theory
Page 22
 REL (Recursively Enumerable Language)
CSL (Context Sensitive Language)
CFL (Context Free Language)
RL (Regular Language)
 Examples of Formal Language
 simple matching language : Lm = {an
bn
| n ≥ 0} CFL
 double matching language : Ldm = {an
bn
cn
| n ≥ 0} CSL
 mirror image language : Lmi = {ωωR
| ω ∈ VT
*
} CFL
 palindrome language : Lr = {ω | ω = ωR
} CFL
 parenthesis language : Lp = {ω | ω: balanced parenthesis} CFL
Inroduction to FL theory
Page 23
 The Chomsky Hierarchy of Languages
unrestricted language
context-sensitive language
context-free language
regular language
Inroduction to FL theory
Page 24
 Languages & Recognizers
Grammar Language Recognizer
type 0
(unrestricted)
recursively
enumerable set
Turing
machine
type 1
(context-sensitive)
context-sensitive
language
Linear Bounded
Automata
type 2
(context-free)
context-free
language
Pushdown
Automata
type 3
(regular)
regular
language
Finite Automata
Inroduction to FL theory
Page 25

More Related Content

What's hot

Lec4
Lec4Lec4
2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster
Chelsea Battell
 
Cs419 lec3 lexical analysis using re
Cs419 lec3   lexical analysis using reCs419 lec3   lexical analysis using re
Cs419 lec3 lexical analysis using re
Arab Open University and Cairo University
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
Edhole.com
 
Ch4a
Ch4aCh4a
Cs419 lec7 cfg
Cs419 lec7   cfgCs419 lec7   cfg
Lexical 2
Lexical 2Lexical 2
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's Classification
PrafullMisra
 
Propositional And First-Order Logic
Propositional And First-Order LogicPropositional And First-Order Logic
Propositional And First-Order Logic
ankush_kumar
 
Context free languages
Context free languagesContext free languages
Context free languages
Jahurul Islam
 
Regular Expression (Regex) Fundamentals
Regular Expression (Regex) FundamentalsRegular Expression (Regex) Fundamentals
Regular Expression (Regex) Fundamentals
Mesut Günes
 
Cs419 lec5 lexical analysis using dfa
Cs419 lec5   lexical analysis using dfaCs419 lec5   lexical analysis using dfa
Cs419 lec5 lexical analysis using dfa
Arab Open University and Cairo University
 
3 fol examples v2
3 fol examples v23 fol examples v2
3 fol examples v2
Digvijay Singh
 
A Unified Perspective for Darmon Points
A Unified Perspective for Darmon PointsA Unified Perspective for Darmon Points
A Unified Perspective for Darmon Points
mmasdeu
 
Class7
 Class7 Class7
Class7
issbp
 
Chapter 2 Review
Chapter 2 ReviewChapter 2 Review
Chapter 2 Review
guest056fe2
 
Logic (PROPOSITIONS)
Logic (PROPOSITIONS)Logic (PROPOSITIONS)
Logic (PROPOSITIONS)
D Nayanathara
 
Per3 logika&amp;pembuktian
Per3 logika&amp;pembuktianPer3 logika&amp;pembuktian
Per3 logika&amp;pembuktian
Evert Sandye Taasiringan
 
Theory of Automata and formal languages Unit 3
Theory of Automata and formal languages Unit 3Theory of Automata and formal languages Unit 3
Theory of Automata and formal languages Unit 3
Abhimanyu Mishra
 
Open course(programming languages) 20150211
Open course(programming languages) 20150211Open course(programming languages) 20150211
Open course(programming languages) 20150211
JangChulho
 

What's hot (20)

Lec4
Lec4Lec4
Lec4
 
2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster2015 CMS Winter Meeting Poster
2015 CMS Winter Meeting Poster
 
Cs419 lec3 lexical analysis using re
Cs419 lec3   lexical analysis using reCs419 lec3   lexical analysis using re
Cs419 lec3 lexical analysis using re
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Ch4a
Ch4aCh4a
Ch4a
 
Cs419 lec7 cfg
Cs419 lec7   cfgCs419 lec7   cfg
Cs419 lec7 cfg
 
Lexical 2
Lexical 2Lexical 2
Lexical 2
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's Classification
 
Propositional And First-Order Logic
Propositional And First-Order LogicPropositional And First-Order Logic
Propositional And First-Order Logic
 
Context free languages
Context free languagesContext free languages
Context free languages
 
Regular Expression (Regex) Fundamentals
Regular Expression (Regex) FundamentalsRegular Expression (Regex) Fundamentals
Regular Expression (Regex) Fundamentals
 
Cs419 lec5 lexical analysis using dfa
Cs419 lec5   lexical analysis using dfaCs419 lec5   lexical analysis using dfa
Cs419 lec5 lexical analysis using dfa
 
3 fol examples v2
3 fol examples v23 fol examples v2
3 fol examples v2
 
A Unified Perspective for Darmon Points
A Unified Perspective for Darmon PointsA Unified Perspective for Darmon Points
A Unified Perspective for Darmon Points
 
Class7
 Class7 Class7
Class7
 
Chapter 2 Review
Chapter 2 ReviewChapter 2 Review
Chapter 2 Review
 
Logic (PROPOSITIONS)
Logic (PROPOSITIONS)Logic (PROPOSITIONS)
Logic (PROPOSITIONS)
 
Per3 logika&amp;pembuktian
Per3 logika&amp;pembuktianPer3 logika&amp;pembuktian
Per3 logika&amp;pembuktian
 
Theory of Automata and formal languages Unit 3
Theory of Automata and formal languages Unit 3Theory of Automata and formal languages Unit 3
Theory of Automata and formal languages Unit 3
 
Open course(programming languages) 20150211
Open course(programming languages) 20150211Open course(programming languages) 20150211
Open course(programming languages) 20150211
 

Viewers also liked

01.표준프레임워크개요
01.표준프레임워크개요01.표준프레임워크개요
01.표준프레임워크개요
Hankyo
 
Ch05
Ch05Ch05
Ch05
Hankyo
 
Ch10
Ch10Ch10
Ch10
Hankyo
 
03.[참고]표준프레임워크기반 개발방법
03.[참고]표준프레임워크기반 개발방법03.[참고]표준프레임워크기반 개발방법
03.[참고]표준프레임워크기반 개발방법
Hankyo
 
Ch09
Ch09Ch09
Ch09
Hankyo
 
Ch08
Ch08Ch08
Ch08
Hankyo
 
컴파일러 Ch01
컴파일러 Ch01컴파일러 Ch01
컴파일러 Ch01
Hankyo
 
Ch11
Ch11Ch11
Ch11
Hankyo
 
01.모바일 프레임워크 이론
01.모바일 프레임워크 이론01.모바일 프레임워크 이론
01.모바일 프레임워크 이론
Hankyo
 
Ch07
Ch07Ch07
Ch07
Hankyo
 
04.모바일 device api_실습교재
04.모바일 device api_실습교재04.모바일 device api_실습교재
04.모바일 device api_실습교재
Hankyo
 
01.공통컴포넌트 교육교재
01.공통컴포넌트 교육교재01.공통컴포넌트 교육교재
01.공통컴포넌트 교육교재
Hankyo
 
01.개발환경 교육교재
01.개발환경 교육교재01.개발환경 교육교재
01.개발환경 교육교재
Hankyo
 
02.모바일 실습교재(ux component)
02.모바일 실습교재(ux component)02.모바일 실습교재(ux component)
02.모바일 실습교재(ux component)
Hankyo
 
Gov3.0 자료집 제1회_스마트_전자정부_추진계획
Gov3.0 자료집 제1회_스마트_전자정부_추진계획Gov3.0 자료집 제1회_스마트_전자정부_추진계획
Gov3.0 자료집 제1회_스마트_전자정부_추진계획Gori Communication
 
[웹기반시스템 3조]e govframe
[웹기반시스템 3조]e govframe[웹기반시스템 3조]e govframe
[웹기반시스템 3조]e govframe
구 봉
 
오픈소스의 이해
오픈소스의 이해오픈소스의 이해
오픈소스의 이해
Kenu, GwangNam Heo
 
GFW-official-list-cashed in Google
GFW-official-list-cashed in GoogleGFW-official-list-cashed in Google
GFW-official-list-cashed in Google
Akkad
 
전자정부표준프레임워크=오픈소스+Alpha
전자정부표준프레임워크=오픈소스+Alpha전자정부표준프레임워크=오픈소스+Alpha
전자정부표준프레임워크=오픈소스+Alpha
Kenu, GwangNam Heo
 
2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안
2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안
2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안
Suji Lee
 

Viewers also liked (20)

01.표준프레임워크개요
01.표준프레임워크개요01.표준프레임워크개요
01.표준프레임워크개요
 
Ch05
Ch05Ch05
Ch05
 
Ch10
Ch10Ch10
Ch10
 
03.[참고]표준프레임워크기반 개발방법
03.[참고]표준프레임워크기반 개발방법03.[참고]표준프레임워크기반 개발방법
03.[참고]표준프레임워크기반 개발방법
 
Ch09
Ch09Ch09
Ch09
 
Ch08
Ch08Ch08
Ch08
 
컴파일러 Ch01
컴파일러 Ch01컴파일러 Ch01
컴파일러 Ch01
 
Ch11
Ch11Ch11
Ch11
 
01.모바일 프레임워크 이론
01.모바일 프레임워크 이론01.모바일 프레임워크 이론
01.모바일 프레임워크 이론
 
Ch07
Ch07Ch07
Ch07
 
04.모바일 device api_실습교재
04.모바일 device api_실습교재04.모바일 device api_실습교재
04.모바일 device api_실습교재
 
01.공통컴포넌트 교육교재
01.공통컴포넌트 교육교재01.공통컴포넌트 교육교재
01.공통컴포넌트 교육교재
 
01.개발환경 교육교재
01.개발환경 교육교재01.개발환경 교육교재
01.개발환경 교육교재
 
02.모바일 실습교재(ux component)
02.모바일 실습교재(ux component)02.모바일 실습교재(ux component)
02.모바일 실습교재(ux component)
 
Gov3.0 자료집 제1회_스마트_전자정부_추진계획
Gov3.0 자료집 제1회_스마트_전자정부_추진계획Gov3.0 자료집 제1회_스마트_전자정부_추진계획
Gov3.0 자료집 제1회_스마트_전자정부_추진계획
 
[웹기반시스템 3조]e govframe
[웹기반시스템 3조]e govframe[웹기반시스템 3조]e govframe
[웹기반시스템 3조]e govframe
 
오픈소스의 이해
오픈소스의 이해오픈소스의 이해
오픈소스의 이해
 
GFW-official-list-cashed in Google
GFW-official-list-cashed in GoogleGFW-official-list-cashed in Google
GFW-official-list-cashed in Google
 
전자정부표준프레임워크=오픈소스+Alpha
전자정부표준프레임워크=오픈소스+Alpha전자정부표준프레임워크=오픈소스+Alpha
전자정부표준프레임워크=오픈소스+Alpha
 
2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안
2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안
2015 SINVAS USER CONFERENCE - MDD/MDA 개발방법론을 통한 정보시스템 개발방안
 

Similar to Ch02

Open course(programming languages) 20150211
Open course(programming languages) 20150211Open course(programming languages) 20150211
Open course(programming languages) 20150211
codin9cafe
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
dawod yimer
 
Lex analysis
Lex analysisLex analysis
Lex analysis
Suhit Kulkarni
 
context free grammars automata therory and compiler design
context free grammars automata therory and compiler designcontext free grammars automata therory and compiler design
context free grammars automata therory and compiler design
sunitachalageri1
 
Automata
AutomataAutomata
Automata
Gaditek
 
Automata
AutomataAutomata
Automata
Gaditek
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
RaviAr5
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 02
8threspecter
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
ElakkiyaS11
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
Radhakrishnan Chinnusamy
 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptx
RaviAr5
 
Hw2 2017-spring
Hw2 2017-springHw2 2017-spring
Hw2 2017-spring
奕安 陳
 
draft
draftdraft
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
hamzamughal39
 
Aho corasick-lecture
Aho corasick-lectureAho corasick-lecture
Aho corasick-lecture
PekkaKilpelinen2
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machines
Vlad Patryshev
 
Ch2 automata.pptx
Ch2 automata.pptxCh2 automata.pptx
Ch2 automata.pptx
TemesgenAzezew
 
Class1
 Class1 Class1
Class1
issbp
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
Farooq Mian
 
The Chase in Database Theory
The Chase in Database TheoryThe Chase in Database Theory
The Chase in Database Theory
Jan Hidders
 

Similar to Ch02 (20)

Open course(programming languages) 20150211
Open course(programming languages) 20150211Open course(programming languages) 20150211
Open course(programming languages) 20150211
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
Lex analysis
Lex analysisLex analysis
Lex analysis
 
context free grammars automata therory and compiler design
context free grammars automata therory and compiler designcontext free grammars automata therory and compiler design
context free grammars automata therory and compiler design
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
theory of computation lecture 02
theory of computation lecture 02theory of computation lecture 02
theory of computation lecture 02
 
language , grammar and automata
language , grammar and automatalanguage , grammar and automata
language , grammar and automata
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptx
 
Hw2 2017-spring
Hw2 2017-springHw2 2017-spring
Hw2 2017-spring
 
draft
draftdraft
draft
 
Theory of Automata Lesson 01
 Theory of Automata Lesson 01  Theory of Automata Lesson 01
Theory of Automata Lesson 01
 
Aho corasick-lecture
Aho corasick-lectureAho corasick-lecture
Aho corasick-lecture
 
Formal methods 2 - languages and machines
Formal methods   2 - languages and machinesFormal methods   2 - languages and machines
Formal methods 2 - languages and machines
 
Ch2 automata.pptx
Ch2 automata.pptxCh2 automata.pptx
Ch2 automata.pptx
 
Class1
 Class1 Class1
Class1
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
The Chase in Database Theory
The Chase in Database TheoryThe Chase in Database Theory
The Chase in Database Theory
 

More from Hankyo

01.실행환경 실습교재(공통기반)
01.실행환경 실습교재(공통기반)01.실행환경 실습교재(공통기반)
01.실행환경 실습교재(공통기반)
Hankyo
 
07.실행환경 교육교재(표준프레임워크 세부 적용기준)
07.실행환경 교육교재(표준프레임워크 세부 적용기준)07.실행환경 교육교재(표준프레임워크 세부 적용기준)
07.실행환경 교육교재(표준프레임워크 세부 적용기준)
Hankyo
 
06.실행환경 실습교재(easy company,해답)
06.실행환경 실습교재(easy company,해답)06.실행환경 실습교재(easy company,해답)
06.실행환경 실습교재(easy company,해답)
Hankyo
 
06.실행환경 실습교재(easy company,문제)
06.실행환경 실습교재(easy company,문제)06.실행환경 실습교재(easy company,문제)
06.실행환경 실습교재(easy company,문제)
Hankyo
 
05.실행환경 교육교재(업무처리,연계통합)
05.실행환경 교육교재(업무처리,연계통합)05.실행환경 교육교재(업무처리,연계통합)
05.실행환경 교육교재(업무처리,연계통합)
Hankyo
 
04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)
Hankyo
 
04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)
Hankyo
 
04.[참고]개발환경 실습교재
04.[참고]개발환경 실습교재04.[참고]개발환경 실습교재
04.[참고]개발환경 실습교재
Hankyo
 
03.실행환경 실습교재(배치처리)
03.실행환경 실습교재(배치처리)03.실행환경 실습교재(배치처리)
03.실행환경 실습교재(배치처리)
Hankyo
 
03.실행환경 교육교재(배치처리)
03.실행환경 교육교재(배치처리)03.실행환경 교육교재(배치처리)
03.실행환경 교육교재(배치처리)
Hankyo
 
03.모바일 실습교재(모바일 공통컴포넌트 실습)
03.모바일 실습교재(모바일 공통컴포넌트 실습)03.모바일 실습교재(모바일 공통컴포넌트 실습)
03.모바일 실습교재(모바일 공통컴포넌트 실습)
Hankyo
 
03.[참고]개발환경 교육교재
03.[참고]개발환경 교육교재03.[참고]개발환경 교육교재
03.[참고]개발환경 교육교재
Hankyo
 
02.실행환경 실습교재(데이터처리)
02.실행환경 실습교재(데이터처리)02.실행환경 실습교재(데이터처리)
02.실행환경 실습교재(데이터처리)
Hankyo
 
02.실행환경 교육교재(데이터처리)
02.실행환경 교육교재(데이터처리)02.실행환경 교육교재(데이터처리)
02.실행환경 교육교재(데이터처리)
Hankyo
 
02.개발환경 실습교재
02.개발환경 실습교재02.개발환경 실습교재
02.개발환경 실습교재
Hankyo
 
02.[참고]오픈소스sw라이선스가이드라인
02.[참고]오픈소스sw라이선스가이드라인02.[참고]오픈소스sw라이선스가이드라인
02.[참고]오픈소스sw라이선스가이드라인
Hankyo
 
02.공통컴포넌트 실습교재
02.공통컴포넌트 실습교재02.공통컴포넌트 실습교재
02.공통컴포넌트 실습교재
Hankyo
 

More from Hankyo (17)

01.실행환경 실습교재(공통기반)
01.실행환경 실습교재(공통기반)01.실행환경 실습교재(공통기반)
01.실행환경 실습교재(공통기반)
 
07.실행환경 교육교재(표준프레임워크 세부 적용기준)
07.실행환경 교육교재(표준프레임워크 세부 적용기준)07.실행환경 교육교재(표준프레임워크 세부 적용기준)
07.실행환경 교육교재(표준프레임워크 세부 적용기준)
 
06.실행환경 실습교재(easy company,해답)
06.실행환경 실습교재(easy company,해답)06.실행환경 실습교재(easy company,해답)
06.실행환경 실습교재(easy company,해답)
 
06.실행환경 실습교재(easy company,문제)
06.실행환경 실습교재(easy company,문제)06.실행환경 실습교재(easy company,문제)
06.실행환경 실습교재(easy company,문제)
 
05.실행환경 교육교재(업무처리,연계통합)
05.실행환경 교육교재(업무처리,연계통합)05.실행환경 교육교재(업무처리,연계통합)
05.실행환경 교육교재(업무처리,연계통합)
 
04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)04.실행환경 실습교재(화면처리)
04.실행환경 실습교재(화면처리)
 
04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)04.실행환경 교육교재(화면처리)
04.실행환경 교육교재(화면처리)
 
04.[참고]개발환경 실습교재
04.[참고]개발환경 실습교재04.[참고]개발환경 실습교재
04.[참고]개발환경 실습교재
 
03.실행환경 실습교재(배치처리)
03.실행환경 실습교재(배치처리)03.실행환경 실습교재(배치처리)
03.실행환경 실습교재(배치처리)
 
03.실행환경 교육교재(배치처리)
03.실행환경 교육교재(배치처리)03.실행환경 교육교재(배치처리)
03.실행환경 교육교재(배치처리)
 
03.모바일 실습교재(모바일 공통컴포넌트 실습)
03.모바일 실습교재(모바일 공통컴포넌트 실습)03.모바일 실습교재(모바일 공통컴포넌트 실습)
03.모바일 실습교재(모바일 공통컴포넌트 실습)
 
03.[참고]개발환경 교육교재
03.[참고]개발환경 교육교재03.[참고]개발환경 교육교재
03.[참고]개발환경 교육교재
 
02.실행환경 실습교재(데이터처리)
02.실행환경 실습교재(데이터처리)02.실행환경 실습교재(데이터처리)
02.실행환경 실습교재(데이터처리)
 
02.실행환경 교육교재(데이터처리)
02.실행환경 교육교재(데이터처리)02.실행환경 교육교재(데이터처리)
02.실행환경 교육교재(데이터처리)
 
02.개발환경 실습교재
02.개발환경 실습교재02.개발환경 실습교재
02.개발환경 실습교재
 
02.[참고]오픈소스sw라이선스가이드라인
02.[참고]오픈소스sw라이선스가이드라인02.[참고]오픈소스sw라이선스가이드라인
02.[참고]오픈소스sw라이선스가이드라인
 
02.공통컴포넌트 실습교재
02.공통컴포넌트 실습교재02.공통컴포넌트 실습교재
02.공통컴포넌트 실습교재
 

Recently uploaded

一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
nguqayx
 
LinkedIn for Your Job Search June 17, 2024
LinkedIn for Your Job Search June  17, 2024LinkedIn for Your Job Search June  17, 2024
LinkedIn for Your Job Search June 17, 2024
Bruce Bennett
 
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
ahmedendrise81
 
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
aweuwyo
 
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
ahmedendrise81
 
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
evnum
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
cahgading001
 
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
lemike859
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
Bruce Bennett
 
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
cenaws
 
Khushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks FoundationKhushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks Foundation
khushisaini0924
 
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
gnokue
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
Bruce Bennett
 
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
yhkox
 
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
balliuvilla512
 
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Hector Del Castillo, CPM, CPMM
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
SocMediaFin - Joyce Sullivan
 
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
1wful2fm
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
GabrielleSinaga
 
按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理
按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理
按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理
evnum
 

Recently uploaded (20)

一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
一比一原版(EUR毕业证)鹿特丹伊拉斯姆斯大学毕业证如何办理
 
LinkedIn for Your Job Search June 17, 2024
LinkedIn for Your Job Search June  17, 2024LinkedIn for Your Job Search June  17, 2024
LinkedIn for Your Job Search June 17, 2024
 
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
美洲杯买球-美洲杯买球下注平台-美洲杯买球投注平台|【​网址​🎉ac55.net🎉​】
 
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
一比一原版(uwm毕业证书)美国威斯康星大学密尔沃基分校毕业证如何办理
 
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
欧洲杯买球-欧洲杯买球买球推荐-欧洲杯买球买球推荐网站|【​网址​🎉ac10.net🎉​】
 
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
 
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
欧洲杯足彩-欧洲杯足彩体育投注-欧洲杯足彩投注网站|【​网址​🎉ac99.net🎉​】
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
 
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
一比一原版坎特伯雷大学毕业证(UC毕业证书)学历如何办理
 
Khushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks FoundationKhushi Saini, An Intern from The Sparks Foundation
Khushi Saini, An Intern from The Sparks Foundation
 
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
一比一原版(surrey毕业证书)英国萨里大学毕业证成绩单修改如何办理
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
 
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
 
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
美洲杯投注-美洲杯投注比分-美洲杯投注比分投注|【​网址​🎉ac44.net🎉​】
 
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
 
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
 
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
Gabrielle M. A. Sinaga Portfolio, Film Student (2024)
 
按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理
按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理
按照学校原版(ArtEZ文凭证书)ArtEZ艺术学院毕业证快速办理
 

Ch02

  • 1. 제 2 장 형식 언어 컴파일러 입문
  • 2. 목 차 2.1 언어(Language) 2.2 문법(Grammar) 2.3 문법의 분류 Inroduction to FL theory Page 2 꼭 기억해야 할 세 가지 개념 1. 언어의 정의 2. 문법의 정의 및 개념 3. 인식기의 의미
  • 3. Language  Basic definitions (1) alphabet  a finite set of symbols.  ex) T1 = {ㄱ,ㄴ,ㄷ,...,ㅎ,ㅏ,ㅑ, … ,ㅡ,ㅣ} T2 = {A,B,C, … ,Z, a, b, c, …, z} T3 = {main, int, char, …, while} (2) string(or sentence, word)  a sequence of symbols from some alphabet T. (3) length  the number of symbols in the string.  denoted by |ω| Inroduction to FL theory Page 3
  • 4. (4) empty string  a string consisting of no symbols.  denoted by ε or λ. (5) T* denotes the set of all strings of symbols over the alphabet T, including the empty string. T+ = T* - {ε} T* : T star T+ : T dagger (6) Language is any set of strings over an alphabet.(Text p.40) (or A Language L over the alphabet T is a subset of T* .) L ⊆ T* Inroduction to FL theory Page 4
  • 5.  Two problems (1) How do we represent a language ? If the language is finite, the answer is easy. If the language is infinite, we are faced with the problem of finding a finite representation for the language.  Set description  Grammar : Generating Scheme  Recognizer : Recognition Scheme (2) Does there exist a finite representation for every language ? No !  This is not always possible. Inroduction to FL theory Page 5 L1 = {a, ab, ba, aba} L2 = T* = {, a, b, aa, ab, ….} L3 = {anbn | n1} L4 = {wwR | wT*}
  • 6.  More definitions (1) concatenation  u = a1a2a3...an, v = b1b2b3...bm , u • v = a1a2a3...anb1b2b3...bm  u • v를 보통 uv로 표기.  uε= u = εu  ∀u,v ∈ T* , uv ∈ T* .  |uv| = |u| + |v| (2) an represents n a's. a0 = ε (3) the reversal of a string ω, denoted ωR is the string ω written in reverse order: i.e., if ω = a1a2...an then ωR = anan-1...a1. Inroduction to FL theory Page 6 (ωR)R=ω
  • 7. (4) language product LL' = {xy| x ∈ L and y ∈ L'} (5) The powers of a language L are defined recursively by: L0 = {ε} Ln = LLn-1 for n  1. (6) L* : reflexive transitive closure = L0 ∪ L1 ∪ L2 ∪ ...∪ Ln ∪… = (7) L+ : transitive closure = L1 ∪ L2 ∪... ∪ Ln ∪ ... = L* - L0   0i i L Inroduction to FL theory Page 7 L = {a, ab, ba, aba} L0 = {} L2 = {aa, aab, aba, aaba, …}
  • 8. Grammar  Language  문장(sentence)들을 원소로 갖는 집합  언어를 어떻게 표현할 것인가 ?  Grammar  terminal : 정의된 언어의 알파벳  nonterminal :  스트링을 생성하는 데 사용되는 중간 과정의 심볼  언어의 구조를 정의하는데 사용  grammar symbol (V) Inroduction to FL theory Page 8
  • 9. Inroduction to FL theory Page 9  G = (VN, VT, P, S)  VN : a finite set of nonterminal symbols  VT : a finite set of terminal symbols VN ∩ VT =  , VN∪ VT = V  P : a finite set of production rules α → β, α∈ V+ , β∈ V* lhs rhs  S : start symbol(sentence symbol)
  • 10.  [예] G = ( {S, A}, {a, b}, P, S ) Text p.47 [예 8]  P : S → aAS S → a A → SbA A → ba A → SS ⇒ S → aAS | a A → SbA | ba | SS Inroduction to FL theory Page 10
  • 11.  Derivation 1. ⇒ : “directly produce” or “directly derive” if α → β∈ P and  , δ∈ V* then  αδ ⇒  βδ 2. ⇒ : Suppose α1,α2,...,αn ∈ V* and α1 ⇒α2 ⇒… ⇒αn, then α1 ⇒ αn (zero or more derivations) 3. ⇒ : one or more derivations. cf) → : production rule에서 사용. “may be replaced by” ⇒ : derivation할 때 사용한다. Inroduction to FL theory Page 11 * + *
  • 12. Ex. P : S → aA | bB | ε A → bS B → aS S ⇒ abba 유도 과정 Inroduction to FL theory Page 12 S ⇒ aA (생성규칙 S → aA) ⇒ abS (생성규칙 A → bS) ⇒ abbB (생성규칙 S → bB) ⇒ abbaS (생성규칙 B → aS) ⇒ abba (생성규칙 S → )
  • 13.  L(G) : Language generated by grammar G L(G) = {ω | S ⇒ ω, ω ∈ VT * } ☞ ω is a sentential form of G if S ⇒ ω and ω ∈ V* . ω is a sentence of G if S ⇒ ω and ω ∈ VT * . Inroduction to FL theory Page 13 * * * S ⇒ aA ( 생성규칙 S → aA를 적용 ) ⇒ abS ( 생성규칙 A → bS를 적용 ) ⇒ abbB ( 생성규칙 S → bB를 적용 ) ⇒ abbaS ( 생성규칙 B → aS를 적용 ) ⇒ abba ( 생성규칙 S → 를 적용 ) S ⇒ abba sentential form : aA, abS, abbB, abbaS, abba sentence : abba
  • 14.  G1 = ( {S}, {a}, P, S ) 을 이용하여 L(G1) P : S → a | aS L (G1) = { an | n  1 }  Language design Grammar Language generation design Inroduction to FL theory Page 14
  • 15.  주어진 문법으로부터 생성되는 언어 발견 과정  1. start symbol로부터 길이가 짧은 순으로 생성규칙 적용  2. 생성된 문장들의 형태를 고려하여 일정한 규칙 발견  G = ( {A, B, C}, {a, b, c}, P, A) P : A → abc A → aBbc Bb → bB Bc → Cbcc bC → Cb aC → aaB aC → aa Inroduction to FL theory Page 15 L(G) = { anbncn | n  1 }
  • 16. (===>) ex1) S → 0S1 | 01 ex2) S → aSb | c ex3) A → aB B → bB | b ex4) O → a O → aE E → aO ex5) A → abc A → aBbc Bb → bB Bc → Cbcc bC → Cb aC → aaB aC → aa Inroduction to FL theory Page 16
  • 17.  문법 기술 방법  embedded rule : S → aSb  right-recursive rule : A → aA  left-recursive rule : A → Aa  L = { an | n  0 } 일 때 문법 : A → aA | ε  L = { an | n  1 } 일 때 문법 : A → aA | a  Embedded production A → aAb ex1) L1 = { an bn | n  0 } ex2) L2 = { 0i 1j | i  j, i,j  1 } ex3) Constructs of Conventional PL Inroduction to FL theory Page 17
  • 18. ex) C 언어의 정수 선언 부분 :  정수선언 부분은 여러 개의 정수선언으로 구성되며 하나의 선 언은 int a,a,a;와 같은 형태를 갖는다. 여기서 a는 임의의 identifier를 나타낸다.  그리고 ; 으로 각각의 선언을 구분한다. 예를 들어, int i,j; int sum; 과 같다. ※ 문법을 고안할 때, nonterminal의 이름은 구문 구조를 대변할 수 있는 명칭으로 쓰는 것이 바람직하다. Inroduction to FL theory Page 18
  • 19.  In order to prove that a grammar generates a language L i) Every sentence generated by the grammar is in L. ii) Every string in L can be generated by the grammar. 교과서 55쪽 [예16] proof) (=>) Every sentence derivable from S is balanced. (<=) Every balanced string is derivable from S. Inroduction to FL theory Page 19 G = ( { S }, { ( , ) }, {S → (S)S |ε}, S ) ⇔ All strings of balanced parentheses.
  • 20. (=>) Every sentence derivable from S is balanced. (i.e., S ⇒ ω, ω: balanced) By induction on the number of steps in a derivation. i) n = 1 일 때, S ⇒ ε, ε is surely balanced. ii) Suppose that all derivations of fewer than n steps produce balanced sentences. iii) Consider a leftmost derivation of exactly n steps. S ⇒ (S)S ⇒ (x)S ⇒ (x)y By the hypothesis x, y : balanced. Thus (x)y balanced. Inroduction to FL theory Page 20 * * * *
  • 21. (<=) Every balanced string is derivable from S. By induction on the length of a string. i) |ω| = 0, S ⇒ ε (the empty string is derivable from S.) ii) Assume that every balanced string of length less than 2n is derived from S. iii) Consider a balanced string ω of length 2n. Let (x) : shortest prefix of ω being balanced. Thus ω = (x)y, where x, y : balanced. Since |x|, |y | < 2n, they are derivable from S by inductive hypothesis. Thus S ⇒ (S)S ⇒ (x)S ⇒ (x)y = ω Therefore, (x)y is also derivable from S. Inroduction to FL theory Page 21 * *
  • 22. Chomsky Hierarchy  Noam Chomsky  According to the form of the productions. α → β ∈ P  Type 0 : No restrictions(unrestricted grammar)  Type 1 : Context-sensitive grammar(CSG).  → β, |  |  | β|  Type 2 : Context-free grammar(CFG). A → , where A : nonterminal,  ∈ V* .  Type 3 : Regular grammar(RG). A → tB or A → t, (right-linear) A → Bt or A → t, (left-linear) where, A, B : nonterminal, t ∈ VT *. Inroduction to FL theory Page 22
  • 23.  REL (Recursively Enumerable Language) CSL (Context Sensitive Language) CFL (Context Free Language) RL (Regular Language)  Examples of Formal Language  simple matching language : Lm = {an bn | n ≥ 0} CFL  double matching language : Ldm = {an bn cn | n ≥ 0} CSL  mirror image language : Lmi = {ωωR | ω ∈ VT * } CFL  palindrome language : Lr = {ω | ω = ωR } CFL  parenthesis language : Lp = {ω | ω: balanced parenthesis} CFL Inroduction to FL theory Page 23
  • 24.  The Chomsky Hierarchy of Languages unrestricted language context-sensitive language context-free language regular language Inroduction to FL theory Page 24
  • 25.  Languages & Recognizers Grammar Language Recognizer type 0 (unrestricted) recursively enumerable set Turing machine type 1 (context-sensitive) context-sensitive language Linear Bounded Automata type 2 (context-free) context-free language Pushdown Automata type 3 (regular) regular language Finite Automata Inroduction to FL theory Page 25