• 大小: 1.11MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-13
  • 语言: 其他
  • 标签: 编译原理  

资源简介

紧接我之前提交的Pascal词法和语法分析器,这里是实现了赋值、if-语句、for-语句的Pascal语法制导的翻译的语义分析器。

资源截图

代码片段和文件信息

#include “code.h“

const char key_words[KEY_LEGNTH][TYPE_LENGTH] = { ““
“and“ “array“ “begin“ “case“
“const“ “div“ “do“ “downto“
“else“ “end“ “pfile“ “for“
“function“ “goto“ “if“ “in“
“label“ “mod“ “nil“ “not“
“of“ “or“ “packed“ “procedure“
“program“ “record“ “repeat“ “set“
“then“ “to“ “type“ “until“
“var“ “while“ “with““integer“
“word“  “char“};

int searchStr(const char *s)  //searcht the string
{
int i;
for (i = 0; i < KEY_LEGNTH-2; i++)
if (strcmp(key_words[i] s) == 0)
return i;
for (; i < KEY_LEGNTH; i++)
if (strcmp(key_words[i] s) == 0)
return 36;
return -1;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2016-06-04 20:15  SemanticAnalysis\
     目录           0  2016-06-01 23:22  SemanticAnalysis\Debug\
     文件       81408  2016-06-04 20:15  SemanticAnalysis\Debug\SemanticAnalysis.exe
     文件      495568  2016-06-04 20:15  SemanticAnalysis\Debug\SemanticAnalysis.ilk
     文件      798720  2016-06-04 20:15  SemanticAnalysis\Debug\SemanticAnalysis.pdb
     目录           0  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\
     目录           0  2016-06-01 20:11  SemanticAnalysis\SemanticAnalysis\Debug\
     文件       26199  2016-06-01 22:53  SemanticAnalysis\SemanticAnalysis\Debug\LexicalAnalysis.obj
     文件        2016  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.log
     目录           0  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\
     文件       25216  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\CL.read.1.tlog
     文件       13692  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\CL.write.1.tlog
     文件         182  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\SemanticAnalysis.lastbuildstate
     文件       11298  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\cl.command.1.tlog
     文件        3716  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\link.command.1.tlog
     文件        6396  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\link.read.1.tlog
     文件        2564  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SemanticAnalysis.tlog\link.write.1.tlog
     文件       52372  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\SyntaxAnalysis.obj
     文件        5632  2016-06-01 20:11  SemanticAnalysis\SemanticAnalysis\Debug\code.obj
     文件        5936  2016-06-01 20:11  SemanticAnalysis\SemanticAnalysis\Debug\definedByMyself.obj
     文件       18730  2016-06-01 22:53  SemanticAnalysis\SemanticAnalysis\Debug\lrTable.obj
     文件        8819  2016-06-03 12:12  SemanticAnalysis\SemanticAnalysis\Debug\main.obj
     文件       12936  2016-06-01 20:11  SemanticAnalysis\SemanticAnalysis\Debug\nonTerminal.obj
     文件       12677  2016-06-01 20:11  SemanticAnalysis\SemanticAnalysis\Debug\state.obj
     文件       13708  2016-06-02 15:45  SemanticAnalysis\SemanticAnalysis\Debug\statementQueue.obj
     文件       17035  2016-06-01 20:11  SemanticAnalysis\SemanticAnalysis\Debug\symbolManager.obj
     文件       12079  2016-06-02 15:45  SemanticAnalysis\SemanticAnalysis\Debug\threeAddress.obj
     文件       14282  2016-06-01 20:11  SemanticAnalysis\SemanticAnalysis\Debug\tokenQueue.obj
     文件       84992  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\vc120.idb
     文件       86016  2016-06-04 20:15  SemanticAnalysis\SemanticAnalysis\Debug\vc120.pdb
     文件     2435999  2016-04-18 12:30  SemanticAnalysis\SemanticAnalysis\LRTable.txt
............此处省略38个文件信息

评论

共有 条评论