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

📄 struct.h

📁 采用递归下降分析法实现C0语言的语法分析器
💻 H
字号:
#define  MAXNUM 100
#define  MAX    10
typedef struct
{
	int  line;
	char type[10];
	char string[20];
}word;
word words[MAXNUM];
word curentword;
typedef struct treenode
{
	int  treeline;
	char nodetype[20];
	char nodestring[20];
	char rettype[10];
	char vartype[10];
	int  isarray;
	char  modifier[10];
    struct treenode *child[MAX];
}tree;

typedef struct leaf
{
	char  leaftype[10];
    char  ral[20];
}leaf;
leaf *makeleaf(char leaftype[10],char ral[20])
{
	leaf *p;
	p=(leaf *)malloc(sizeof(leaf));
	strcpy(p->ral,ral);
	strcpy(p->leaftype,leaftype);
	return p;
}
tree *makenode(int treeline,char nodetype[20],char nodestring[20],char rettype[10],char vartype[10],int isarray,char modifier[10])
{
	tree *p;
	int i;
	p=(tree *)malloc(sizeof(tree));
	p->treeline=treeline;
	strcpy(p->nodetype,nodetype);
	strcpy(p->nodestring,nodestring);
	strcpy(p->rettype,rettype);
	strcpy(p->vartype,vartype);
	strcpy(p->modifier,modifier);
	p->isarray=isarray;
	for(i=0;i<=MAX;i++)p->child[i]=NULL;
	return p;
}

⌨️ 快捷键说明

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