symtab.h

来自「我作编译原理课程设计时写的一个图形化的小型开发环境」· C头文件 代码 · 共 35 行

H
35
字号
#include <iostream>
#include <string>
using namespace std;
//enum bool  {false, true};
using namespace std;
enum SymType   {
   STR_VAR,    // String variable
   STR_CONST,  // String constant
};

class SymDesc {
public:
   SymDesc (char *_name, SymType _type, char *_cont, int _line);
   ~SymDesc ();
   void Show ();

   char    *name;   // name of the symbol
   char    *cont;   // contents (if string constant)
   SymType  type;   // type of the symbol
   int      line;   // line it was first encountered
   SymDesc *next;   // next symbol in list
};

class SymTab  {
public:
   SymTab();
   ~SymTab();
   bool Add (SymDesc *symb);
   SymDesc *Find (char *name);
   void Show ();

private:
   SymDesc *start;
};

⌨️ 快捷键说明

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