Ejemplo n.º 1
0
Created by Patrick Flanagan on 2/20/2015

This is the main process. It passes the name of the file to be processed
to the Analyzer class. The main processes are to have the file opened, analyzed, and
then closed. The analysis will also be written to a log file.

"""
import sys
import os.path
from Analyzer import Analyzer

# input should be one file name

if len(sys.argv) != 2:
    print "Incorrect number of arguments given. Program is expecting exactly one argument."
    print "The argument should be a name of a file at the base location of the program."

else:
    if not os.path.isfile(sys.argv[1] + ".mal"):
        print "Argument given could not be found at the base-level of the program."
        print "Check if file exists and if the name matches the given argument."

    else:
        analyzer = Analyzer(sys.argv[1])

        analyzer.initialize_log_file()
        analyzer.analyze_file()

        analyzer.input_file.close()
        analyzer.output_file.close()