?? analyzer.h
字號:
#ifndef MY_ANAYLZER_H_
#define MY_ANAYLZER_H_
/****************************************************/
/* File: parse.h */
/* The parser interface for the C minus compiler */
/* By: lonelyforest. Data: 2006.04.08 */
/****************************************************/
#include "symbolTab.h"
#include "FunCheck.h"
const int memInd = 2; // memory indent,
class Analyzer {
public:
Analyzer(const string& file);
~Analyzer();
void buildSymtab(TreeNode *pNode);
void typeCheck(TreeNode *pNode);
//void getListFile() { parse->getListFile(); }
//void getTreeFile() { parse->getTreeFile(); }
void getSymbolFile(); // main interface
//-------------------------------------------------------------------
void noTreeFile() { traceParse = false; }
void noListFile() { parse->noListFile(); }
void noSymbolFile() { traceAnalyze = false; }
//--------------------------------------------------------------------
bool is_good()const;
int errCount() const {return parse->errCount() + err;}
int warnCount() const { return parse->warnCount() + warn;}
//-------------------------------------------------------------------
protected:
//------------------------------------------------------------------------
void traverse(TreeNode * t,
void (* preProc) (TreeNode *),
void (* postProc) (TreeNode *) );
//------------------------------------------------------------------------
static void nullProc(TreeNode *t);
static void insertNode(TreeNode *t);
static void checkNode(TreeNode *);
static void addMemLoc() { location += memInd; }
//------------------------------------------------------------------------
public:
TreeNode *program;
protected:
Parser *parse;
//--------------------------------------------------------------------
static symTable symbolTab;
static FunArgsCheck FunArgs;
string symFile;
//--------------------------------------------------------------------
static int location; // memory location
static int err;
static int warn;
//--------------------------------------------------------------------
bool is_good_;
bool traceAnalyze;
bool traceParse;
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -