📄 parsell_1.h
字号:
#ifndef _LL1_
#define _LL1_
#include "globals.h"
#include "scan.h"
#define MaxStackDepth 100
#include <cstdlib>
#include <iostream>
void InitStack();
/*显示符号栈中内容*/
typedef enum {ID_NUM, NOTML,TML } nodeKind;//非终结符,终结符,ID_NUM 3种
typedef struct streenode
{
int layno;//层数
int val;//节点值
nodeKind Nodekind;//结点类型
//int linenum;//对于token(非终结符)所在的行数
char tokenString[40];//对于ID/NUM的val
int childrenno;//孩子个数
struct streenode *child[10];//最多10个孩子
streenode()
{
layno=0;//层数
val=0;//节点值
Nodekind=NOTML;//结点类型
//int linenum;//对于token(非终结符)所在的行数
*tokenString='\0';//对于ID/NUM的val
childrenno=0;//孩子个数
for(int i=0;i<10;i++)
child[i]=NULL;//最多10个孩子
}
} StreeNode;
typedef StreeNode* parseTree;
void printGrammar();
void printToken1(int i);
void printToken2(int i);
void printToken3(int i);
void printToken4(int i,const char* tokenString );
void printFirstSet();
void getfirst();//求非终结符first set
void printFollowSet();
void getfollow();
void printfM();//打印分析表
void getM();
void ShowStack();
/*栈顶出栈*/
void Pop();
/*使用产生式反向入栈操作生成*/
int returnM(int tmltoken);//栈顶与现在得到的token返回returnM
void generate(TokenType token);
void match();
void printfCreatM();//Fisrst_follow_M
void MainCtrl(StreeNode *);//主控程序
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -