scanner.h

来自「Simple语言词法分析器——————大连理工版」· C头文件 代码 · 共 67 行

H
67
字号
#ifndef SCANNER_H
#define SCANNER_H
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

//modify by webboyvc


#define LENGTH 61
#define N 100
/********************/
typedef struct token
{
	int label;
	char name[30];
	int code;
	int addr;
}token;
typedef struct KeyWord
{
	char name[30];
	int code;
}KeyWord;
typedef struct symble
{
	int number;
	int type;
	char name[30];
}symble;
/*******************************************/
char ch;
int var_count;
int error_count;
int label_count;
int code_count;
int addr_count;
int LineOfPro;
char filename[30];
FILE *KeyFin;
FILE *SourceFin;
FILE *SourceFout;
FILE *TokenFout;
FILE *SymbleFout;
KeyWord key[LENGTH];
token CurrentToken;
symble CurrentSimble;
symble SymbleList[N];
/***************************************************/
void Scanner();
void ScannerInit();
void IsAlpha();
void IsNumber();
void IsAnotation();
void IsChar();
void IsOther();
void OutPut();
void Error(int a);
int WordHave();
int strcmp(char*s,char*t)
{
	for(;*s==*t;s++,t++)
		if(*s==0)
			return 0;
		return 1;
}
#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?