⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.h

📁 分析C程序中的词法,如是否为关键字或变量等.
💻 H
字号:
/***********************************************************************
一些变量和数据结构的定义
本程序完全用标准的c写成,除了用到了c++中string 类,其他都没有用
所以我想这个程序是可以在不同平台上运行的
***********************************************************************/
#ifndef _GLOBAL_H
#define _GLOBAL_H

#include <stdio.h>
#include <ctype.h>
#include <string>
using namespace std;

# define  MAX 32//分析表的最大容量
#define   MAXBUF 2046

char  ch =' ';// 存放读入当前的输入字符
int lineno=0;//程序行数
int leftno=0;//左大括号数
int rightno;//右大括号数
struct entry{
			  const	char *lexptr;
				int token;
			};//关键字表中的结构

 struct entry symtable[MAX];//分析表
static string  str[] = {"auto","main","break","case","char","const","struct","continue","do","define","default","double","else","enum","extern",
						"for","goto","int","if","include","long","register","return","scanf","struct","short","static",
						"sizeof","switch","printf","void","while"};//关键字

#endif

⌨️ 快捷键说明

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