📄 analyze.h
字号:
// analyze.h: interface for the Canalyze class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_ANALYZE_H__15ABAACA_9CDB_4ADC_AFB9_5C8EAA7D3D3D__INCLUDED_)
#define AFX_ANALYZE_H__15ABAACA_9CDB_4ADC_AFB9_5C8EAA7D3D3D__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "global.h"
class Canalyze : public Cglobal
{
public:
Canalyze();
virtual ~Canalyze();
int analyze(TreeNode * t);
/******************变量声明****************************/
/*scope栈的层数*/
int Level ;
/*在同层的变量偏移*/
int Off;
/*主程序display表的偏移*/
int StoreNoff;
/*各层的displayOff*/
int savedOff;
SymbTable * scope[SCOPESIZE]; /*scope栈*/
TypeIR * intPtr; /*该指针一直指向整数类型的内部表示*/
TypeIR * charPtr ; /*该指针一直指向字符类型的内部表示*/
TypeIR * boolPtr ; /*该指针一直指向布尔类型的内部表示*/
/*************实用函数*******************/
SymbTable * NewTable(void);
void CreatTable(void);
void DestroyTable(void);
int Enter(char * id,AttributeIR * attribP,SymbTable ** entry);
int FindEntry(char * id,SymbTable ** entry);
Cglobal::AttributeIR FindAttr(SymbTable * entry);
int Compat(TypeIR * tp1,TypeIR * tp2);
Cglobal::TypeIR * NewTy(TypeKind kind);
Cglobal::fieldChain * NewBody(void);
Cglobal::ParamTable * NewParam(void);
void ErrorPrompt(int line,char * name,char * message);
void printTab(int tabnum);
bool FindField(char * Id , fieldChain *head,fieldChain **Entry );
void PrintFieldChain(fieldChain *currentP);
void PrintOneLayer(int level);
void PrintSymbTable( );
/**************语义分析函数**********************/
void initialize(void);
Cglobal::TypeIR * TypeProcess(TreeNode * t,DecKind deckind);
Cglobal::TypeIR * nameType(TreeNode * t);
Cglobal::TypeIR * arrayType(TreeNode * t);
Cglobal::TypeIR * recordType(TreeNode * t);
void TypeDecPart(TreeNode * t);
void VarDecPart(TreeNode * t);
void varDecList(TreeNode * t);
void procDecPart(TreeNode * t);
Cglobal::SymbTable * HeadProcess(TreeNode * t);
Cglobal::ParamTable * ParaDecList(TreeNode * t) ;
void Body(TreeNode * t);
void statement (TreeNode * t);
Cglobal::TypeIR * Expr(TreeNode * t,AccessKind * Ekind);
Cglobal::TypeIR * arrayVar(TreeNode * t);
Cglobal::TypeIR * recordVar(TreeNode * t);
void assignstatement(TreeNode * t);
void callstatement(TreeNode * t);
void ifstatment(TreeNode * t );
void whilestatement(TreeNode * t);
void readstatement (TreeNode * t);
void writestatement(TreeNode * t );
void returnstatement(TreeNode * t );
/*************************************************************/
};
#endif // !defined(AFX_ANALYZE_H__15ABAACA_9CDB_4ADC_AFB9_5C8EAA7D3D3D__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -