private Grammar readGrammar(File file) {
		Grammar g = new UnboundGrammar();
		int lineNum = 0;
		try {
			BufferedReader reader = new BufferedReader(new FileReader(file));
			String line = null;
			while ((line = reader.readLine()) != null) {
				line = line.trim();
				lineNum++;
				if (line.length() == 0)
					continue;
				if (line.startsWith("#"))
					continue;
				String[] elems = line.split("\\s+");
				int len = elems.length;
				if (len > 3 || len < 2 || !elems[1].equals("->")) {
					throw new ParseException("Line " + lineNum
							+ " is not formatted properly!");
				}
				g.addProduction(new Production(elems[0], len == 3 ? elems[2]
						: ""));
			}
		} catch (FileNotFoundException e) {
			throw new ParseException("Could not find file " + file.getName()
					+ "!");
		} catch (IOException e) {
			throw new ParseException("Error accessing file to write!");
		}
		return g;
	}