public Document toDOM(java.io.Serializable structure) {
		Grammar grammar = (Grammar) structure;
		Document doc = newEmptyDocument();
		Element se = doc.getDocumentElement();
		// Add the productions as subelements of the structure element.
		Production[] productions = grammar.getProductions();
		if (productions.length > 0)
			se.appendChild(createComment(doc, COMMENT_PRODUCTIONS));
		for (int i = 0; i < productions.length; i++)
			se.appendChild(createProductionElement(doc, productions[i]));
		// Return the completed document.
		return doc;
	}