"lt": "C_ARITHMETIC",
    "and": "C_ARITHMETIC",
    "or": "C_ARITHMETIC",
    "not": "C_ARITHMETIC",
}


def usage():
    print """
python S1VM.py <source>
    where <source> is a valid vm file or a folder containing vm files.
"""


if __name__ == "__main__":
    translator = Translator()
    parser = Parser(instdict)

    outASM = []

    try:
        givenpath = sys.argv[1]
    except IndexError:
        usage()
        exit()

    if os.path.isdir(givenpath):
        for file in os.listdir(givenpath):
            if file[-3:] == ".vm":
                classname = file[:-3]
                translator.newclass(classname)
    "gt":       "C_ARITHMETIC",
    "lt":       "C_ARITHMETIC",
    "and":      "C_ARITHMETIC",
    "or":       "C_ARITHMETIC",
    "not":      "C_ARITHMETIC",
    }



def usage():
    print"""
python S1VM.py <source>
    where <source> is a valid vm file or a folder containing vm files.
"""
if __name__=="__main__":
    translator=Translator()
    parser=Parser(instdict)
    
    outASM=[]
    
    try:
        givenpath = sys.argv[1]
    except IndexError:
        usage()
        exit()

    if os.path.isdir(givenpath):
        for file in os.listdir(givenpath):
            if file[-3:] == ".vm":
                outASM.append(translator.translate(parser.parse(os.path.join(givenpath, file))))
    elif os.path.isfile(givenpath) and givenpath[-3:] == ".vm":
    "gt":       "C_ARITHMETIC",
    "lt":       "C_ARITHMETIC",
    "and":      "C_ARITHMETIC",
    "or":       "C_ARITHMETIC",
    "not":      "C_ARITHMETIC",
    }



def usage():
    print"""
python S1VM.py <source>
    where <source> is a valid vm file or a folder containing vm files.
"""
if __name__=="__main__":
    translator=Translator()
    parser=Parser(instdict)
    
    outASM=[]
    
    try:
        givenpath = sys.argv[1]
    except IndexError:
        usage()
        exit()

    if os.path.isdir(givenpath):
        for file in os.listdir(givenpath):
            if file[-3:] == ".vm":
                classname = file[:-3]
                translator.newclass(classname)