public static String generateInterpreterData(Grammar g) {
		StringBuilder content = new StringBuilder();

		content.append("token literal names:\n");
		String[] names = g.getTokenLiteralNames();
		for (String name : names) {
			content.append(name + "\n");
		}
		content.append("\n");

		content.append("token symbolic names:\n");
		names = g.getTokenSymbolicNames();
		for (String name : names) {
			content.append(name + "\n");
		}
		content.append("\n");

		content.append("rule names:\n");
		names = g.getRuleNames();
		for (String name : names) {
			content.append(name + "\n");
		}
		content.append("\n");

		if ( g.isLexer() ) {
			content.append("channel names:\n");
			content.append("DEFAULT_TOKEN_CHANNEL\n");
			content.append("HIDDEN\n");
			for (String channel : g.channelValueToNameList) {
				content.append(channel + "\n");
			}
			content.append("\n");

			content.append("mode names:\n");
			for (String mode : ((LexerGrammar)g).modes.keySet()) {
				content.append(mode + "\n");
			}
		}
		content.append("\n");

		IntegerList serializedATN = ATNSerializer.getSerialized(g.atn);
		// Uncomment if you'd like to write out histogram info on the numbers of
		// each integer value:
		//Utils.writeSerializedATNIntegerHistogram(g.name+"-histo.csv", serializedATN);

		content.append("atn:\n");
		content.append(serializedATN.toString());

		return content.toString();
	}
Try current dir then dir of g then lib dir
@param g
@param nameNode The node associated with the imported grammar name.
tool/src/org/antlr/v4/Tool.java