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

📄 symbol.h

📁 YYCC语言编译器
💻 H
字号:
#ifndef SYMBOL_H
#define SYMBOL_H

/****************************************************************************
symbol.h
Implements a symbol table for a simple calculator.
****************************************************************************/

/////////////////////////////////////////////////////////////////////////////
// symbol

class symbol {
public:
	symbol();
	virtual ~symbol();

// Attributes
public:
	symbol* m_next;			// next symbol in bucket list
	char* m_name;			// symbol name
	double m_value;			// value attached to symbol

// Operations
public:
	int create(const char* name);
};

/////////////////////////////////////////////////////////////////////////////
// symboltable

#define BUCKET_SIZE 211				// prime number

class symboltable {
public:
	symboltable();
	virtual ~symboltable();
	
// Attributes
protected:
	symbol* m_bucket[BUCKET_SIZE];		// array of buckets

// Operations
protected:
	int hash(const char* name) const;
public:
	symbol* install(const char* name);
};

#endif

⌨️ 快捷键说明

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