LR(0) 语法分析器 - 判别 LR(0) 文法、生成项目族信息、构造 LR 分析表
{
"title": "LR(0) 语法分析器 - 判别 LR(0) 文法、生成项目族信息、构造 LR 分析表",
"description": "本程序实现了 LR(0) 语法分析器的功能,包括判别 LR(0) 文法、生成项目族信息、构造 LR 分析表等功能,并提供单步和一键显示输入的待分析句子功能。",
"keywords": "LR(0), 语法分析器, 项目族, LR 分析表, 编译原理",
"content": "private void button2_Click(object sender, EventArgs e)//判别LR0文法
{
Dictionary<string, List
private void button4_Click(object sender, EventArgs e)//生成项目族信息
{
// 从输入框获取产生式
string input = textBox1.Text;
string[] lines = input.Split('\n');
Dictionary<string, List
private void button5_Click(object sender, EventArgs e)//构造LR分析表
{
// 从输入框获取产生式
string input = textBox1.Text;
string[] lines = input.Split('\n');
Dictionary<string, List
private void button7_Click(object sender, EventArgs e)//单步显示输入的待分析句子 { // 从输入框获取待分析句子 string sentence = textBox2.Text; // 显示待分析句子 label3.Text = sentence; }
private void button8_Click(object sender, EventArgs e)//一键显示输入的待分析句子 { // 从输入框获取待分析句子 string sentence = textBox2.Text; // 显示待分析句子 label3.Text = sentence; }
private void GetFirst(string symbol, Dictionary<string, List
// 判断一个字符是否为终结符 private bool IsTerminal(char c) { if (char.IsUpper(c)) return false; return true; }
// 判断一个非终结符是否能推出空串
private bool IsReachEmpty(string symbol, Dictionary<string, List
// 计算 FOLLOW 集
private void GetFollow(string symbol, Dictionary<string, List
private List
private Dictionary<int, Dictionary<string, string>> ConstructLRTable(Dictionary<string, List
原文地址: https://www.cveoy.top/t/topic/fZDI 著作权归作者所有。请勿转载和采集!