A compiler represents the structure of a program as a tree. Typically the first step in a compiler is to build this tree by writing a parser. Parsing also allows one to validate that the program being parsed is consistent with the programming language grammar. Both the logical and presentational aspects of DML are encoded in XML, a format which explicitly reflects the tree structure of the program. Furthermore, validity of the program is ensured by validation against an RNG grammar for the language. To obtain a parse tree for a DML program, the
dmlc simply parses the XML into a DOM tree.