摘要: include<bits/stdc++.h> using namespace std; stack a;//非终结符栈(左栈) stack b;//输入栈(右栈) int num=1;//输出编号 int f(char at,char bt) { if(atbt)//匹配 { a.pop(); b. 阅读全文
posted @ 2025-11-18 08:45 W001hhhFA 阅读(2) 评论(0) 推荐(0)
摘要: include<bits/stdc++.h> using namespace std; int num=0; //用于输出时使用 int i=0; //i用于跟踪当前处理的字符位置 string s;//输入的字符串s void E(); void G(); void T(); void S(); 阅读全文
posted @ 2025-11-18 08:44 W001hhhFA 阅读(1) 评论(0) 推荐(0)
摘要: include<bits/stdc++.h> using namespace std; struct node{ string s1;//s1: 指令类型(如LET、PRINT) string s2;//s2: 指令操作 }p[101];//TinyBasic的程序最多只有100行 int var[ 阅读全文
posted @ 2025-11-18 08:44 W001hhhFA 阅读(1) 评论(0) 推荐(0)
摘要: include<bits/stdc++.h> using namespace std; string str[]={"main","if","else","for","while","int"}; // 存储需要识别的6个关键词 // 界符boundary和运算符operator直接在main函数中 阅读全文
posted @ 2025-11-18 08:43 W001hhhFA 阅读(1) 评论(0) 推荐(0)