文件名称:shiyan2
介绍说明--下载内容均来自于网络,请自行研究使用
本函数是一个词法分析器,其分析主要从几个方面入手:
*
* 1.先判别是不是注释。一旦读入的字符出现 / * ,则用一个while循环一直读取下面的字符,直到出现* /为止。
*
* 2.接着判断是不是以数值开头的。如果是以数值开头则再分情况讨论:
* A.在遇到空格之前,后面读进来的都是数值的话,则很明显,这是一个数。然后将其种别码输出来(37,-)
* B.在遇到空格之前,后面读进来的都是数值的话,譬如123ac 那么这是一个非法字符,输出错误-This function is a lexical analyzer, its analysis mainly from the aspects:** 1. Discriminant is not the first comment. Once read into the character appears/*, it has been using a while loop to read the following characters until*/date.** 2. And then judge is beginning to value. If the value is based on the situation at the beginning of the discussion is further divided into:* A. Prior to encounter a space, followed by reading the values are entered, then obviously, this is a number. And then other kinds of code output (37,-)* B. Prior to encounter a space, followed by reading the words of the incoming values are, for example, 123ac then it is an illegal character, output error
*
* 1.先判别是不是注释。一旦读入的字符出现 / * ,则用一个while循环一直读取下面的字符,直到出现* /为止。
*
* 2.接着判断是不是以数值开头的。如果是以数值开头则再分情况讨论:
* A.在遇到空格之前,后面读进来的都是数值的话,则很明显,这是一个数。然后将其种别码输出来(37,-)
* B.在遇到空格之前,后面读进来的都是数值的话,譬如123ac 那么这是一个非法字符,输出错误-This function is a lexical analyzer, its analysis mainly from the aspects:** 1. Discriminant is not the first comment. Once read into the character appears/*, it has been using a while loop to read the following characters until*/date.** 2. And then judge is beginning to value. If the value is based on the situation at the beginning of the discussion is further divided into:* A. Prior to encounter a space, followed by reading the values are entered, then obviously, this is a number. And then other kinds of code output (37,-)* B. Prior to encounter a space, followed by reading the words of the incoming values are, for example, 123ac then it is an illegal character, output error
(系统自动生成,下载前可以参看下载内容)
下载文件列表
shiyan2.cpp