public static void generateSemanticSkeleton(Syntax syntax, String className, String pkgName)
		throws Exception
	{
		String fileName = className+"Semantic.java";

		String dirName = pkgName != null && pkgName.length() > 0
				? pkgName.replace('.', File.separatorChar)
				: System.getProperty("user.dir");

		File out = new File(dirName, fileName);
				
		if (out.exists())	{
			throw new IllegalStateException("Will not overwrite "+out.getAbsolutePath()+". Please check the file for implementation and remove it!");
		}
		else	{
			new File(dirName).mkdirs();	// ensure directory exists
			FileWriter fw = new FileWriter(out);
			new SemanticSkeletonGenerator(syntax, className, pkgName, fw);
			System.err.println("Wrote semantic skeleton to file: "+out);
		}
	}