Parsimonious, the library I'm using, provides a super useful class for visiting nodes in a parse tree called a
NodeVisitor (appropriately enough). In order to use our generated parse trees for commands or errors, we'll just make two subclasses of this NodeVisitor class.
One subclass will return a callback related to the command's action - we'll call this
CommandVisitor, since that's what it'll be doing: visiting all the nodes of expression's we've validated as commands.
Another subclass will output an error message related to the command's failure: something along the lines of "pick what up?". It'll still have to visit the nodes and pick out any relevant information, for example the verb and object of the sentence.