public static CodeGenerator create(Tool tool, Grammar g, String language) {
		String targetName = "org.antlr.v4.codegen.target."+language+"Target";
		try {
			Class<? extends Target> c = Class.forName(targetName).asSubclass(Target.class);
			Constructor<? extends Target> ctor = c.getConstructor(CodeGenerator.class);
			CodeGenerator codeGenerator = new CodeGenerator(tool, g, language);
			codeGenerator.target = ctor.newInstance(codeGenerator);
			return codeGenerator;
		}
		catch (Exception e) {
			g.tool.errMgr.toolError(ErrorType.CANNOT_CREATE_TARGET_GENERATOR, e, language);
			return null;
		}
	}
General controller for code gen.  Can instantiate sub generator(s).
tool/src/org/antlr/v4/codegen/CodeGenerator.java