introduction to parsing object we convert this object into standard python listso now we have list containing single item-- list of our results--which we assign to the items variableand that we then further process via the populate_children(call before discussing the handling of the resultswe will briefly mention the error handling if the parser fails it will raise an exception we don' want pyparsing' exceptions to leak out to clients since we may choose to change the parser generator later on soif an exception occurswe catch it and then raise our own exception ( valueerrorwith the relevant details the hierarchy blk file in the case of successful parse of the hierarchy blk examplethe items list looks like this (with occurrences of and similarreplaced with block for clarity)[ block[] block[] block[] block[]whenever we parsed an empty block we returned to the parser' results listwhenever we parsed new rows we returned the number of rowsand whenever we encountered node_datawe created block to represent it in the case of blocks they always have an empty child list ( the children attribute is set to [])since at this point we don' know if the block will have children or not so here the outer list represents the root blockthe represent empty blocksthe other integers (all in this caserepresent new rowsand the [] are empty child lists since none of the hierarchy blk file' blocks contain other blocks the messagebox blk file the messagebox blk example' items list (pretty printed to reveal its structureand again using block for clarityis[block[block[ block[] block[] block[] here we can see that the outer list (representing the root blockcontains block that has child list of one block that contains its own child listand where these children are blocks (with their own empty child lists)new rows ( and )and empty blocks ( sone problem with the list results representation is that every block' children list is empty--each block' children are in list that follows the block in the parser' results list we need to convert this structure into single root block with child blocks to this end we have created stack-- list containing single root block we then call the populate_children(function that takes the list of items returned by the parser and list with root blockand populates the root block' children (and their childrenand so onas appropriatewith the items