LR(0) 构造DFA

代码:

package analyzer;

import java.util.Scanner;

public class Analyze {
	
	static Scanner in = new Scanner(System.in);
	static String endChar,misendChar;
	static String[] grammer;
	static String[] addgrammer;
	static String[][] dfa;
	
	public static void main(String[] args) {
		
		int num;
		int addnum = 2;
		
		System.out.println("请输入终结符:");
		endChar = in.next();
		System.out.println("请输入非终结符(请使用S外的其它字符):");
		misendChar = in.next();
		System.out.println("请输入文法个数:");
		num = in.nextInt();
		num +=1;
		
		grammer = new String[num];		
		
		System.out.println("请输入文法:");
		for(int i=1; i.";
				for(int i=0;i

图片:

LR(0) 构造DFA_第1张图片

LR(0) 构造DFA_第2张图片

你可能感兴趣的:(MyProgram)