Improved Lexical Analysis and Its Implementation in C-like Language

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.