private static Element getRegistersElement(Language lang) {

		Register contextReg = lang.getContextBaseRegister();
		Element registersElement = new Element("registers");
		if (contextReg != Register.NO_CONTEXT) {
			Element ctxElement = getRegisterElement(contextReg);
			int contextBitLength = contextReg.getBitLength();
			for (Register bitReg : contextReg.getChildRegisters()) {
				Element fieldElement = new Element("field");
				fieldElement.setAttribute("name", bitReg.getName());
				int fieldBitLength = bitReg.getBitLength();
				int lsb = bitReg.getLeastSignificantBitInBaseRegister();
				int msb = lsb + fieldBitLength - 1;

				// Transpose bit numbering to agree with Sleigh context bit numbering
				lsb = contextBitLength - msb - 1;
				msb = lsb + fieldBitLength - 1;

				fieldElement.setAttribute("range", lsb + "," + msb);
				ctxElement.addContent(fieldElement);
			}
			registersElement.addContent(ctxElement);
		}
		for (Register reg : lang.getRegisters()) {
			if (!reg.getBaseRegister().isProcessorContext()) {
				Element regElement = getRegisterElement(reg);
				registersElement.addContent(regElement);
			}
		}
		return registersElement;
	}
Create old-language file for the specified language.
@param lang language
@param file output file
@throws IOException if file error occurs
@throws LanguageNotFoundException if lang is unknown to DefaultLanguageService
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/OldLanguageFactory.java