- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
第4章文法和语言解析
[本章小结] 考察本章知识点最典型的题目是 1.已知文法G[A],写出它定义的语言描述 如:G[A]: A → 0B|1C B → 1|1A|0BB C → 0|0A|1CC 答案:G[A]定义的语言由0、1符号串组成,串中0和1的个数相同. 2.给出语言描述,构造文法. 如:构造一文法,其定义的语言是由算符+, *, (,)和运算对象a构成的算术表达式的集合. 答案1: G[E] E→E+T|T T→T*F|F F→(E)|a 答案2: G[E] E→E+E|E*E|(E)|a 相关术语的回顾(英文版) 上下文无关文法 A context free grammar(grammar for short) consists of terminals ,nonterminals,a start symbol,and productions. Terminals are the basic symbols from which strings are formed. Nonterminals are syntactic variables that denote sets of strings that help define the language generated by the grammar. In a grammar,one nonterminal is distinguished as the start symbol,and the set of strings it denotes is the language defined by the grammar. The productions of a grammar specify the manner in which the terminals and nonterminals can be combined to form string. 句型句子和语言 Given a grammar G with start symbol S,we can use the =* relation to define L(G),the language generated by G. Strings in L(G) may contain only terminal symbols of G. We say a string of terminals w is in L(G) if and only if S =* w .The string w is called a sentence of G. If S =* α,wher α may contain nonterminals then we say that α is a sentential form of G 验证文法生成的语言 A proof that a grammar G generates a language L has two parts:we must show that every string generated by G is in L,and coversely that every string in L can indeed be generated by G. 语法树和推导 A parse tree may be viewed as a graphical representation for a derivation that filt out the choice regarding replacement order. The leaves of the parse tree are labeled by nonterminals or terminals and ,read from left to right,they constitute a sentential form,called the yield or frontier of the tree. 句型分析,语法分析 Parsing is the process of determing if a string of token can be generated by a grammar. Most parsing methods fall into one of two classes,called the top-down and bottom-up methods. These terms refer to the order in which nodes in the parse tree are construct
您可能关注的文档
最近下载
- 日立电梯UAX-Ⅱ图纸K3500429.pdf
- HP Prime快速入门手册.pdf VIP
- 汽车底盘系统检修(张振东)任务1 离合器踏板的检查与调整.ppt VIP
- 2025版北师大版数学二年级上册全册教学设计教案.pdf
- 汽车底盘系统检修(张振东)任务3 离合器分离轴承、压盘和从动盘的检修.ppt VIP
- 2023年人教版小升初语文模拟试卷含答案 .pdf VIP
- 慢性老年病患者日常用药误区及对策.doc VIP
- 人教版三年级上册数学全册教学设计(配2025年秋新版教材).docx
- 《人工环境工程学科奖学金2011预.doc VIP
- 初高中衔接课因式分解市公开课一等奖百校联赛获奖课件.pptx VIP
文档评论(0)