globals.h

来自「包括文件操作、图形系统、并口串口编程、鼠标编程、小型cad系统、编译器、病毒防火」· C头文件 代码 · 共 84 行

H
84
字号


#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


#define MAXRESERVED 8

typedef enum 
    
   {ENDFILE,ERROR,
    
    IF,THEN,ELSE,END,REPEAT,UNTIL,READ,WRITE,
    
    ID,NUM,
    
    ASSIGN,EQ,LT,PLUS,MINUS,TIMES,OVER,LPAREN,RPAREN,SEMI
   } TokenType;

extern FILE* source; 
extern FILE* listing; 
extern FILE* code; 

extern int lineno; 





typedef enum {StmtK,ExpK} NodeKind;
typedef enum {IfK,RepeatK,AssignK,ReadK,WriteK} StmtKind;
typedef enum {OpK,ConstK,IdK} ExpKind;


typedef enum {Void,Integer,Boolean} ExpType;

#define MAXCHILDREN 3

typedef struct treeNode
   { struct treeNode * child[MAXCHILDREN];
     struct treeNode * sibling;
     int lineno;
     NodeKind nodekind;
     union { StmtKind stmt; ExpKind exp;} kind;
     union { TokenType op;
             int val;
             char * name; } attr;
     ExpType type; 
   } TreeNode;






extern int EchoSource;

extern int TraceScan;


extern int TraceParse;


extern int TraceAnalyze;

extern int TraceCode;


extern int Error; 
#endif

⌨️ 快捷键说明

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