📄 globals.h.bak
字号:
#ifndef _GLOBALS_H_
#define _GLOBALS_H_
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef MAXTOKENLEN
#define MAXTOKENLEN 100
#endif
#define MAXRESERVED 7
#define FLOAT 111
#define INT 112
#define CHAR 113
#define VOID 114
#define ENDFILE 0
#define ERROR 444
#define IF 911
#define ELSE 912
#define WHILE 913
#define RETURN 914
#define BREAK 915
#define ID 1000
#define NUM 1001
#define FLOATNUM 1002
#define LETTER 1003
#define STRING 1004
#define CONSTCHAR 1005
#define ASSIGN 2000
#define EQ 2001
#define LT 2002
#define LE 2003
#define GT 2004
#define GE 2005
#define NE 2006
#define AND 2007
#define OR 2008
#define NOT 2009
#define PLUS 3000
#define MINUS 3001
#define TIMES 3002
#define OVER 3003
#define LPAREN 4004
#define RPAREN 4005
#define LBRACKET 4006
#define RBRACKET 4007
#define LBC 4008
#define RBC 4009
#define SEMI 4010
#define COMMA 4011
typedef int TokenType;
extern FILE* source;
extern FILE* listing;
extern int lineno;
/********************************************************/
/********Syntax tree for pasing**************************/
/********************************************************/
typedef enum {StmtK,ExpK,DeclK} NodeKind;
typedef enum {IfK,WhileK,DoWhileK,ReturnK,AssignK,ExpStmtK,CompoundK,InputK,OutputK,} StmtKind;
typedef enum {OpK,ConstK,IdK,ArrayK,CallK} ExpKind;
typedef enum {SingleVarK,ArrayVarK,FuncVar} DeclKind;
typedef enum {Void,Integer,Boolean,Char,Float} ExpType;
#define MAXCHILDREN 3
typedef struct TreeNode
{
struct TreeNode* child[MAXCHILDREN];
struct TreeNode* sibling;
int lineno;
NodeKind nodekind;
union {StmtKind stmt; ExpKind exp; DeclKind decl;} kind;
union {TokenType op;
int vali;
float valf;
char valc;
char* name;
} attr;
ExpType type;
int array_size; /*just use for declkind*/
int layerno; /*use for symbol table*/
} TreeNode;
/*********************************************************/
/****************** flgas for tracing ********************/
/*********************************************************/
extern int TraceScan;
extern int EchoSource;
extern int Traceparse;
extern int TraceAnalyze;
extern int TraceCode;
extern int Error;
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -