def __init__(self, filenames): self.asm_commands_list = [] file_basenames = set( [os.path.splitext(os.path.basename(f))[0] for f in filenames]) if 'Sys' in file_basenames: self.write_init() for f in filenames: file_data = (line for line in read_file(f)) writer = CodeWriter(f) command = self.advance(file_data) while command: parsed_elements = self.parse(command) if parsed_elements: self.asm_commands_list.append( writer.compose(parsed_elements)) command = self.advance(file_data)