语言的词法分析程序.docxVIP

  • 7
  • 0
  • 约4.22千字
  • 约 6页
  • 2018-10-14 发布于贵州
  • 举报
语言的词法分析程序

#includestdio.h #includestdlib.h #includestring.h #define _KEY_WORD_END waiting fou your expanding/*定义关键字的结束标志*/ typedef struct { int typenum; /*种别码*/ char *word; }WORD; char input[255]; /*源程序缓字符冲区*/ char token[255]=; /*单词缓冲区*/ int p_input; /*源程序字符指针*/ int p_token; /*单词缓冲区指针*/ char ch; char *rwtab[]={begin,if,then,while,do,end,_KEY_WORD_END}; WORD *scaner(); /*词法扫描函数,获得一个单词*/ void main() { int over=1; int count=0; WORD *oneword = new WORD; printf(Enter Your words(end with #):); scanf(%[^#]s,input); /*输入源程序字符串到缓冲区,以#结束*/ p_input=0; printf(词法分析结果

文档评论(0)

1亿VIP精品文档

相关文档