public static ArrayList<Production> readProductionFromFile(String filePath)
			throws IOException {
		ArrayList<Production> productions = new ArrayList<Production>();
		File file = new File(filePath);

		if (!file.exists() || file.isDirectory()) {
			System.out.println("Error！File not exists or it's a directory!");
			throw new FileNotFoundException();
		}

		String currentProduction = "";
		String currentLeft = "";
		String currentRight = "";
		BufferedReader br = new BufferedReader(new FileReader(file));
		currentProduction = br.readLine();
		while (currentProduction != null) {
			if (currentProduction.charAt(0) == '#' || currentProduction.charAt(0) == '\n') {
				currentProduction = br.readLine();
				continue;
			}
			String[] tmp = currentProduction.split(TOKEN_STRING);
			currentLeft = tmp[0];
			currentRight = tmp[1];
			if (currentRight.contains(SPLIT_STRING)) { // 包含多个候选式
				currentRight = currentRight.replace(SPLIT_STRING,
						REPLACE_STRING);
				String[] candidates = currentRight.split(REPLACE_STRING);
				for (String s : candidates) {
					ArrayList<String> tmpRight = new ArrayList<String>();
					for (String s1 : s.split(" ")) {
						tmpRight.add(s1);
					}
					productions.add(new Production(currentLeft, tmpRight));
				}
			} else { // 右部只有一个候选式
				ArrayList<String> tmpRight = new ArrayList<String>();
				for (String s : currentRight.split(" ")) {
					tmpRight.add(s);
				}
				productions.add(new Production(currentLeft, tmpRight));
			}
			currentProduction = br.readLine();
		}
		br.close();
		return productions;
	}