Description: Lex是美国Bell实验室用C语言研制的一个词法分析程序自生成工具。它的基本原理就是使用正则表达式扫描匹配文本,并为每一个匹配模式定义一些操作,当用C语言作宿主语言时,这些操作都由C语言实现。一种匹配的正则表达式可能会包含相关的动作。这一动作可能还包括返回一个标记。当 Lex 接收到文件或文本形式的输入时,它试图将文本与正则表达式进行匹配。它一次读入一个输入字符,直到找到一个匹配的模式。如果能够找到一个匹配的模式,Lex 就执行相关的动作(可能包括返回一个标记)。-Lex Bell Laboratories of the United States with C language developed by a lexical analysis tool generated from the process. Its fundamental principle is to use a regular expression matching text scanning, and for every definition of a matching model for operation, when the C language of the host language, these operators by C language. A match of which is likely to contain expressions related to the moves. This action may also include the return of a marker. When Lex reception of the document or text input, it is trying to text and is a regular expression matching. It read an input into the characters, until they found a matching pattern. If they can find a matching model, Lex on the implementation of the action (which may include a return of markings). Platform: |
Size: 2994 |
Author:万宏兴 |
Hits:
Description: 一. 实验目的: 设计、编写和调试一个具体的词法分析程序,加深对词法分析理论和自动词法分析工具的理解、实践和掌握。 二. 实验要求: ① 学习和理解正则表达式理论,写出C—语言的记号的完整的正则表达式;(适当使用正则定义) ② 学习和理解有限机理论,根据前面的正则表达式,用基于经验的方法画出C—语言的记的DFA图; ③ 用基于DFA图的算法编写C—语言的词法分析程序; ④ 学习词法分析程序的自动生成工具,使用LEX工具实现C—语言的词法分析程序.- 1. Experimental goal: The design, compiles and debugs a
concrete lexical analyaer, deepens to the lexical analysis theory and
the automatic lexical analysis tool understanding, practices and
grasps. 2. The experiment requests: (1) study and the understanding
regular expression theory, writes the C 鈻 Platform: |
Size: 147456 |
Author:晨曦 |
Hits:
Description: Lex是美国Bell实验室用C语言研制的一个词法分析程序自生成工具。它的基本原理就是使用正则表达式扫描匹配文本,并为每一个匹配模式定义一些操作,当用C语言作宿主语言时,这些操作都由C语言实现。一种匹配的正则表达式可能会包含相关的动作。这一动作可能还包括返回一个标记。当 Lex 接收到文件或文本形式的输入时,它试图将文本与正则表达式进行匹配。它一次读入一个输入字符,直到找到一个匹配的模式。如果能够找到一个匹配的模式,Lex 就执行相关的动作(可能包括返回一个标记)。-Lex Bell Laboratories of the United States with C language developed by a lexical analysis tool generated from the process. Its fundamental principle is to use a regular expression matching text scanning, and for every definition of a matching model for operation, when the C language of the host language, these operators by C language. A match of which is likely to contain expressions related to the moves. This action may also include the return of a marker. When Lex reception of the document or text input, it is trying to text and is a regular expression matching. It read an input into the characters, until they found a matching pattern. If they can find a matching model, Lex on the implementation of the action (which may include a return of markings). Platform: |
Size: 3072 |
Author:万宏兴 |
Hits:
Description: flex 是一个生成扫描器的工具,能够识别文本中的词法模式。flex 读入给定的输入文件,如果没有给定文件名的话,则从标准输入读取,从而获得一个关于需要生成的扫描器的描述。此描述叫做 规则,由正则表达式和 C 代码对组成。flex 的输出是一个 C 代码文件——lex.yy.c——其中定义了 yylex() 函数。编译输出文件并且和 -lfl 库链接生成一个可执行文件。当运行可执行文件的时候,它分析输入文件,为每一个正则表达式寻找匹配。当发现一个匹配时,它执行与此正则表达式相关的 C 代码-flex generated scanner is a tool that can identify lexical patterns in text. flex time into the given input file, in the absence of a given file name, then read from standard input, and thus on the need to generate a description of the scanner. This description is called the rules, by the regular expression and the composition of C code. the output of flex is a C code file- lex. yy.c-- which defines the yylex () function. Output file and compile and link-lfl library to generate an executable file. When running an executable file, it analyzes the input file, for each regular expression match to find. When they find a match, it is the implementation of regular expressions with the related C code Platform: |
Size: 707584 |
Author:myname |
Hits:
Description: Lex输入文件的解析
正规表达式的解析
一个正规表达式到NFA的转换算法的实现-Analysis of the Lex input file of regular expressions to resolve a formal expression to NFA conversion algorithm Platform: |
Size: 1359872 |
Author:mj |
Hits:
Description: 1.输入文件解析
2.正则表达式转化为NFA
3.多个NFA合并
4.NFA转换DFA
5代码生成
关于输入文件格式:
没有考虑对lex输入文件的出错处理,所以输入文件务必严格书写正确。
Lex中的正规表达式使用了以下运算符:
[] | * @ ( )
并且正规表达式中不能出现其他的子正规表达式。
如果想要在待识别的正则式中使用上述运算符,请使用转义符号,即\。
例如,如果想用*,可以写成\*
-1. Analysis of the input file 2. Regular expressions into NFA 3. More than the combined NFA conversion 4.NFA Code Generation DFA 5 on input file format: There is no consideration of the lex input file error handling, the input file must be written in strict correct. Lex in the regular expression operators used the following: [] |* @ () and regular expressions can not be a subset of other regular expressions. If you want to be identified in the regular-type operator to use the above, please use the escape symbol, that is, \. For example, if you want to use*, can be written in \* Platform: |
Size: 17408 |
Author:顾添锦 |
Hits:
Description: 用c++实现的此法分析器,包括正则表达式解析,正则到NFA转换,NFA到DFA转换,和最终的匹配,详见包中README文件-Using c++ parser to achieve this method, including regular expression analysis, while the NFA is converted, NFA to DFA conversion, and end the match, see the package README file Platform: |
Size: 16384 |
Author:0x7c00 |
Hits: