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

📄 init.c

📁 语法分析程序,使用是递归子程序法.自己写的程序,学习
💻 C
字号:
/*
 * Author: zhangdi
 * Date: 2008-11-10
 * Description: initialize for lexer
 */
#include "global.h"
#include "symbol.h"

/* Add key word keywords array  */
struct entry keywords[] = {
    {"if", IF},
    {"else", ELSE},
    {"while", WHILE},
    {"int", INT},
    {"float", FLOAT},
    {NULL, 0}
};

/* Initialize the symboltable to identify if the symbol is a ID */
void init()
{
    struct entry *p;
    for (p = keywords; p->token; p++)
    {
        /* memorize the number of keywords */
        keynum++;
        /* use the function of symboltable to add key words */
        insert(p->lexptr, p->token);
    }
}

⌨️ 快捷键说明

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