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

📄 tl.hpp

📁 COCO類似C的編譯器
💻 HPP
字号:
//**********************************************************
//   TL.HPP
//   Coco/R C++ Taste Example.
//   Adapted to C++ by Frankie Arzu <farzu@uvg.edu.gt>
//      from Moessenboeck's (1990) Oberon example
//
//   May 24, 1996  Version 1.06
//   Jun 16, 1998  Version 1.08 (Minor changes)
//**********************************************************

#ifndef TL_INCLUDE
#define TL_INCLUDE

#include "cr_error.hpp"

typedef char Name[15];

/* object kinds */

#define VARS   0
#define PROCS  1
#define SCOPES 2

/* types */

#define UNDEF  0
#define INT    1
#define BOOL   2

typedef struct Objectnode *Object;
typedef struct Objectnode {
  char name[15];      /* name of the object */
  int  type;          /* type of the object (undef for procs) */
  Object next;        /* to next object in same scope */

  int kind;
  int adr;            /* address in memory or start of proc */
  int level;          /* nesting level of declaration */

  Object locals;      /* to locally declared objects */
  int nextAdr;        /* next free address in this scope */
} Objectnode;

class SymTable {
  public:
    SymTable(CRError *E);
    Object undefObj; /* object node for erroneous symbols */
    int curLevel;    /* nesting level of current scope */
    Object topScope;
    void EnterScope();
    void LeaveScope();
    int  DataSpace ();
    Object NewObj (char name[], int kind);
    Object Obj (char name[]);
  private:
    CRError *Error;
};

#endif // TL_INCLUDE

⌨️ 快捷键说明

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