@SuppressWarnings("unchecked")
	public static IntermediateNode visitCopperSpecNode(Node n,String inheritance,CompilerLogger logger)
	throws CopperException
	{
		if(!n.hasChildNodes() || n.getChildNodes().getLength() == 0) return null;
		else if(n.getChildNodes().getLength() == 1) return visitDOMNode(n.getFirstChild(),null,logger);
		else
		{
			if(n.getAttributes().getNamedItem("id") == null)
			{
				formalError(logger,n,"missing","id","attribute");
				return null;
			}
			if(n.getAttributes().getNamedItem("type") == null)
			{
				formalError(logger,n,"missing","type","attribute");
				return null;
			}
			// Must not contain spaces
			String grammarId = n.getAttributes().getNamedItem("id").getTextContent();
			String spectype = n.getAttributes().getNamedItem("type").getTextContent();
			String postParseCode = "";
		    //if(spectype.equals("LALR1-silver.haskell")) postParseCode = "printParseTree(System.out,false,(edu.umn.cs.melt.copper.runtime.parsetree.stripped.StrippedParseTreeNode) root,\"\");";
		    //else if(spectype.equals("LALR1-pretty")) postParseCode = "printParseTree(System.out,true,(edu.umn.cs.melt.copper.runtime.parsetree.stripped.StrippedParseTreeNode) root,\"\");";
		    IntermediateNode grammarNameNode = new IntermediateSymbolNode(
		    	    IntermediateSymbolSort.GRAMMAR_NAME,
       		        Symbol.symbol(grammarId),
       		        Pair.cons("location",Pair.cons(getPos(),null)),
       		        Pair.cons("spectype",Pair.cons(getPos(),(Object) spectype)));
		    
		    IntermediateNode postParseCodeNode = new IntermediateSymbolNode(
	                IntermediateSymbolSort.DIRECTIVE,
	                Symbol.symbol(" postParseCode "),
	                Pair.cons("location",Pair.cons(getPos(),null)),
	                Pair.cons("code",Pair.cons(getPos(),(Object) postParseCode))); 
			
			IntermediateNode rv = null;
			
			ArrayList<IntermediateNode> nodes = new ArrayList<IntermediateNode>();
			nodes.add(grammarNameNode);
			nodes.add(postParseCodeNode);
			
			for(int i = 0;i < n.getChildNodes().getLength();i++)
			{
				nodes.add(visitDOMNode(n.getChildNodes().item(i),null,logger));
			}			

			for(int i = nodes.size() - 1;i >= 0;i--)
			{
				if(rv == null) rv = nodes.get(i);
				else rv = IntermediateConsNode.cons(nodes.get(i),rv); 
			}
			return rv;
		}
	}