import sys

from assembler import Assembler
from disassembler import Disassembler

def main():
  #filename = r'<put_file_here_for_debugging>' # <put_file_here_for_debugging>
  #class_file = ClassFile(filename)
  #class_file.dump(filename + '.bc')
  #sys.exit(0)

  try:
    option = sys.argv[1]
    filename = sys.argv[2]
    assert(option == '-a' or option == '-d')
  except:
    print 'Usage: jbytecode.py -a <filename.bc>'
    print '       jbytecode.py -d <filename.class>'
    sys.exit(0)

  if option == '-a':
    Assembler(filename).dump()
  elif option == '-d':
    Disassembler(filename).dump()
    
if __name__ == '__main__':
  main()

