Ejemplo n.º 1
0
def bareModeIllegalSyntax(data: str, text: str, errors: FileIO):
    global runMips
    pseudo_list = [
        'li ', 'la ', 'move ', 'mov ', 'blt ', 'ble ', 'bgt ', 'bge '
    ]

    used_inst = []
    for line in text.split('\n'):
        for inst in pseudo_list:
            vvv = inst in line
            if vvv:
                if notComment(line, inst):
                    used_inst.append(
                        "the (NON-BAREMODE) pseudoinstruction \"%s\" was used here -> %s\n"
                        % (inst.strip(), line.strip()))
                    runMips = False
    errors.writelines(used_inst)
Ejemplo n.º 2
0
def bannedISA_SyntaxChecks(text: str, errors: FileIO):
    global runMips
    pseudo_list = io.BannedISA

    used_inst = []
    for inst in pseudo_list:
        inst: str
        inst = inst.lower()
        inst = inst.strip() + ' '
        for line in text.split('\n'):
            linelow = line.lower().strip()
            found = inst in linelow
            if found:
                if notComment(linelow, inst):
                    used_inst.append(
                        "the instruction \"%s\" is banned for this assignement but was used here -> %s\n"
                        % (inst.strip(), line.strip()))
                    runMips = False

    errors.writelines(used_inst)