Write and document a Python script s2m_check.py which takes as a command-line argument a directory-path, checks each s2m-system file in the directory-tree rooted at that path for syntactic correctness, and, for each error found (maximum of one per file), prints the name of that file and a short descriptive message. The list of errors should be sorted by filename. If a command-line argument is not given, the check should proceed from the current working directory. Where possible, define your own functions to simplify code structure; when you do, make sure these functions are documented with their own doc-strings and (where necessary) internal comments. Your script must work on all s2m files from Assignment #5 and the s2m files flaw1.s2m, flaw2.s2m, flaw3.s2m, flaw4.s2m, flaw5.s2m, flaw6.s2ms, flaw7.s2ms, flaw8.s2ms, flaw9.s2ms, flaw10.s2ms, flaw11.s2ms, flaw12.s2ms, flaw13.s2mop, flaw14.s2mop, and flaw15.s2mop to produce the output given in typescript-file s2m_check.script. You may assume that all given datafiles are readable.
Created: March 5, 2008
Last Modified: March 5, 2008