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

📄 global.h

📁 语法分析程序,使用是递归子程序法.自己写的程序,学习
💻 H
字号:
/*
 * Author: zhangdi
 * Date: 2008-11-10
 * Description: global head file for all the source file and head file
 */

#ifndef GLOBAL_H_INCLUDED
#define GLOBAL_H_INCLUDED

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

#define STRMAX 10000    // max of store of symbol table
#define ARRAYMAX 999    // max entry of symbol table

#define BSIZE   128     // buffer size
#define NONE    -1      // nothing has done
#define EOS     '\0'    // end of string(char *)

#define IF          256 // if
#define ELSE        257 // else
#define WHILE       258 // while
#define INT         259 // int
#define FLOAT       260 //float

#define ID          261 // id(identifier)
#define NUM         262 // num(such as 128)
#define FNUM        263 // float number such as (128.11)
#define RELOP       264 // relop(==,<>,<,<=,>,>=)
#define ADDOP       265 // addop(+, -)
#define MULOP       266 // mulop(*, /)
#define DONE        267 // done(lexer is ok)

/* memory now line lexer is analysising */
int lineno;
/* memeory key word number of this language */
int keynum;
/* a flag to mark if there is error in your source file */
int lexsignal;

/* symbol table entry */
struct entry {
    char *lexptr; //value
    int token;    //token kind
};

/* token table node */
struct node {
    char * tok;
    int position;
};

/* symbol table */
struct entry symtable[];
/* key word table */
struct entry keywords[];
/* token table */
struct node tokens[];
/* file pointer to read source file */
FILE *fp;

#endif // GLOBAL_H_INCLUDED

⌨️ 快捷键说明

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