Lecture 11 ContextFree Grammar讲座11上下文无关文法.pptVIP

  • 2
  • 0
  • 约3.21千字
  • 约 17页
  • 2017-03-07 发布于上海
  • 举报

Lecture 11 ContextFree Grammar讲座11上下文无关文法.ppt

Lecture 11 ContextFree Grammar讲座11上下文无关文法

Lecture 11 Context-Free Grammar Definition A context-free grammar (CFG) G is a quadruple (V, Σ, R, S) where V: a set of non-terminal symbols Σ: a set of terminals (V ∩ Σ = ?) R: a set of rules (R: V → (V U Σ)*) S: a start symbol. Example V = {q, f,} Σ = {0, 1} R = {q → 11q, q → 00f, f → 11f, f → ε } S = q (R= {q → 11q | 00f, f → 11f | ε }) How do we use rules? If A → B, then xAy xBy and we say that xAy derivates xBy. If s ··· t, then we write s * t. A string x in Σ* is generated by G=(V,Σ,R,S) if S * x. L(G) = { x in Σ* | S * x}. Example G = ({S},

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档