?? global.h
字號:
// Using STL
// C++ forever ...
#include <iostream>
#include <stdlib.h>
#include <list>
#include <string>
using namespace std;
class elem
{
public:
string name;
list<string> first; // first set
list<string> follow; // follow set
};
const int MAXSIZE = 16; // maxium terminal symbol and maxium no-terminal symbol
const int MAXLINE = 32; // maxium lines of the input grammer
extern int lineno; // record how many lines
extern int colineno;
const string ee = "e"; // the empty string
extern bool isLL1Grammer; // judge whether a given grammer is a LL(1) grammer
extern elem symbol[MAXSIZE]; // to hold first and follow set for each symbol
extern string LL1_table[MAXSIZE][MAXSIZE]; // only for showing non-empty elements
extern list<string> production[MAXLINE]; // for getting grammer from standard input stream
extern list<string> coProduction[MAXLINE];
extern list<string> VN; // hold no-terminal symbols
extern list<string> VT; // hold terminal symbols
extern list<string> First;
extern list<string> Follow;
/* ---------------- function declaration --------------------- */
void getGrammer();
void getCoGrammer();
bool isLeftRecursion();
void emitLeftRecursion(); // for emiting later...
void print(list<string>& ); // to print structure
void removeDup(list<string>& ); // to remove duplicate
void getVN(); // get set of no-terminals
void getVT(); // get set of terminals
bool isIn(string,list<string>&); // judge if a given string is in a list
void listToString(string& ,list<string> ); // copy list to a string
void noRightReserve(); // for printing message
void getName(); // get the name of symbol
void buildFirst(); // build FIRST set
void printFirst(); // print FIRST of each no-terminals
void buildFollow(); // build FOLLOW set
void printFollow(); // print FOLLOW of each non-terminals
void initTable(); // inisialize the LL1 table
void buildTable(); // build LL1 table ( using some algorithm )
void printTable(); // print the LL(1) table
/* ---------------------------------------------------------- */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -