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

📄 semantic.h

📁 一个面向对像语言的编译器
💻 H
字号:

/*
 * File: semantic.h
 * ----------------
 * This is the header file for the semantic processing module
 * which exports routines to verify various semantic rules of
 * the language.  
*/

#ifndef _H_semantic
#define _H_semantic

#include "decllist.h"
#include "typelist.h"
class Declaration;
class Type;

/* Enum: DeclOrDefn
 * ----------------
 * Used as argument creating function declaration objects to
 * distinguish foward declarations from full definitions.
 */

typedef enum { DeclOnly, FullDefn } DeclOrDefn; 

/* Declaration creation functions
 * ------------------------------
 * Helpers for creating a new declaration object with right name
 * and type. These don't do any checking about conflicts, they just
 * create the declaration as specified from the parameters.
 */
Declaration *BuildVarDecl(const char *varName, Type *varType, int lineNum);
Declaration *BuildClassDecl(const char *className, Type *super, int lineNum);
Declaration *BuildFnDecl(const char *fnName, Type *returnType,
                      DeclList *formals, DeclOrDefn kind, struct yyltype *loc);


/* Function: TypeForClassName
 * --------------------------
 * Helper to lookup class by name and return Type object for the class.
 */
Type *TypeForClassName(const char *className);

/*新添加函数*/
Declaration *DealWithCall(Declaration *OptReceiver, char *id, DeclList * actuals);
Declaration *DealWithArray(Declaration *expr1, Declaration *index);
Declaration *DealWithLValue(Declaration *OptReceiver, char *id);
void DealWithPrint(DeclList *exprList);

#endif

⌨️ 快捷键说明

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