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

📄 symbol.h

📁 编译原理全套实验源代码。包括词法分析
💻 H
字号:
/*	单词种类标识的定义 */ 






#define		ERROR 100
#define		IDENTIFIER 101
#define		AUTO 0
#define		DOUBLE 1
#define		INT 2
#define		STRUCT 3
#define		BREAK 4
#define		ELSE 5
#define		LONG 6
#define		SWITCH 7
#define		CASE 8
#define		ENUM 9
#define		REGISTER 10
#define		TYPEDEF 11
#define		CHAR 12
#define		EXTERN 13
#define		RETURN 14
#define		UNION 15
#define		CONST 16
#define		FLOAT 17
#define		SHORT 18
#define		UNSIGNED 19
#define		CONTINUE 20
#define		FOR 21
#define		SIGNED 22
#define		VOID 23
#define		DEFAULT 24
#define		GOTO 25
#define		SIZEOF 26
#define		VOLATILE 27
#define		DO 28
#define		IF 29
#define		STATIC 30
#define		WHILE 31
#define		INCLUDE 32
#define     ID		33
#define		INTLITERAL	34
#define		LPAREN		35
#define		RPAREN	36
#define		LBRACE	37	
#define		RBRACE	38
#define		LBRACKET	39
#define		RBRACKET	40
#define		SEMI	41
#define		COMMA	42
#define		DOT	43
#define	    EQ	50		//("="),
#define	    GT	51		//(">"),
#define	    LT	52		//("<"),
#define		BANG 53		//("!"),
#define	    TILDE 54	//("~"),
#define		QUES  55	//("?"),
#define		COLON 56	//(":"),
#define		EQEQ 57  		//("=="),
#define		LTEQ 58 		//("<="),
#define		GTEQ 59		//(">="),
#define		BANGEQ 60		//("!="),
#define		AMPAMP 61		//("&&"),
#define		BARBAR	62	//("||"),
#define		PLUSPLUS 63	//("++"),
#define		SUBSUB	64	//("--"),
#define		PLUS	65	//("+"),
#define		SUB		66	//("-"),
#define		STAR	67	//("*"),
#define		SLASH	68	//("/"),
#define		AMP		69	//("&"),
#define		BAR		70	//("|"),
#define		CARET	71	//("^"),
#define		PERCENT	72	//("%"),
#define		LTLT	73	//("<<"),
#define		GTGT	74	//(">>"),
#define		PLUSEQ	75	//("+="),
#define		SUBEQ	76	//("-="),
#define		STAREQ	77	//("*="),
#define		SLASHEQ	78	//("/="),
#define		AMPEQ	79	//("&="),
#define		BAREQ	80	//("|="),
#define		CARETEQ	81	//("^="),
#define		PERCENTEQ 82	//("%="),


char keywords[][10]={ "auto", "double","int", "struct","break","else","long",
"switch","case","enum", "register","typedef","char",
"extern","return", "union","_CONST",
"float","short", "unsigned","continue",
"for","signed","_VOID","default",
"goto","sizeof","volatile", "do",
"if","static","while","include",
"main","printf","scanf"
};

int keytype[]={AUTO, DOUBLE,INT,STRUCT, BREAK,
ELSE,LONG,SWITCH, CASE, ENUM, REGISTER,
TYPEDEF, CHAR,EXTERN, RETURN, UNION,
CONST, FLOAT, SHORT, UNSIGNED, CONTINUE,
FOR, SIGNED, VOID,DEFAULT, GOTO,SIZEOF,
VOLATILE, DO, IF,STATIC, WHILE, INCLUDE, 
ID
};

char operators[][3]={"=",">","<","!","~","?",":","==","<=",
">=","!=","&&","||","++","--","+","-","*","/","&","|","^","%",
"->","+=","-=","*=","/=","&=","|=","^=","%="
};

int optype[]={EQ,GT,LT,BANG,TILDE,QUES,COLON,EQEQ,LTEQ,
GTEQ,BANGEQ,AMPAMP,BARBAR,PLUSPLUS,SUBSUB,PLUS,SUB,STAR,
SLASH,AMP,BAR,CARET,PERCENT,GTGT,PLUSEQ,SUBEQ,STAREQ,
SLASHEQ,AMPEQ,BAREQ,CARETEQ,PERCENTEQ};




⌨️ 快捷键说明

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