as the custom parser system demonstratesmodular program design is almost always major win by using python' program structuring tools (functionsmodulesclassesand so on)big tasks can be broken down into smallmanageable parts that can be coded and tested independently for instancethe scanner can be tested without the parser by making an instance with an input string and calling its scan or match methods repeatedly we can even test it like this interactivelyfrom python' command line when we separate programs into logical componentsthey become easier to understand and modify imagine what the parser would look like if the scanner' logic was embedded rather than called pathologically big numbers are handled welltoobecause python' built-in objects and operators are used along the wayx parse(' ' + parse(' ' parse(' ' + in additionthere is an interactive loop interface in the testparser module if you want to use the parser as simple command-line calculator (or if you get tired of typing parser method callspass the parser classso testparser can make one of its ownimport testparser testparser interact(parser parserenter= enter= enter=( enter=set enter=set enter= enter= lexical error at column = =enter= 'cis undefined at column = =enter= syntax error at column = =enter= text and language