If you want to create your own parser, consider the structure of traceprinter as a starting point. This utility consists of a long list of callback definitions, followed by a fairly simple parsing procedure. Each of the callback definitions is for printing.
The following sections give a brief introduction to the building blocks to the parser, and some of the issues you'll need to handle.