LL1 first follow集
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
课程名称: LL1文法的判别
年级/专业/班: 11级计算机类(二)班
姓名: 徐勇兵
学号: E01114278
import java.util.Vector;
import javax.swing.JOptionPane;
class Tools{
public Vector
Vector
for(int i=0;i newvector.add(vs.get(i)); return newvector; } public Vector for(int i=0;i Vector Vector for(int j=0;j temp.add((String)produce.get(j)); }//for j newvector.add(temp); }//for i return newvector; } } class Elements{ Vector Vector Vector public void setend(){//终结符元素添加 while(true) { String s=JOptionPane.showInputDialog(null,"请输入终结符"); if(s==null) { return; }//if end.add(s); }//while }//public void addend(){//元素添加 public void setnoend(){//非终结符元素添加 while(true) { String s=JOptionPane.showInputDialog(null,"非请输入终结符"); if(s==null) { return; }//if noend.add(s); }//while }//public void addnoend(){// public void setproduce(){ while(true) { String s=JOptionPane.showInputDialog(null,"请输入产生式,->隔开"); if(s==null) return; Vector temp.add(s.split("->")[0]); temp.add(s.split("->")[1]); produce.add(temp); }//while }//public void addproduce() public Vector return end; } public Vector return noend; } public Vector return this.produce; } public void run(){ /*************************TEST********************************/ end.add("a"); end.add("b"); end.add("c"); end.add("e"); noend.add("S"); noend.add("A"); noend.add("B"); noend.add("C"); noend.add("D"); Vector temp.add("S"); temp.add("AB"); produce.add(temp); /*************************/ Vector temp1.add("S"); temp1.add("bC"); produce.add(temp1); /*************************/ Vector temp2.add("A"); temp2.add("e"); produce.add(temp2); /*************************/ Vector temp3.add("A"); temp3.add("b"); produce.add(temp3); /*************************/ Vector