文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 高等教育 > 工学 > C语言词法分析器_源代码_风君版
侵权投诉

C语言词法分析器_源代码_风君版

C语言词法分析器_源代码

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

char *key0[]={" ","auto","break","case","char","const","continue","default","do","double","else","enum","extern","float","for","goto","if","int","long","register","return","short","signed","sizeof","static","struct","switch","typedef","_Complex","_Imaginary","union","unsigned","void","volatile","while"};
/*保留字表*/
char *key1[]={" ","(",")","[","]","{","}",",",";","'"};
/*分隔符表*/
char *key2[]={" ","+","-","*","/","%","<",">","==",">=","<=","!=","!","&&","||","<<",">>","~","|","^","&","=","?:","->","++","--",".","+=","-=","*=","/="};
/*运算符表*/
int xx0[35],xx1[10],xx2[31];

int temp_key3=0,temp_c40=0,temp_c41=0,temp_c42=0,temp_c43=0;

/******* 初始化函数 *******/

void load()
{
int mm;
for (mm=0;mm<=34;mm++)
{
xx0[mm]=0;
}
for (mm=0;mm<=9;mm++)
{
xx1[mm]=0;
}
for (mm=0;mm<=30;mm++)
{
xx2[mm]=0;
}
FILE *floading;
if ((floading=fopen("key0.txt","w"))==NULL)
{
printf("Error! Can't create file : key0.txt");
return;
}
fclose (floading);
/*建立保留字表文件:key0.txt*/
if ((floading=fopen("key1.txt","w"))==NULL)
{
printf("Error! Can't create file : key1.txt");
return;
}
/*建立分隔符表文件:key1.txt*/
if ((floading=fopen("key2.txt","w"))==NULL)
{
printf("Error! Can't create file : key2.txt");
return;
}
fclose(floading);
/*建立运算符表文件:key2.txt*/
if ((floading=fopen("key3.txt","w"))==NULL)
{
printf("Error! Can't create file : key3.txt");
return;
}
fclose (floading);
/*建立标识符表文件:key3.txt*/
if ((floading=fopen("c40.txt","w"))==NULL)
{
printf("Error! Can't create file : c40.txt");
return;
}
fclose (floading);
/*建立整数类型常量表文件:c40.txt*/
if ((floading=fopen("c41.txt","w"))==NULL)
{
printf("Error! Can't create file : c41.txt");
return;
}
fclose (floading);
/*建立浮点类型常量表文件:c41.txt*/
if ((floading=fopen("c42.txt","w"))==NULL)
{
printf("Error! Can't create file : c42.txt");
return;
}
fclose (floading);
/*建立字符类型常量表文件:c42.txt*/
if ((floading=fopen("c43.txt","w"))==NULL)
{
printf("Error! Can't create file : c43.txt");
return;
}
fclose (floading);
/*建立字符串类型常量表文件:c43.txt*/
if ((floading=fopen("defination.txt","w"))==NULL)
{
printf("Error! Can't create file : defination.txt");
return;
}
fclose (floading);
/*建立注释文件:defination.txt*/
if ((floading=fopen("output.txt","w"))==NULL)
{
printf("Error! Can't create file : output.txt");
return;
}
fclose (floading);
/*建立内部码文件:output.txt*/
if ((floading=fopen("temp_key1","w"))==NULL)
{
printf("Error! Can't create file : temp_key1");
return;
}
fclose (floading);
/*建立保留字临时表文件:temp_key1*/
if ((floading=fopen("temp_key3","w"))==NULL)
{

第1页

热门文档

相关文档

  • C语言词法分析器_源代码_风君版

    C 语言词法分析器_源代码_风君版.txt 小时候觉得父亲不简单,后来觉得自己不简单,再后 来觉得自己孩子不简单。越是想知道自己是不是忘记的时候,反而记得越清楚。...

  • C语言词法分析器 源代码 风君版

    C语言词法分析器,内容说... 9页 4下载券 c语言词法分析器源码 暂无评价 9页...c40.txt*/ if ((floading=fopen("c41.txt","w"))==NULL) { printf("...

  • C语言词法分析器 源代码 风君版

    C语言词法分析器 源代码 风君版C语言词法分析器 源代码 风君版隐藏>> C语言词法分析器 源代码 风君版.txt我自横刀向天笑,笑完我就去睡觉。 你的手机比话费...

  • C语言词法分析器_C语言版_源代码

    C语言词法分析器_C语言版_源代码_计算机软件及应用_IT/计算机_专业资料。#include <stdio.h> #include <string.h> #include <stdlib.h> char *key0[]={"...

  • 《C语言词法分析器》开发文档及源代码

    《C语言词法分析器》开发文档及源代码_IT/计算机_专业资料。使用C语言编写的针对C的词法分析程序。附带完整的编译开发文档。该C语言词法分析器可以对任意C程序进行分...

  • C语言词法分析器,内容说明注释完整,可运行代码

    C语言词法分析器,内容说明注释完整,可运行代码_IT/计算机_专业资料。C语言词法分析器,内容说明注释完整,包含可运行代码1. 实验目的及要求本次实验通过用 C 语言 ...

  • C语言的词法分析器

    1. 实验目的及要求 1、 目的 通过设计、编制、调试一个具体的词法分析程序,加深对词法分析原理的 理解, 并掌握在对程序设计语言源程序进行扫描过程中将其分解为...

  • 词法分析器C语言程序

    词法分析器C语言程序_计算机软件及应用_IT/计算机_专业资料。C语言实现的词法分析器截图 源代码以及运行例程序都有词法分析程序 C 语言源代码: #include <stdio.h...

  • C语言编写源程序建立LR(1)分析器

    编译原理词法分析和语法... 22页 1下载券 语法分析器(含完整源码) 37页 免费...2 用 C 语言编写源程序建立 LR(1)分析器 ......

  • 编译原理词法分析和语法分析报告+代码(C语言版)

    词法分析一,实验目的设计,编制并调试一个词法分析程序,加深对词法分析原理的理解...语法分析程序的 C 语言程序源代码: #include "stdio.h" #include "string.h...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email