计算理论03_CFL.ppt

  1. 1、本文档共38页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
计算理论03_CFL

第三讲课程 用前后文相关(CSL) 的来反衬托CFL直观概念 前后文无关的直观概念 Context-Free Languages (Ch. 2) 前后文无关语言 Context-Free Languages (Ch. 2) 前后文无关语言 Context-Free Grammars (Inf.) 前后文无关文法 与ep92 例类似,但稍简单 Context-Free Grammars (Def.2.1) ep94 Context-Free Grammars (Def.2.1) ep94 Derivation ?* 派生,生成, ep94, cp61 Derivation ?* 派生,生成, ep94, cp61 Some Remarks ep94 cp61 Context-Free Grammars (Ex.) 例c3.2 稍有不同 ep95 , cp61 书上例子自学 Importance of CFL Example Boolean Algebra 补充例 有两个字符,有与、或、非,刚好等价于 布尔代数 Example Boolean Algebra 补充例 有两个字符,有与、或、非,刚好等价于 布尔代数 Human Languages ep93, cp60 Human Languages ep93, cp60 Human Languages ep93, cp60 Parse Trees ep 93,书上无此图,类似于cp62 Ambiguity ep97 cp63 I saw that girl with telescope (人分辨时 要看前后文) Ambiguity and Parse Trees 与ep98 cp63 图稍微不同 思想一致 More on Ambiguity Context-Free Languages Def, ep99, cp60 Context-Free Languages Def, ep99, cp60 Context-Free Languages Def, ep99, cp60 “Chomsky Normal Form” 定义 c3.5 ep99 cp64 “Chomsky Normal Form” 定义 c3.5 ep99 cp64 Theorem c3.6 ep99 cp64 Theorem c3.6 ep99 cp64 Theorem c3.6 ep99 cp64 Proof Theorem c3.6 ep99 CFL ~ Chomsky NF ep99 ,cp64 Proof Theorem c3.6 ep99 CFL ~ Chomsky NF ep99 ,cp64 Careful Removing of Rules 去掉冗余的规则 RL ? CFL 命题 : 正则语言是CFL RL ? CFL 命题 : 正则语言是CFL Example RL ? CFL 边 对应于 规则 Picture Thus Far Any Question ? Given a context-free grammar G = (V,?,R,S), rewrite it to Chomsky Normal Form by 1) New start symbol S0 (and add rule S0?S) 2) Remove A?? rules (from the tail): before: B?xAy and A??, after: B? xAy | xy 3) Remove unit rules A?B (by the head): “A?B” and “B?xCy”, becomes “A?xCy” and “B?xCy” 4) Shorten all rules to two: before: “A?B1B2…Bk”, after: A?B1A1, A1?B2A2,…, Ak-2?Bk-1Bk 一分为多 通过多个 一分为二 实现 5) Replace ill-placed terminals 1-2-3为核心的4作准备 S0?? A?ai A?BC A?aiB A?Bai A?aiaj add a variable Ui and rule Ui?ai,then d’) A?UiB e’) A?Bui f’) A?UiUj Every regular language can be expressed by a context-free grammar. Proof Idea: RL ?DFA?造CFG,

文档评论(0)

dajuhyy + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档