📄 parsingstack.h
字号:
using namespace std;
struct stackEntry
{
string entry;
stackEntry* lower;
stackEntry()
{
entry="";
lower=0;
}
};
class ParsingStack
{
public:
ParsingStack();//Constructor, push $ and P(the start symbol) into the stack.
void initialize();//reset the stack to the initial state.
stackEntry* pop();//pop the top entry(the leftmost token of a production).
stackEntry* push(string entry);//push an entry into the stack.
stackEntry* replace(string pte);
//Been given the entry of the parsing table, it will
//replace the top of the stack by several other entries, according to
//the production.
stackEntry* getTop();
//return the current pointer.
bool isEmpty();
~ParsingStack();
private:
string getEntry(string pte);//get an entry from the entry of parsingTable
stackEntry* head;
stackEntry* current;
stackEntry* popHead;
stackEntry* popCurrent;
int currentPosition;//get the terminal or nonterminal from a string
int count;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -