- 9
- 0
- 约1.77万字
- 约 43页
- 2018-11-06 发布于广西
- 举报
Chapter 2 Language Syntax Description Section 3 Grammar construction and simplification3、Construct a context-free grammar without ?-production b、The algorithm to construct a context-free grammar without ?-production: (2)Construct the P’ set of productions of G’ as following steps: (A)If an symbol in V0 appears in the right-side of a production, change the production into two productions:substitute the symbol in ? and itself in the production respectively;put the new productions into P’ ( B)Otherwise, put the productions relating to the symbol into P’ except for ?-production relating to the symbol ( C)If there exists the production of the form S? ? in P, change the production into S’? ? | S and put them into P’,let S’ be the Start Symbol of G’,let V’N=VN?{S’ }, Example:Let G1=({S},{a,b},P,S),where P: (0) S ? ? (1) S ?aSbS (2) S ?bSaS (1)V0={S} (2)P’ (1) S?abS|aSbS|aSb|ab (2) S?baS|bSaS|bSa|ba (0) S’ ? ? | S So:G1’=({S’,S},{a,b},P’,S’),where P’: (0) S’ ? ? | S (1) S ?abS|aSbS|aSb|ab (2) S ?baS|bSaS|bSa|ba Chapter 2 Language Syntax Description Section 4 Syntax tree and ambiguity of a grammar1、Syntax tree a、Definition A tree used to express the structure of a sentence in a language b、Function Present the syntax analysis process visually and directly Used to decide the ambiguity of a grammar easily S a B a B B b S b A a b An example to syntax tree Chapter 2 Language Syntax Description Section 4 Syntax tree and ambiguity of a grammar1、Syntax tree c、Basic terms in a syntax tree (1) Sub-tree A tree composed of a node (except for leaf) and all its descendent nodes in a syntax tree (2) Pruning sub-tree Prune all the children of the root of a sub-tree (3) Sentential form Sequences of all leafs appearing in a snap-shot of the growing syntax tree Chapter 2 Language Syntax Description
您可能关注的文档
- 电子科技大学离散数学课程组国家精品课程(精品·公开课件).ppt
- 电子技术基础与技能 (1)(精品·公开课件).ppt
- 电子科技大学网络编程课件第十讲——服务器并发性的统(精品·公开课件).ppt
- 电子科技大学网络编程课件第五讲——客户软件设计中的(精品·公开课件).ppt
- 电子科技对我们日常生活的影响(精品·公开课件).ppt
- 电子科大电子技术应用实验总复习(精品·公开课件).ppt
- 电子垃圾(精品·公开课件).ppt
- 电子课件第五章演示文稿处理软件PowerPoint2003(精品·公开课件).ppt
- 电子类课程(精品·公开课件).ppt
- 电子类专业英语电子教案第三课(精品·公开课件).ppt
原创力文档

文档评论(0)