Chapte 6 Pushdown Automata.ppt

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
6.2 The language of the PDA Example: PDAs can accept languages that are not regular. The following one accepts: L={0i1j | 0 ≤ i ≤ j} Example A PDA for the language of balanced parentheses: (s,001111,Z0) |- (s, 01111, XZ0) |- (s, 1111, XXZ0) |- (p, 111, XZ0) |- (p, 11, Z0) |- (q, 11, Z0) |- (q, 1, Z0) |- (q,ε, Z0) 6.2 The language of the PDA the automaton M will have five transitions, all from q to q: δ(q, ε,S) = (q, SS) S → SS δ(q, ε,S) = (q, (S) ) S → (S) δ(q, ε,S) = (q, ε ) S → ε δ(q, (, ( ) = (q, ε) δ(q, ), ) ) = (q, ε) Now compare the leftmost derivation S ?? SS ? (S)S ? ((S))S ? (())S ? (())(S) ? (())() with the Ms execution on the same string given as input: 2. From PDA’s to Grammars S →[q0Zq0] By ?(q0, 0, Z)={(q0, ZA)}, we have:[q0Zq0] →0[q0Zq0][q0Aq0] By ?(q0, 1, Z)={(q0, ZB)}, we have:[q0Zq0] →1[q0Zq0][q0Bq0] By ?(q0, 2, Z)={(q0, ε)}, we have:[q0Zq0] →2 By ?(q0, 0, A)={(q0, ε)}, we have:[q0Aq0] →0 By ?(q0, 1, B)={(q0, ε)}, we have:[q0Zq0] →1 . if ?= Y1Y2...Yk, we have [qXrk]→a[pY1r1][r1Y2r2]…[rk-1Ykrk] . If ? = Y1Y2, we have [qXr2] → a[pY1r1][r1Y2r2], for every r1 and r2. If (p, ??)??(q, a, X), then there is one or more corresponding productions, depending on complexity of ?. . If ? = ε, we have [qXp] → a . If ? = Y, we have [qXr] → a[pYr] for every r 豫郁判趋呀呵鄙组懂晃耳绢笨燕诊艳吮镇桃驼傣烘就付祥乾痛氟帅汛琐注Chapter 6 Pushdown AutomataChapter 6 Pushdown Automata Example: Let P = ({p; q}, {0, 1}, {X, Z0}, ?, q, Z0), where ? is given by 1. ?(q, 1, Z0) = {(q, XZ0)} 2. ?(q, 1, X) = {(q, XX)} 3. ?(q, 0, X) = {(p, X)} 4. ?(q, ε, X) = {(q, ε)} 5. ?(p, 1, X) = {(p, ε)} 6. ?(p, 0, Z0) = {(q, Z0)} to a CFG. We get G = (V, {0; 1}, R, S), where V = {[qXp]; [pXq]; [qZ0p]; [pZ0q]; S} and the productions in R are S → [qZ0q] | [qZ0p] From function (1): [qZ0q] → 1[qXq][qZ0q] [qZ0q] → 1[qXp][pZ0q] [qZ0p] → 1[qXq][qZ0p] [qZ0p] → 1[qXp][pZ0p] From function (2): [qXq] → 1[qXq][qXq] [qXq]

文档评论(0)

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

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

1亿VIP精品文档

相关文档