The xxxT.xml files are strictly for debugging the tokenizer. As soon as you are happy with your tokenizer you no longer need to write them. Coursera does not require you to generate them.
Note that when you convert JackAnalyzer into JackCompiler, it may be useful to (optionally) write the xxx.xml files in parallel with the xxx.vm files. Looking at the end of the XML file can help debugging when your compiler crashes deep into recursive parsing.
I wrote an XmlWriter class that takes a file name and used it for both the xxxT.xml and xxx.xml files. By passing in null for the filname, the class ignores all calls to its methods. This way, with no changes other than the constructor calls, I can control whether the XML files get written. My JackCompiler has options -x and -xt that cause it to generate the xxx.xml and xxxT.xml files. The compileXxx methods in the compiler look like this:
def _CompileClassVarDec(self):
"""
Compiles <class-var-dec> :=
('static' | 'field') <type> <var-name> (',' <var-name>)* ';'
ENTRY: Tokenizer positioned on the initial keyword.
EXIT: Tokenizer positioned after final ';'.
"""
self._WriteXmlTag('<classVarDec>\n')
self._ExpectKeyword((KW_STATIC, KW_FIELD))
if (self.tokenizer.Keyword() == KW_STATIC):
variableKind = SYMK_STATIC
else:
variableKind = SYMK_FIELD
self._CompileDec(variableKind)
self._WriteXmlTag('</classVarDec>\n')
("self" is Python's "this". _ExpectKeyword parses the next token and if it is not a keyword, or is not one of the keywords in the argument list, prints an error message and raises an exception. _CompileDec does all the remaining work for _CompileClassVarDec and _CompileVarDec.)
--Mark