编译原理 词法分析器(Compiler Principle lexical analyzer).docVIP

  • 15
  • 0
  • 约2.92千字
  • 约 15页
  • 2017-09-15 发布于河南
  • 举报

编译原理 词法分析器(Compiler Principle lexical analyzer).doc

编译原理 词法分析器(Compiler Principle lexical analyzer)

编译原理 词法分析器(Compiler Principle lexical analyzer) #包括 stdio. h #包括字符串。” #定义max_size 128 字符键[ ] [ max_size ] = {“暗淡”、“如果”、“做”、“停止”、“结束”};//定义关键字表 char * Concat(char * strtoken,ch)/连接函数 { char温度[ 2 ]; 温度[ 0 ] = CH; 临时[ 1 ] =“0”;/“0”为结束字符 将连接/ * * /(strtoken,温度);/ /将温度连接到strtoken并返回 返回strtoken; } //是否为字母 int IsLetter(ch) { 如果(((CH =‘A’)和(CH = z))| |((CH =‘A’)和(CH =“Z”))) 返回1; 其他的 返回0; } / /是否为数字 int IsDigit(ch) { 如果(“0”和“9”) 返回1; 其他的 返回0; } / /是否是关键字 国际储备(char * strtoken) { 为(int i = 0;i 38;i++)/数组标号最大为37,一共有38个数组 { 如果(0 = = strcmp(strtoken,关键[我])) 返回1; } 返回0; } Bool isdim (char * strtoken) {

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档