当前位置:高等教育资讯网  >  中国高校课件下载中心  >  大学文库  >  浏览文档

清华大学:《编译原理》课程教学资源_(英文译文)Chapter 2.4 From Regular Expression To DFAs

资源类别:文库,文档格式:PPT,文档页数:79,文件大小:296KB,团购合买
Main Purpose Study an algorithm: – Translating a regular expression into a DFA via NFA.
点击下载完整版文档(PPT)

COMPILER CONSTRUCTION Principles and practice Kenneth C. Louden

COMPILER CONSTRUCTION Principles and Practice Kenneth C. Louden

2. Scanning Lexical Analysis) PART TWO

2. Scanning (Lexical Analysis) PART TWO

Contents PART ONE 2. 1 The Scanning Process 2.2 Regular Expression 2.3 Finite automata PART TWO 2. 4 From Regular expressions to dFas Open 2.5 Implementation of a TINY Scanner Open 2.6 Use of Lex to Generate a Scanner Automatically Openl

Contents PART ONE 2.1 The Scanning Process 2.2 Regular Expression 2.3 Finite Automata PART TWO 2.4 From Regular Expressions to DFAs [Open] 2.5 Implementation of a TINY Scanner [Open] 2.6 Use of Lex to Generate a Scanner Automatically [Open]

2. 4 From Regular expression To DFAS

2.4 From Regular Expression To DFAs

Main purpose Study an algorithm Translating a regular expression into a dfa via NFA Regular NFA DFA Program Expression

Main Purpose • Study an algorithm: – Translating a regular expression into a DFA via NFA. Regular Expression NFA DFA Program

Contents From a regular expression to an NFA more From an nfa to a dfa more Simulating an NFA using Subset Construction ore Minimizing the number of states in a dFa more

Contents • From a Regular Expression to an NFA [More] • From an NFA to a DFA [More] • Simulating an NFA using Subset Construction [More] • Minimizing the Number of States in a DFA [More]

2.4.1 From a Regular expression to an nfa

2.4.1 From a Regular Expression to an NFA

The Idea of Thompson’s Construction Use£- transitions to"glue together" the machine of each piece of a regular expression to form a machine that corresponds to the whole expression Basic regular expression The NFAs for basic regular expression of the form a, c, or (p

The Idea of Thompson’s Construction • Use ε-transitions – to “glue together” the machine of each piece of a regular expression – to form a machine that corresponds to the whole expression • Basic regular expression – The NFAs for basic regular expression of the form a, ε,or φ a 

The Idea of Thompson’s Construction Concatenation: to construct an nfa equal to rs To connect the accepting state of the machine of r to the start state of the machine of s by ane-transition The start state of the machine of r as its start state and the accepting state of the machine of s as its accepting state This machine accepts L(rs)=l(rl(s)and so corresponds to the regular expression rs

The Idea of Thompson’s Construction • Concatenation: to construct an NFA equal to rs – To connect the accepting state of the machine of r to the start state of the machine of s by anε-transition. – The start state of the machine of r as its start state and the accepting state of the machine of s as its accepting state. – This machine accepts L(rs) = L(r)L(s) and so corresponds to the regular expression rs. … r  … s

The Idea of Thompson’s Construction Choice among alternatives: To construct an nfa equal to rIs To add a new start state and a new accepting state and connected them as shown usinge-transitions Clearly, this machine accepts the language L(rs FL(TUL (s), and so corresponds to the regular expression rls

The Idea of Thompson’s Construction • Choice among alternatives: To construct an NFA equal to r | s – To add a new start state and a new accepting state and connected them as shown usingε-transitions. – Clearly, this machine accepts the language L(r|s) =L(r )UL ( s), and so corresponds to the regular expression r|s. … r  … s   

点击下载完整版文档(PPT)VIP每日下载上限内不扣除下载券和下载次数;
按次数下载不扣除下载券;
24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
共79页,可试读20页,点击继续阅读 ↓↓
相关文档

关于我们|帮助中心|下载说明|相关软件|意见反馈|联系我们

Copyright © 2008-现在 cucdc.com 高等教育资讯网 版权所有