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

📄 cgen.h

📁 1.小型编译器 2。支持整数
💻 H
字号:
/****************************************************/
/* File: cgen.h                                     */
/* The code generator interface to the TINY compiler*/
/* Compiler Construction: Principles and Practice   */
/* Kenneth C. Louden                                */
/****************************************************/

#ifndef _CGEN_H_
#define _CGEN_H_

/* Procedure codeGen generates code to a code
 * file by traversal of the syntax tree. The
 * second parameter (codefile) is the file name
 * of the code file, and is used to print the
 * file name as a comment in the code file
 */
 
#define LINESIZE  121
#define ospFO 	4
#define	topFO	0
#define	retFO	8
#define callFO	12

typedef enum {
   srOKAY,
   srHALT,
   srOver,
   srIMEM_ERR,
   srDMEM_ERR,
   srZERODIVIDE
} STEPRESULT;

void genLabel(int &label);
void lab(int elabel);
void fjp(int label);
void ujp(int label);
void ret(int r,char * name);

void codeGen(TreeNode * syntaxTree, char * codefile);

int doRun(void);

#endif

⌨️ 快捷键说明

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