吉大编译课件scanning-5.ppt

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

Compiler Construction Principles Implementation Techniques Dr. Zheng Xiaojuan Professor Software College of Northeast Normal University March. 2010 Summary for Last Lecture Regular Expression (RE) Some concepts and operations on strings set of strings; Definition of RE Regular Definition Generating NFA from Regular Expression rules Outline 2.1 Overview 2.1.1 General Function of a Scanner 2.1.2 Some Issues about Scanning 2.2 Finite Automata 2.2.1 Definition and Implementation of DFA 2.2.2 Non-Determinate Finite Automata 2.2.3 Transforming NFA into DFA 2.2.4 Minimizing DFA 2.3 Regular Expressions 2.3.1 Definition of Regular Expressions 2.3.2 Regular Definition 2.3.4 From Regular Expression to DFA 2.4 Design and Implementation of a Scanner 2.4.1 Developing a Scanner from DFA 2.4.2 A Scanner Generator – Lex 2.4 Design and Implementation of a Scanner Developing a Scanner Manually A Scanner Generator – Lex Developing a Scanner Manually Implement Scanner with DFA Implementation of DFA Just checking whether a string is acceptable by the DFA; Implementation of a Scanner not checking; but recognizing an acceptable string(word) and establish its internal representation token-type, semantic information Implement Scanner with DFA Some Issues Independent or Attached Skip these special characters Blank, Tab, comments, return (line number) When to stop scanning At the end of the source file Keywords identifier How to know the end of recognizing one token? 立即接受状态和延迟接受状态 Defining Lexical Structure of C0 letter = a|…|z|A|…|Z digit = 0|…|9 NZ-digit = 1|…|9 Reserved = {| }| read| write Identifier =letter(letter|digit)* Constant: int = NZ-digit digit* | 0 Other symbols: syms = +|*| := | ; Lexical structure: lex = Reserved | identifier |int | syms DFA for C0 Developing a Scanner from DFA Input: a sequence of symbols, with a special symbol EOF as the end of the sequence; Output: a sequence of tokens; Developing a Scanner from DFA Developing a Sc

文档评论(0)

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

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

1亿VIP精品文档

相关文档