?? globals.h
字號:
#ifndef GLOBALS_H
#define GLOBALS_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define FALSE 0
#define TRUE 1
#define INT 257
#define CHAR 258
#define FLOAT 259
#define VOID 260
#define IF 261
#define ELSE 262
#define WHILE 263
#define FOR 264
#define RETURN 265
#define ID 266
#define NUM 267
#define FLOATNUM 268
#define CONSTCHAR 269
#define AND 270
#define OR 271
#define NOT 272
#define ASSIGN 273
#define EQ 274
#define LT 275
#define LE 276
#define GT 277
#define GE 278
#define NE 279
#define PLUS 280
#define MINUS 281
#define TIMES 282
#define OVER 283
#define LPAREN 284
#define RPAREN 285
#define SEMICOLON 286
#define COMMA 287
#define LBRACKET 288
#define RBRACKET 289
#define LBRACE 290
#define RBRACE 291
#define ERROR 292
#define ENDFILE 293
typedef int TokenType;
extern FILE *source; /* source code text file */
extern FILE* listing; /* listing output text file */
extern FILE* code; /* P-code text file */
extern FILE* yyin;
extern FILE* yyout;
/**************************************************/
/*********** Syntax tree for parsing ************/
/**************************************************/
enum NodeKind {StmtK,ExpK,DeclK};
enum StmtKind {IfK,WhileK,ForK,ReturnK,CompoundK};
enum ExpKind {TypeK,OpK,NotK,ArrayK,ConstK,IdK,CallK};
enum DeclKind {VarDeclK,FuncDeclK,FuncDefK,ParamK};
/* ExpType is used for type checking */
enum ExpType {Void,Integer,Boolean,Char,Float};
enum VarKind {Func,Array,Norm};
#define MAXCHILDREN 4
struct TreeNode
{
struct TreeNode * child[MAXCHILDREN];
struct TreeNode * sibling;
int lineno;
NodeKind nodekind;
union
{
StmtKind stmt;
ExpKind exp;
DeclKind decl;
} kind;
struct
{
TokenType op;
int vali;
float valf;
char valch;
char *name;
ExpType vartype;
} attr;
ExpType type; /* for type checking of exps */
VarKind varK;
};
extern int lineno; /* source line number for listing */
/**************************************************/
/*********** Flags for tracing ************/
/**************************************************/
/* EchoSource = TRUE causes the source program to
* be echoed to the listing file with line numbers
* during parsing
*/
extern int EchoSource;
/* TraceScan = TRUE causes token information to be
* printed to the listing file as each token is
* recognized by the scanner
*/
extern int TraceScan;
/* TraceParse = TRUE causes the syntax tree to be
* printed to the listing file in linearized form
* (using indents for children)
*/
extern int TraceParse;
/* TraceAnalyze = TRUE causes symbol table inserts
* and lookups to be reported to the listing file
*/
extern int TraceAnalyze;
/* TraceCode = TRUE causes comments to be written
* to the TM code file as code is generated
*/
extern int TraceCode;
/* Error = TRUE prevents further passes if an error occurs */
extern int Error;
#endif //GLOBAL_H
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -