摘要
本文提出一种改进的词法分析程序设计思想,并进行了实现。首先定义四类字符集,构造状态转换矩阵。然后通过对给定文法的分析,化简变换状态转换矩阵使之成为程序可直接使用的二维数组Status。最后利用二维数组Status给出了核心函数get Word()的类C描述。
In this paper,the design thought of an improved lexical analysis is proposed and realized.First of all,the definition of four types of character sets and construction of a state transition matrix are achieved.Secondly,through analysis of a given grammar,the state transition matrix can be transformed into a two-dimensional array in which the lexical analysis can directly use.Finally,the description of core function getWord(),which takes advantage of the matrix above,is given in C-like language.
出处
《安庆师范学院学报(自然科学版)》
2009年第4期36-38,42,共4页
Journal of Anqing Teachers College(Natural Science Edition)
关键词
词法分析
字符集
状态转换矩阵
lexical analysis
character set
state transition matrix