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

📄 symtab.h

📁 我作编译原理课程设计时写的一个图形化的小型开发环境
💻 H
字号:
#include <iostream>
#include <string.h>
using namespace std;
//enum bool  {false, true};

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 ();

   // index number for VMachine::Read()  (aarggh.. dirty coding!!)
   void SetNo (int n)  {no=n;}
   int  GetNo ()    {return no;}
   int no;

   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 ();
   SymDesc *GetFirst ()  {current = start; return current;}
   SymDesc *GetNext ()   {
      if (current != NULL)
         current=current->next; 
      return current;
   }

private:
   SymDesc *start;
   SymDesc *current;
};

⌨️ 快捷键说明

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