- 1、本文档共42页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
编译原理-上下无关文法和文法分析.ppt
Introduction Parsing is the task of determining the syntax, or structure, of a program. It is also called syntax analysis. The syntax of a programming language is usually given by the grammar rules of a context-free grammar. The rules of context-free grammar are recursive. Data structures representing the syntactic structure are also recursive – a parse tree or syntax tree. The Parsing Process Usually, the sequence of tokens is not an explicit input parameter, but the parser calls a scanner procedure such as getToken to fetch the next token from the input as it is needed during the parser process. Context-Free Grammars A context-free grammar is a specification for the syntactic structure of a programming language. Context-free grammar involves recursive rules. Example: integer arithmetic expressions with additions, subtraction, and multiplication operations BNF Names are written in italic. | - metasymbol for choice. Concatenation is used as a standard operation. No repetitions. - is used to express the definitions of names. Regular expressions are used as components. The notation was developed by John Backus and adapted by Peter Naur. The grammar rules in this form are said to be in Backus-Naur Form, or BNF. Formal Definition CFL A context-free grammar consists of the following: 1) A set T of terminals 2) A set N of nonterminals ( disjoint from T) 3) A set fo productions ,or grammer rles , of the form A? a, where A is an element of N and a is an element of (T u N )* 4) A start symbol S from the set N A derivation over the grammer G is of the form S=*w ,where w is belonged to T*. The language generated by G The language ,written L(G) , is defined as the set L(G)= { w is belonged to T*| there exists a derivation S =* w of G } Context-Free Grammar Rules Grammar rules are defined over an alphabet, or set of symbols. The symbols are usually tokens representing strings of characters. Context-free grammar rule consists of a string of symbols Name for a
您可能关注的文档
- 管理层讨论和分析6.pdf
- 管理案例分析模拟试卷一.doc
- 管理案例分析模拟试卷二.doc
- 管理测试与训练.doc
- 管理类联考论证有效性分析真题案例.doc
- 管理系历年教材订购单(自09—10年开始).xls
- 管理统计实验报告.doc
- 管理驾驶舱软件如何设置计算指标样式.pdf
- 篮球进攻战术配合探讨与分析.doc
- 粗晶大理岩裂隙法向闭合曲线的拟合分析.pdf
- 3 《基于BIM技术的室内装修设计中的绿色建材应用与环保评估研究》教学研究课题报告.docx
- 生成式AI在初中道德与法治课程中促进情感教育的探索教学研究课题报告.docx
- 初中生科技创新社团活动对学生科技伦理观念的培养研究教学研究课题报告.docx
- 绿色化学理念在初中化学教学中的教学评价与反思教学研究课题报告.docx
- 生成式人工智能在地理课堂中的应用:学生学习风格适配与教学创新实践教学研究课题报告.docx
- 高中数学建模教学中的学生自主学习研究教学研究课题报告.docx
- 小学版:云计算与雾计算助力小学语文个性化阅读辅导系统研究教学研究课题报告.docx
- 高中生数字素养评价与综合素质评价体系构建研究教学研究课题报告.docx
- 云计算企业数据安全存储策略与数据安全事件应急响应教学研究课题报告.docx
- 高中生物基因编辑生成式人工智能辅助教研模式创新探讨教学研究课题报告.docx
文档评论(0)