资源简介
编译原理.rar

代码片段和文件信息
#include
#include
#include“stdio.h“
#include“conio.h“
#include“iomanip“
#include
#include
#include
using namespace std;
#define K_ZIFU 0//标识符
#define K_SUANFU 1//运算符
#define K_SHUZI 2//常数
#define K_JIEFU 3//边界符
#define K_KONG 4//空格
#define K_HUANGHANG 5//换行
#define K_BAOLIUZI 6//保留字
#define OVER 7
#define NOTOVER 8
char *const_0[6]={ “for““if“ “else“ “goto“ “continue““break“};
char const_1[6]={‘*‘‘+‘‘-‘‘=‘‘>‘‘<‘};
char const_3[7]={‘;‘‘#‘‘(‘‘)‘‘{‘‘}‘‘/‘};
int K_now; //现在的类型
int K_will; //being到的字符的类型
char temp_char; //being到的字符
char temp_chars[255];
bool flag;
bool flag0;
int amount=1;
char name1[100];
char name2[100];
char name3[100];
char name4[100];
ifstream infile0infile1infile2;
ofstream outfile0outfile1outfile2outfile3;
queue charque;
queue charque0;
stack charstr;
struct shuchustr{
queue charque;
char bchar;
int gto;
};
shuchustr strstr0;
int initial1()
{
infile1.open(“a.txt“ios::in|ios::binary);
if(! infile1)
{
cout<<“ 打开文件失败!“< return 0;
}
else
{
outfile1.open(“b.txt“ios::out);
outfile0.open(“c.txt“ios::out);
return 1;
}
}
int initial2()
{
infile2.open(“b.txt“ios::in);
if(!infile2)
{
cout<<“ 打开文件失败!“< return 0;
}
else
{
outfile2.open(“d.txt“ios::out);
return 1;
}
}
int initial0()
{
infile0.open(“c.txt“ios::in);
if(!infile0)
{
cout<<“ 打开文件失败!“< return 0;
}
else
return 1;
}
int read_char()
{
infile1.get(temp_char);
if(infile1.eof())
{
return OVER;
}
return NOTOVER;
}
void write_char()
{
outfile1< if(K_now==0)
{
charque0.push(“id“);
charque.push(temp_chars);
}
else if(K_now==2)
{
charque0.push(“n“);
charque.push(temp_chars);
}
else
{
charque0.push(temp_chars);
charque.push(temp_chars);
}
}
int KIND()
{
int i=0;
if(temp_char==‘ ‘||temp_char==‘\n‘||temp_char==‘\t‘||temp_char==‘\r‘)
{// 空格 回车 转行
return K_KONG;
}
for(i=0;i<7;++i)
{
if(const_3[i]==temp_char)
{
return K_JIEFU; //隔离 “(“ “)“ “[“ “]“
}
}
for(i=0;i<6;++i)
{
if(temp_char==const_1[i])
{
return K_SUANFU; //基本字符
}
}
if(temp_char>=‘0‘&&temp_char<=‘9‘)
{
return K_SHUZI;
}
if(temp_char>=‘a‘&&temp_char<=‘z‘||temp_char>=‘A‘&&temp_char<=‘Z‘||temp_char==‘_‘)
{
return K_ZIFU;
}
return OVER;
}
void analyse_suanfu()
{
write_char();
}
void analyse_kong()
{
while(read_char())
{
K_will=KIND();
if(K_will!=K_KONG)
{
infile1.seekg
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 15184 2009-06-22 02:15 编译原理\11.cpp
文件 80896 2009-06-22 04:38 编译原理\封面.doc
文件 279552 2009-06-22 04:45 编译原理\正文.doc
文件 28160 2009-06-22 04:43 编译原理\目录和任务书.doc
文件 32256 2009-06-22 01:14 编译原理\评定表.doc
目录 0 2009-06-22 04:52 编译原理
----------- --------- ---------- ----- ----
436048 6
- 上一篇:数据结构课程设计之客户积分管理系统
- 下一篇:最新版信息系统项目管理师视频教程
相关资源
- PID_AutoTune_v0.rar
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
- 加快Windows XP操作系统开机速度
评论
共有 条评论