Пример #1
0
 def open_log(self, logger):
     self.log = AssemblerLogger(logger)
     self.log.write("created `{0}' assembler".format(self._language),
                    level.INFO)
Пример #2
0
class BaseAssembler(LoggerClient):
    def open_log(self, logger):
        self.log = AssemblerLogger(logger)
        self.log.write("created `{0}' assembler".format(self._language),
                       level.INFO)
    def read_lines(self, lines):
        """Read a line or lines of input and return a list of instructions.

        Description:
           [lines:str]:list -> [instructions:str]:list

        Purpose:
            Reads lines of assembly in the form of a list and returns a
            binary listing. Preprocessing and linking is done.

        Restrictions:
            Behaviour is undefined if argument is not of type <str>,
            representing a binary number.

        Exceptions:
            N/A

        Returns:
            A list of binary instructions.
        """
        pass
    def read_file(self, lines):
        """Reads a file and returns a list of instructions.

        Description:
            lines:file ->
                ([instructions:int]:list, [original:str]:list)

        Purpose:
            Opens a read an assembly file to return a binary listing.
            All the necessary preprocessing and linking will be done.

        Restrictions:
            See exceptions.

        Exceptions:
            Exception

        Returns:
            A tuple, element 0 is a list of binary encoded instructions,
            element 1 is the original listing (processed).
        """
        pass
    def convert(self, lines):
        """Converts a list of binary instructions to an integer list.

        Description:
            [lines:str]:list -> [instructions:int]:list

        Purpose:
            Before attempting to load a program that has been through
            the assembler, it should be converted for use in the
            simulation.

        Restrictions:
            Behaviour is undefined if arguments are not of type <str>,
            representing a binary number.

        Exceptions:
            N/A

        Returns:
            A list of integers.
        """
        pass
    def get_jump_table():
        pass