#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
#define de(x) cout<<#x<<" = "<<x<<endl
#define dd(x) cout<<#x<<" = "<<x<<" "
const int N = 1001;
char ch;
char orignal[N], str[N], strtoken[N]; //orignal存初始字符串,str存处理后的字符串,strtoken存当前处理的词项
char sign[N][25],constant[N][25],sign_key[N][25];
int s1, s2; //分别为str和strtoken的位置
int neibuid;
int id=0,st=0,id_key=0;
typedef struct keytable
{
char name[20];
int id;
}KEYTABLE;
//设置关键字
KEYTABLE keyword[]={{"main",0},{"int",1},{"float",2},{"char",3},{"if",4},
{"else",5},{"for",6},{"while",7},{"do",8},{"switch",9},{"case",10},
{"break",11},{"long",12},{"signed",13},{"unsigned",14},{"struct",15},{"union",16},
{"enum",17},{"typedef",18},{"sizeof",19},{"auto",20},{"static",21},
{"register",22},{"extern",23},{"const",24},{"volatile",25},{"return",26},
{"continue",27},{"goto",28},{"default",29},{"void",30},{"double",31},{"short",32}};
int openfile() { //打开文件
FILE *fp;
char a, filename[15];
int n = 0;
printf("Input the filename:");
scanf("%s",filename);