- 20
- 0
- 约 80页
- 2017-08-19 发布于北京
- 举报
词法分析部分总结 田 聪 构造词法分析器的一般方法和步骤 描述:用正规式对模式进行描述; 构造NFA:为每个正规式构造一个NFA; 确定化:将NFA转换成等价的DFA; 最小化:优化DFA,使其状态数最少; 构造词法分析器:由DFA构造词法分析器(表驱动,直接编码,LEX)。 涉及到的形式化概念 正则表达式(正规式) NFA DFA 正则语言 正则语言 正则语言 正则表达式 有限状态自动机 上下文无关语言 上下文无关文法 非确定的下推自动机 上下文有关语言 上下文有关文法 线性有界自动机(特殊的图灵机) 递归可枚举语言 短语结构 图灵机 Algebraic Laws for RE’s Union and concatenation behave like addition and multiplication. + is commutative (可交换的) and associative (可结合的) a+b=b+a, a+b+c= a+(b+c) concatenation is associative (可结合的) a.b.c=a.(b.c) Concatenation distributes over +(可分配的) a.(b+c)=a.b+a.c Exception: Concatenation is not commutative (可交换的) a.b ≠b.a Identities and Annihilators ? is the identity (单位元) for +. R + ? = R. ε is the identity (单位元) for concatenation. εR = Rε = R. ? is the annihilator (零元) for concatenation. ?R = R? = ?. 正则语言相关内容 如何证明正则表达式和NFA的等价性? (1)We need to show that for every RE, there is an automaton that accepts the same language. (2)And for every automaton, there is a RE defining its language. RE to ε-NFA: Basis Symbol a: ε: RE to ε-NFA: Induction 1 – Union RE to ε-NFA: Induction 2 – Concatenation RE to ε-NFA: Induction 3 – Closure 正则语言相关内容 如何证明正则表达式和NFA的等价性? (1)We need to show that for every RE, there is an automaton that accepts the same language. (2)And for every automaton, there is a RE defining its language. From Automata to RE Arden’s rule For any sets of strings S and T, the equation X=SX+T has X=S*T as a solution. Moreover, this solution is unique if ε not in S. From Automata to RE Given an automaton A A has states {q0, …, qn} with q0 being the start state Let Xi denote the set of strings accepted by A starting in state qi Thus, L(A)=X0 We can write an equation for each Xi, defining it in terms of the sets corresponding to its successor states. From Automata to RE From Automata to RE DFA-to-RE Another approach Page 93, theorem 3.4. (形式语言与自动机) Induction on k-path. Decision Properties of Regular Languages Properties of Language Classes A language class is a set of languages. We have on
您可能关注的文档
最近下载
- 2024-2025学年上海市普陀区六年级下学期数学期末试题含详解.pdf VIP
- 制造业企业员工高离职率分析.pdf VIP
- GB50461-2024:石油化工静设备安装工程施工质量验收规范.pptx VIP
- 三江A116火灾报警控制器简易操作规程.docx
- (新版)社会体育指导员理论知识考试题库(含答案).docx VIP
- DB31T 1104-2018 城市轨道交通导向标识系统设计规范.docx VIP
- 2023年浙江省军队转业干部录用考试试题.docx VIP
- 口渴了-朋友帮你.ppt VIP
- Xikong西莱克低温机控制板SHXK814用户手册.pdf
- 爱迪生牛顿大发明攻略.doc VIP
原创力文档

文档评论(0)