1 / 5

Grammar

Grammar. G = (V N , V T , P, S) V N : Nonterminal symbols V T : Terminal symbols V N  V T =  , V N ∪ V T = V P : a finite set of production rules α  β, α∈ V + , β∈ V * S : start symbol(sentence symbol). Chomsky Hierarchy. 생성 규칙 α -> β ∈ P 의 종류에 따라

odell
Télécharger la présentation

Grammar

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Grammar • G = (VN, VT, P, S) • VN : Nonterminal symbols • VT : Terminal symbols • VN VT =  , VN∪ VT = V • P : a finite set of production rules • α  β, α∈ V+, β∈ V* • S : start symbol(sentence symbol)

  2. Chomsky Hierarchy • 생성 규칙 α -> β ∈ P의 종류에 따라 • Type 0 : No restrictions(unrestricted grammar) • Type 1 : Context-sensitive grammar(CSG).  -> β, |  |  | β| • Type 2 : Context-free grammar(CFG). A -> , where A ∈ VN S,  ∈ V* • Type 3 : Regular grammar(RG). A -> tB or A -> t, (right-linear) A -> Bt or A -> t, (left-linear) where, A, B ∈ VNS, t ∈ VT*

  3. Examples • Type 3 : Regular grammar • G1=({S}, {a, b}, P, S) • P: S  aS, S  Sb, S  a, S  b, S   • 정규식: a*b* • 언어 L(G1) = {anbm| n0, m0} • “aab”의 유도 과정: S  aS (by S  aS)  aaS (by S  aS)  aab (by S  b)

  4. Examples • Type 2 : Context Free Grammar • G2=({S}, {a, b}, P, S) • P: S  aSb, S  ab • 정규식: anbn • 언어 L(G2) = {anbn| n1} • “aaabbb”의 유도 과정: S  aSb (by S  aSb)  aaSbb (by S  aSb)  aaabbb (by S  ab)

  5. Examples • Type 1 : Context Sensitive Grammar • G3=({S,A,C}, {a, b}, P, S) • P: S  A, A  abC, bB  bb, A  aABC, CB  BC, bC  bb • 정규식: anbn • 언어 L(G3) = {anbn| n1}

More Related