diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 4acafde18..e041901f4 --- a/.gitignore +++ b/.gitignore @@ -408,3 +408,4 @@ dmypy.json # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) +/venv \ No newline at end of file diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Readme.md b/Readme.md old mode 100644 new mode 100755 diff --git a/doc/Intro_ply.pdf b/doc/Intro_ply.pdf new file mode 100755 index 000000000..47618b563 Binary files /dev/null and b/doc/Intro_ply.pdf differ diff --git a/doc/Readme.md b/doc/Readme.md old mode 100644 new mode 100755 index 3b2569f5c..a30716ee9 --- a/doc/Readme.md +++ b/doc/Readme.md @@ -1,33 +1,40 @@ # Documentación -## Readme +**Nombre** | **Grupo** | **Github** +--|--|-- +Laura Brito Guerrero | C412 | [@LauryGirl](https://github.com/LauryGirl) +Sheyla Cruz Castro | C412 | [@sheycc](https://github.com/sheycc) +Ariel Antonio Huerta Martín | C412 | [@huertaariel1](https://github.com/huertaariel1) -Modifique el contenido de este documento para documentar de forma clara y concisa los siguientes aspectos: +# Uso del compilador -- Cómo ejecutar (y compilar si es necesario) su compilador. -- Requisitos adicionales, dependencias, configuración, etc. -- Opciones adicionales que tenga su compilador. +Para utilizar el compilador es necesario instalar todas las dependencias utilizadas por este como +son los paquetes `ply` para la generación del lexer y el parser, y para la ejecución de los tests, `pytest` +y `pytest-ordering`, todo esto se logra ejecutando el fichero `requirements.txt` de la forma: -## Sobre los Equipos de Desarrollo +```bash +pip install -r requirements.txt +``` -Para desarrollar el compilador del lenguaje COOL se trabajará en equipos de 2 o 3 integrantes. El proyecto de Compilación será recogido y evaluado únicamente a través de Github. Es imprescindible tener una cuenta de Github para cada participante, y que su proyecto esté correctamente hosteado en esta plataforma. +Para ejecutar el compilador es necesario correr el archivo ```cool.sh``` ubicado en `/src/` dando como entrada la dirección del archivo a compilar de la siguiente forma: -**⚠️ NOTA**: Debe completar el archivo `team.yml` con los datos correctos de cada miembro de su equipo. +```bash +cd src/ +./cool.sh '../tests/codegen/arith.cl' +``` -## Sobre los Materiales a Entregar +El archivo principal del compilador es `main.py`, módulo que contiene toda la lógica del compilador, si desea ejecutarlo debe pasar como argumento el `path` del fichero **.cl** con código fuente de COOL que se desea compilar, de la siguiente forma: -Para la evaluación del proyecto Ud. debe entregar un informe en formato PDF (`report.pdf`) en esta carpeta, que resuma de manera organizada y comprensible la arquitectura e implementación de su compilador. -El documento no tiene límite de extensión. -En él explicará en más detalle su solución a los problemas que, durante la implementación de cada una de las fases del proceso de compilación, hayan requerido de Ud. especial atención. +```bash +python3 main.py '../tests/codegen/arith.cl' +``` -## Estructura del reporte +Un archivo en el mismo path del código fuente será creado, con el mismo nombre, pero con extensión **.mips** que puede ser ejecutado con **spim**. -Usted es libre de estructurar su reporte escrito como más conveniente le parezca. A continuación le sugerimos algunas secciones que no deberían faltar, aunque puede mezclar, renombrar y organizarlas de la manera que mejor le parezca: +Para ejecutar las pruebas localmente, debe tener instalado `Python 3.7`, `pip` y `make` que normalmente viene incluido en Linux, para hacerlo ejecute los siguientes comandos: -- **Uso del compilador**: detalles sobre las opciones de líneas de comando, si tiene opciones adicionales (e.j., `--ast` genera un AST en JSON, etc.). Básicamente lo mismo que pondrá en este Readme. -- **Arquitectura del compilador**: una explicación general de la arquitectura, en cuántos módulos se divide el proyecto, cuantas fases tiene, qué tipo de gramática se utiliza, y en general, como se organiza el proyecto. Una buena imagen siempre ayuda. -- **Problemas técnicos**: detalles sobre cualquier problema teórico o técnico interesante que haya necesitado resolver de forma particular. - -## Sobre la Fecha de Entrega - -Se realizarán recogidas parciales del proyecto a lo largo del curso. En el Canal de Telegram se anunciará la fecha y requisitos de cada entrega. +```bash +cd src/ +make clean +make test +``` \ No newline at end of file diff --git a/doc/Report.pdf b/doc/Report.pdf new file mode 100644 index 000000000..d004544a0 Binary files /dev/null and b/doc/Report.pdf differ diff --git a/doc/Report.pdf:Zone.Identifier b/doc/Report.pdf:Zone.Identifier new file mode 100644 index 000000000..be537eb44 Binary files /dev/null and b/doc/Report.pdf:Zone.Identifier differ diff --git a/doc/cool-manual.pdf b/doc/cool-manual.pdf old mode 100644 new mode 100755 diff --git a/doc/github-git-cheat-sheet.pdf b/doc/github-git-cheat-sheet.pdf old mode 100644 new mode 100755 diff --git a/doc/team.yml b/doc/team.yml old mode 100644 new mode 100755 index c16162532..60f1f5bf5 --- a/doc/team.yml +++ b/doc/team.yml @@ -1,10 +1,10 @@ members: - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX - - name: Nombre Apellido1 Apellido2 - github: github_id - group: CXXX + - name: Laura Brito Guerrero + github: LauryGirl + group: C412 + - name: Sheyla Cruz Castro + github: sheycc + group: C412 + - name: Ariel Antonio Huerta Martín + github: huertaariel1 + group: C412 diff --git a/img/img1.png b/img/img1.png old mode 100644 new mode 100755 diff --git a/img/img10.png b/img/img10.png old mode 100644 new mode 100755 diff --git a/img/img11.png b/img/img11.png old mode 100644 new mode 100755 diff --git a/img/img12.png b/img/img12.png old mode 100644 new mode 100755 diff --git a/img/img2.png b/img/img2.png old mode 100644 new mode 100755 diff --git a/img/img3.png b/img/img3.png old mode 100644 new mode 100755 diff --git a/img/img4.png b/img/img4.png old mode 100644 new mode 100755 diff --git a/img/img5.png b/img/img5.png old mode 100644 new mode 100755 diff --git a/img/img6.png b/img/img6.png old mode 100644 new mode 100755 diff --git a/img/img7.png b/img/img7.png old mode 100644 new mode 100755 diff --git a/img/img8.png b/img/img8.png old mode 100644 new mode 100755 diff --git a/img/img9.png b/img/img9.png old mode 100644 new mode 100755 diff --git a/requirements.txt b/requirements.txt old mode 100644 new mode 100755 index 9eb0cad1a..cba16ee2f --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ pytest pytest-ordering +ply diff --git a/src/Readme.md b/src/Readme.md old mode 100644 new mode 100755 diff --git a/src/code_generation/__init__.py b/src/code_generation/__init__.py new file mode 100644 index 000000000..1b459b01b --- /dev/null +++ b/src/code_generation/__init__.py @@ -0,0 +1 @@ +from .code_generation import MyCodeGenerator \ No newline at end of file diff --git a/src/code_generation/cil_to_mips.py b/src/code_generation/cil_to_mips.py new file mode 100644 index 000000000..b5da9fcff --- /dev/null +++ b/src/code_generation/cil_to_mips.py @@ -0,0 +1,793 @@ +from semantic.visitor import visitor +from nodes import cil_ast_nodes as CilAST +from nodes import cil_expr_nodes as CilExpr + +class CilToMipsVisitor: + def __init__(self): + self.text = '' + self.data = '' + self.mips_op = { + '+' : 'add', + '-' : 'sub', + '*' : 'mul', + '/' : 'div', + '<' : 'slt', + '<=': 'sle', + '=' : 'seq' + } + self.types = None + self.current_function = None + #Dictionaries for easy handlling of offset + self.attributes_offset = {} + self.methods_offset = {} + self.variables_offset = {} + + #This method adds a line of code to the section of .data + def add_data_code_line(self, line): + self.data += f'{line}\n' + + #This method adds a line of code to the section of .text + def add_text_code_line(self,line): + self.text += f'{line}\n' + + #----------------------------------------Visitor--------------------------------------------# + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(CilAST.ProgramNode) + def visit(self, node): + self.types = node.types + + #Generate and register runtime error + runtime_errors = { + 'div_zero' : 'Runtime Error: Division by zero', + 'dispatch_void' : 'Runtime Error: A dispatch with void', + 'case_void' : 'Runtime Error: A case with void', + 'case_no_match' : 'Runtime Error: Execution of a case statement without a matching branch', + 'heap' : 'Runtime Error: Heap overflow', + 'substr' : 'Runtime Error: Index for substring out of range', + } + for error in runtime_errors: + #Save error message string in data + self.add_data_code_line(f'{error}: .asciiz "{runtime_errors[error]}"') + #Label for error + self.add_text_code_line(f'{error}_error:') + #Print error and stop execution + self.add_text_code_line(f'la $a0, {error}') + self.add_text_code_line('li $v0, 4') + self.add_text_code_line('syscall') + self.add_text_code_line('li $v0, 10') + self.add_text_code_line('syscall') + + #Allocate space for a auxiliar variable to receive the input string + self.add_data_code_line('input_str: .space 2048') + #Store void + self.add_data_code_line('void: .word 0') + + #Visiting all types + for node_type in node.types.values(): + self.visit(node_type) + #Adding all data + for node_data in node.data.keys(): + self.add_data_code_line(f'{node_data}: .asciiz "{node.data[node_data]}"') + #Visiting all functions + for node_code in node.code: + self.visit(node_code) + + #Code mips = .data + .text + mips_code = '.data\n' + self.data + '.text\n' + self.text + return mips_code.strip() + + @visitor.when(CilAST.TypeNode) + def visit(self, node): + #Adding Type name and methods to data + self.add_data_code_line(f'{node.name}_name: .asciiz "{node.name}"') + self.add_data_code_line(f'{node.name}_methods:') + for method in node.methods.values(): + self.add_data_code_line(f'.word {method}') + + #Storing attributes offset for later use + id = 0 + self.attributes_offset.__setitem__(node.name, {}) + for attribute in node.attributes: + self.attributes_offset[node.name][attribute] = 4*id + 16 + id = id + 1 + + #Storing methods offset for later use + id = 0 + self.methods_offset.__setitem__(node.name, {}) + for method in node.methods: + self.methods_offset[node.name][method] = 4*id + id = id + 1 + + @visitor.when(CilAST.FunctionNode) + def visit(self, node): + self.current_function = node + + #Saving function variables offset + self.variables_offset.__setitem__(self.current_function.name, {}) + for id, variable in enumerate(self.current_function.local_vars + self.current_function.params): + self.variables_offset[self.current_function.name][variable.name] = (id + 1) * 4 + + self.add_text_code_line(f'{node.name}:') + #Saving space in the stack for local variables + self.add_text_code_line(f'addi $sp, $sp, {-4 * len(node.local_vars)}') + #Saving return address + self.add_text_code_line('addi $sp, $sp, -4') + self.add_text_code_line('sw $ra, 0($sp)') + + #Visiting all instructions of current function + for instruction in node.instructions: + self.visit(instruction) + + #Recovering return address + self.add_text_code_line('lw $ra, 0($sp)') + #Pop local variables, parameters and return address from the stack + total = 4 * len(node.local_vars) + 4 * len(node.params) + 4 + self.add_text_code_line(f'addi $sp, $sp, {total}') + self.add_text_code_line('jr $ra') + + @visitor.when(CilExpr.ParamDeclarationNode) + def visit(self, node): + pass + + @visitor.when(CilExpr.LocalVariableDeclarationNode) + def visit(self, node): + pass + + @visitor.when(CilExpr.AssignNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#AssignNode {node.dest} = {node.expression}') + + #Get offset of the destination variable + offset = self.variables_offset[self.current_function.name][node.dest] + if node.expression: + if isinstance(node.expression,int): + self.add_text_code_line(f'li $t1, {node.expression}') + else: + #Get offset of expression + expr_offset = self.variables_offset[self.current_function.name][node.expression] + self.add_text_code_line(f'lw $t1, {expr_offset}($sp)') + else: + self.add_text_code_line('la $t1, void') + + self.add_text_code_line(f'sw $t1, {offset}($sp)') + + @visitor.when(CilExpr.UnaryOperatorNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#UnaryOperator {node.op} {node.expr_value}') + + #Get offset of expression value + expr_value_offset = self.variables_offset[self.current_function.name][node.expr_value]\ + + self.add_text_code_line(f'lw $t1, {expr_value_offset}($sp)') + if node.op == '~': + self.add_text_code_line('neg $a0, $t1') + else: + self.add_text_code_line('xor $a0, $t1, 1') + + #Get offset of destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $a0, {offset}($sp)') + + @visitor.when(CilExpr.BinaryOperatorNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#BinaryOperator {node.left} {node.op} {node.right}') + + #Get equivalent instruction in mips for operator in Cil + mips_op = self.mips_op[node.op] + #Get offset of left and right locals variable + left_offset = self.variables_offset[self.current_function.name][node.left] + right_offset = self.variables_offset[self.current_function.name][node.right] + + self.add_text_code_line(f'lw $a0, {left_offset}($sp)') + self.add_text_code_line(f'lw $t1, {right_offset}($sp)') + if node.op == "/": + #Adding jump to error if a div by zero error happens + self.add_text_code_line('beq $t1, 0, div_zero_error') + self.add_text_code_line(f'{mips_op} $a0, $a0, $t1') + #Get offset of destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $a0, {offset}($sp)') + + @visitor.when(CilExpr.GetAttrNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#GetAttr {node.variable} = {node.type}.{node.attr}') + #Getting self address + self_offset = self.variables_offset[self.current_function.name][node.instance] + self.add_text_code_line(f'lw $t0, {self_offset}($sp)') + #Getting attribute + attribute_offset = self.attributes_offset[node.type][node.attr] + self.add_text_code_line(f'lw $t1, {attribute_offset}($t0)') + #Storing attribute in local variable + offset = self.variables_offset[self.current_function.name][node.variable] + self.add_text_code_line(f'sw $t1, {offset}($sp)') + + @visitor.when(CilExpr.SetAttrNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#SetAttr {node.type}{node.attr} = {node.value if node.value else "void"}') + #Getting self address + self_offset = self.variables_offset[self.current_function.name][node.instance] + self.add_text_code_line(f'lw $t0, {self_offset}($sp)') + + if node.value: + value_offset = self.variables_offset[self.current_function.name][node.value] + self.add_text_code_line(f'lw $t1, {value_offset}($sp)') + else: + # attribute not initialized + self.add_text_code_line('la $t1, void') + + #Set attribute in instance + offset = self.attributes_offset[node.type][node.attr] + self.add_text_code_line(f'sw $t1, {offset}($t0)') + + @visitor.when(CilExpr.AllocateNode) + def visit(self, node): + total = len(self.types[node.type].attributes) + 4 + #Comment + self.add_text_code_line(f'#Allocate {node.tag}:tag {node.type}:Class_name {total}:Class_size') + + #Allocate space for Object + self.add_text_code_line(f'li $a0, {total * 4}') + self.add_text_code_line('li $v0, 9') + self.add_text_code_line('syscall') + #If heap error jump to error + self.add_text_code_line('bge $v0, $sp, heap_error') + self.add_text_code_line('move $t0, $v0') + + #Initializing Object layout + #Class tag + self.add_text_code_line(f'li $t1, {node.tag}') + self.add_text_code_line('sw $t1, 0($t0)') + #Class name + self.add_text_code_line(f'la $t1, {node.type}_name') + self.add_text_code_line('sw $t1, 4($t0)') + #Class size + self.add_text_code_line(f'li $t1, {total}') + self.add_text_code_line('sw $t1, 8($t0)') + #Class methods pointer + self.add_text_code_line(f'la $t1, {node.type}_methods') + self.add_text_code_line('sw $t1, 12($t0)') + #Store instance address in destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $t0, {offset}($sp)') + + @visitor.when(CilExpr.TypeOfNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#TypeOf {node.variable}') + #Get offset of variable + obj_offset = self.variables_offset[self.current_function.name][node.variable] + #Getting object address + self.add_text_code_line(f'lw $t0, {obj_offset}($sp)') + #Getting type name from the second position in object layout + self.add_text_code_line('lw $t1, 4($t0)') + #Get offset of destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $t1, {offset}($sp)') + + @visitor.when(CilExpr.CallNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#CallNode {node.method_name}') + + self.add_text_code_line('move $t0, $sp') + #Visit all parameters + for param in node.params: + self.visit(param) + #Jump to the function + self.add_text_code_line(f'jal {node.method_name}') + #Store result in destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $a1, {offset}($sp)') + + @visitor.when(CilExpr.VCallNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#VCall {node.method_name}') + + self.add_text_code_line('move $t0, $sp') + #Visit all parameters + for param in node.params: + self.visit(param) + + #Getting instance address + i_offset = self.variables_offset[self.current_function.name][node.instance] + self.add_text_code_line(f'lw $t1, {i_offset}($t0)') + #Adding jump to error in case of instance is void + self.add_text_code_line('la $t0, void') + self.add_text_code_line('beq $t1, $t0, dispatch_void_error') + #Getting dispatch table address + self.add_text_code_line(f'lw $t2, 12($t1)') + #Getting method address + method_offset = self.methods_offset[node.type][node.method_name] + self.add_text_code_line(f'lw $t3, {method_offset}($t2)') + #Jump to the function + self.add_text_code_line('jal $t3') + #Store result in destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $a1, {offset}($sp)') + + @visitor.when(CilExpr.ArgNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'# Arg {node.arg_name}') + #Get offset of arg + offset = self.variables_offset[self.current_function.name][node.arg_name] + #Save arg in stack + self.add_text_code_line(f'lw $t1, {offset}($t0)') + self.add_text_code_line('addi $sp, $sp, -4') + self.add_text_code_line('sw $t1, 0($sp)') + + @visitor.when(CilExpr.IfGotoNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'# IFGoto {node.variable} -> {node.label}') + #Get variable offset + offset = self.variables_offset[self.current_function.name][node.variable] + self.add_text_code_line(f'lw $t0, {offset}($sp)') + #If condition is true jump to label + self.add_text_code_line('lw $a0, 16($t0)') + self.add_text_code_line(f'bnez $a0, {node.label}') + + @visitor.when(CilExpr.LabelNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#LabelNode {node.label}') + #Declare label + self.add_text_code_line(f'{node.label}:') + + @visitor.when(CilExpr.GotoNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Goto {node.label}') + #Unconditionally branch to the instruction at the label + self.add_text_code_line(f'b {node.label}') + + @visitor.when(CilExpr.ReturnNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Return {node.return_value}') + #If function has return value, put it in $a1 + if node.return_value: + offset = self.variables_offset[self.current_function.name][node.return_value] + self.add_text_code_line(f'lw $a1, {offset}($sp)') + #If not, put 0 in $a1 + else: + self.add_text_code_line('move $a1, $zero') + + @visitor.when(CilExpr.LoadIntNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#LoadInt {node.num}') + #Load integer + self.add_text_code_line(f'li $t0, {node.num}') + #Store result in destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $t0, {offset}($sp)') + + @visitor.when(CilExpr.LoadStrNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#LoadStr {node.msg}') + #Load string + self.add_text_code_line(f'la $t0, {node.msg}') + #Store result in destination local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $t0, {offset}($sp)') + + @visitor.when(CilExpr.LengthNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Length of {node.variable}') + #Get address of variable + offset = self.variables_offset[self.current_function.name][node.variable] + self.add_text_code_line(f'lw $t0, {offset}($sp)') + self.add_text_code_line('lw $t0, 16($t0)') + self.add_text_code_line('li $a0, 0') + #Start loop count + self.add_text_code_line('count:') + #Load current char + self.add_text_code_line('lb $t1, 0($t0)') + #Finish if zero was found + self.add_text_code_line('beqz $t1, end') + #Next char + self.add_text_code_line('addi $t0, $t0, 1') + #Length count + 1 + self.add_text_code_line('addi $a0, $a0, 1') + #Next iteration + self.add_text_code_line('j count') + #End label + self.add_text_code_line('end:') + #Store length count address in variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $a0, {offset}($sp)') + + @visitor.when(CilExpr.ConcatNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Concat {node.str1} {node.str2}') + + #Get offsets of str1, str2, len1, len2 + str1_offset = self.variables_offset[self.current_function.name][node.str1] + str2_offset = self.variables_offset[self.current_function.name][node.str2] + len1_offset = self.variables_offset[self.current_function.name][node.len1] + len2_offset = self.variables_offset[self.current_function.name][node.len2] + + #Reserve space for concatanation + self.add_text_code_line(f'lw $a0, {len1_offset}($sp)') + self.add_text_code_line(f'lw $t0, {len2_offset}($sp)') + self.add_text_code_line('add $a0, $a0, $t0') + #Adding one space more for '\0' + self.add_text_code_line('addi $a0, $a0, 1') + #The beginning of the new reserved address is in $v0 and saved in $t3 + self.add_text_code_line('li $v0, 9') + self.add_text_code_line('syscall') + self.add_text_code_line('bge $v0, $sp, heap_error') + self.add_text_code_line('move $t3, $v0') + #Loading beginning of str1 and str2 address in $t0 and $t1 respectively + self.add_text_code_line(f'lw $t0, {str1_offset}($sp)') + self.add_text_code_line(f'lw $t1, {str2_offset}($sp)') + + #Copy string 1 starting in $t0 to $v0 + self.add_text_code_line('copy_str:') + #Loading current char in str1 + self.add_text_code_line('lb $t2, 0($t0)') + #Storing current char in result + self.add_text_code_line('sb $t2, 0($v0)') + #Jump to concat if zero is found + self.add_text_code_line('beqz $t2, concat_str') + #Next char + self.add_text_code_line('addi $t0, $t0, 1') + #Next availabe byte + self.add_text_code_line('addi $v0, $v0, 1') + #Next iteration + self.add_text_code_line('j copy_str') + + #Concat string 2 starting in $t1 to $v0 + self.add_text_code_line('concat_str:') + #Loading current char in str1 + self.add_text_code_line('lb $t2, 0($t1)') + #Storing current char in result + self.add_text_code_line('sb $t2, 0($v0)') + #Jump to end if zero is found + self.add_text_code_line('beqz $t2, end_concat_str') + #Next char + self.add_text_code_line('addi $t1, $t1, 1') + #Next availabe byte + self.add_text_code_line('addi $v0, $v0, 1') + #Next iteration + self.add_text_code_line('j concat_str') + #End of loop + self.add_text_code_line('end_concat_str:') + #Putting '\0' at the end + self.add_text_code_line('sb $0, ($v0)') + + #Store result string address in local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $t3, {offset}($sp)') + + @visitor.when(CilExpr.SubStrNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Substr {node.str}:string {node.index}:index {node.len}:length') + + #Get offsets of index, str and len + index_offset = self.variables_offset[self.current_function.name][node.index] + str_offset = self.variables_offset[self.current_function.name][node.str] + len_offset = self.variables_offset[self.current_function.name][node.len] + + #Reserve space for substring + self.add_text_code_line(f'lw $a0, {len_offset}($sp)') + #Adding one space more for '\0' + self.add_text_code_line('addi $a0, $a0, 1') + #The beginning of the new reserved address is in $v0 + self.add_text_code_line('li $v0, 9') + self.add_text_code_line('syscall') + self.add_text_code_line('bge $v0, $sp, heap_error') + + #Load str, index, len + self.add_text_code_line(f'lw $t0, {index_offset}($sp)') + self.add_text_code_line(f'lw $t1, {len_offset}($sp)') + self.add_text_code_line(f'lw $t4, {str_offset}($sp)') + self.add_text_code_line('lw $t2, 16($t4)') + + #If index is not valid, jump to error + self.add_text_code_line('bltz $t0, substr_error') + #Reset $a0 + self.add_text_code_line('li $a0, 0') + #Skip first index chars + self.add_text_code_line('skip_char:') + #If we are at char with pos == index, jump to end of loop + self.add_text_code_line('beq $a0, $t0, end_skip') + #Count of char + self.add_text_code_line('addi $a0, $a0, 1') + #Next char + self.add_text_code_line('addi $t2, $t2, 1') + #End of string < index, error + self.add_text_code_line('beq $t2, $zero, substr_error') + #Next iteration + self.add_text_code_line('j skip_char') + #End of loop + self.add_text_code_line('end_skip:') + #Reset $a0 + self.add_text_code_line('li $a0, 0') + #Saving start of substring + self.add_text_code_line('move $t3, $v0') + + #Copy char from string $t2 until length stored in $t1 with initial index $t0 + self.add_text_code_line('substr_copy:') + #If count of char equal length jump to end of loop + self.add_text_code_line('beq $a0, $t1, end_substr_copy') + #Reset $t0 + self.add_text_code_line('li $t0, 0') + #Loading current char in str + self.add_text_code_line('lb $t0, 0($t2)') + #Storing current char in result + self.add_text_code_line('sb $t0, 0($v0)') + #Next char + self.add_text_code_line('addi $t2, $t2, 1') + #End of string < index, error + self.add_text_code_line('beq $t2, $zero, substr_error') + #Next availabe byte + self.add_text_code_line('addi $v0, $v0, 1') + #Char count + 1 + self.add_text_code_line('addi $a0, $a0, 1') + #Next iteration + self.add_text_code_line('j substr_copy') + #End of loop + self.add_text_code_line('end_substr_copy:') + #Putting '\0' at the end + self.add_text_code_line('sb $0, ($v0)') + + #Store result substring address in local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $t3, {offset}($sp)') + + @visitor.when(CilExpr.ReadIntegerNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#ReadInteger {node.line}') + #Read integer + self.add_text_code_line('li $v0, 5') + self.add_text_code_line('syscall') + #Store integer address in local variable + offset = self.variables_offset[self.current_function.name][node.line] + self.add_text_code_line(f'sw $v0, {offset}($sp)') + + @visitor.when(CilExpr.ReadStringNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#ReadString {node.line}') + #Read string + self.add_text_code_line('la $a0, input_str') + self.add_text_code_line('li $a1, 2048') + self.add_text_code_line('li $v0, 8') + self.add_text_code_line('syscall') + + self.add_text_code_line('move $t0, $a0') + #Read char by char until the end of the string + self.add_text_code_line('read_char:') + #Reset $t1 + self.add_text_code_line('li $t1, 0') + #Load current char + self.add_text_code_line('lb $t1, 0($t0)') + #If string final char found jump to the other loop + self.add_text_code_line('beqz $t1, remove_characters_str_end') + #Next char + self.add_text_code_line('addi $t0, $t0, 1') + #Next iteration + self.add_text_code_line('j read_char') + + #Remove last characters if they are '\n' or '\r\n' + self.add_text_code_line('remove_characters_str_end:') + #Move to char at length - 1 + self.add_text_code_line('addi $t0, $t0, -1') + #Reset $t1 + self.add_text_code_line('li $t1, 0') + #Load current char + self.add_text_code_line('lb $t1, 0($t0)') + #Remove char only if it is '\n' + self.add_text_code_line('bne $t1, 10, rcs_end') + #Trying to remove '\r\n' + self.add_text_code_line('sb $0, 0($t0)') + #Move to char at length - 2 + self.add_text_code_line('addi $t0, $t0, -1') + #Reset $t1 + self.add_text_code_line('lb $t1, 0($t0)') + #Load current char + self.add_text_code_line('bne $t1, 13, rcs_end') + #Remove '\r\n' + self.add_text_code_line('sb $0, 0($t0)') + #Next iteration + self.add_text_code_line('j remove_characters_str_end') + #End of loop + self.add_text_code_line('rcs_end:') + + #Store string address in local variable + offset = self.variables_offset[self.current_function.name][node.line] + self.add_text_code_line(f'sw $a0, {offset}($sp)') + + @visitor.when(CilExpr.PrintIntegerNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#PrintInteger {node.line}') + #Print + self.add_text_code_line('li $v0, 1') + #If line it is a value + if isinstance(node.line, int): + self.add_text_code_line(f'li $a0, {node.line}') + #If line it is a variable + else: + #Get offset of variable + offset = self.variables_offset[self.current_function.name][node.line] + self.add_text_code_line(f'lw $a0, {offset}($sp)') + self.add_text_code_line('syscall') + + @visitor.when(CilExpr.PrintStringNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#PrintString {node.line}') + #Get offset of string + offset = self.variables_offset[self.current_function.name][node.line] + self.add_text_code_line(f'lw $a0, {offset}($sp)') + #Print string + self.add_text_code_line('li $v0, 4') + self.add_text_code_line('syscall') + + @visitor.when(CilExpr.AbortNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Abort') + #Abort + self.add_text_code_line('li $v0, 10') + self.add_text_code_line('syscall') + + @visitor.when(CilExpr.CaseNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Case {node.local_expr}') + #Get offset + offset = self.variables_offset[self.current_function.name][node.local_expr] + self.add_text_code_line(f'lw $t0, {offset}($sp)') + self.add_text_code_line('lw $t1, 0($t0)') + self.add_text_code_line('la $a0, void') + #Jump to first case if not void + self.add_text_code_line(f'bne $t1, $a0, {node.first_label}') + #If void jump to error + self.add_text_code_line(f'b case_void_error') + + @visitor.when(CilExpr.ActionNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Action') + #Jump to the corresponding label + self.add_text_code_line(f'blt $t1, {node.tag}, {node.next_label}') + self.add_text_code_line(f'bgt $t1, {node.max_tag}, {node.next_label}') + + @visitor.when(CilExpr.StringEqualsNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#StringEquals {node.str1} = {node.str2}') + #Get offset of str1 and str2 + str1_offset = self.variables_offset[self.current_function.name][node.str1] + str2_offset = self.variables_offset[self.current_function.name][node.str2] + + #Loading beginning of str1 and str2 address in $t1 and $t2 respectively + self.add_text_code_line(f'lw $t1, {str1_offset}($sp)') + self.add_text_code_line(f'lw $t2, {str2_offset}($sp)') + + #Comparing char by char + self.add_text_code_line('compare_str:') + #Reset $t3 + self.add_text_code_line('li $t3, 0') + #Loading current char from str1 + self.add_text_code_line('lb $t3, 0($t1)') + #Reset $t4 + self.add_text_code_line('li $t4, 0') + #Loading current char from str2 + self.add_text_code_line('lb $t4, 0($t2)') + #Compare current bytes + self.add_text_code_line('seq $a0, $t3, $t4') + #Jump to end if current char are differents + self.add_text_code_line('beqz $a0, end_compare_str') + #Jump to end if it is found the str1 final char + self.add_text_code_line('beqz $t3, end_compare_str') + #Jump to end if it is found the str2 final char + self.add_text_code_line('beqz $t4, end_compare_str') + #Next char str1 + self.add_text_code_line('addi $t1, $t1, 1') + #Next char str2 + self.add_text_code_line('addi $t2, $t2, 1') + #Next iteration + self.add_text_code_line('j compare_str') + #End of loop + self.add_text_code_line('end_compare_str:') + + #Store result compare address in local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $a0, {offset}($sp)') + + @visitor.when(CilExpr.IsVoidNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#IsVoid {node.expr}') + #Load void to $t0 + self.add_text_code_line('la $t0, void') + #Get offset + expr_offset = self.variables_offset[self.current_function.name][node.expr] + self.add_text_code_line(f'lw $t1, {expr_offset}($sp)') + #Check if it is void + self.add_text_code_line('seq $a0, $t0, $t1') + #Store result address in local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $a0, {offset}($sp)') + + @visitor.when(CilExpr.CopyNode) + def visit(self, node): + #Comment + self.add_text_code_line(f'#Copy {node.type}') + #Get self address + self_offset = self.variables_offset[self.current_function.name][node.type] + self.add_text_code_line(f'lw $t0, {self_offset}($sp)') + #Get size + self.add_text_code_line('lw $a0, 8($t0)') + self.add_text_code_line('mul $a0, $a0, 4') + self.add_text_code_line('li $v0, 9') + self.add_text_code_line('syscall') + #If heap error jump to error + self.add_text_code_line('bge $v0, $sp, heap_error') + self.add_text_code_line('move $t1, $v0') + + #Reset $a0 + self.add_text_code_line('li $a0, 0') + #Load size + self.add_text_code_line('lw $t3, 8($t0)') + #copy all slots (attributes, methods, size, tag) + self.add_text_code_line('copy_object:') + #Load current object word from source + self.add_text_code_line('lw $t2, 0($t0)') + #Store current object word to destination + self.add_text_code_line('sw $t2, 0($t1)') + #Next word source object + self.add_text_code_line('addi $t0, $t0, 4') + #Next word destination object + self.add_text_code_line('addi $t1, $t1, 4') + #Size count + self.add_text_code_line('addi $a0, $a0, 1') + #If there are still words for copy, jump to copy_object + self.add_text_code_line('blt $a0, $t3, copy_object') + + #Store instance of object address in local variable + offset = self.variables_offset[self.current_function.name][node.local_var] + self.add_text_code_line(f'sw $v0, {offset}($sp)') + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/code_generation/code_generation.py b/src/code_generation/code_generation.py new file mode 100644 index 000000000..4e4115228 --- /dev/null +++ b/src/code_generation/code_generation.py @@ -0,0 +1,13 @@ +from .cil_to_mips import CilToMipsVisitor +from .cool_to_cil import CoolToCilVisitor + +class MyCodeGenerator: + def __init__(self, context): + self.context = context + + def compile(self, cool_ast, scope): + cool_to_cil = CoolToCilVisitor(self.context) + cil_ast = cool_to_cil.visit(cool_ast,scope) + cil_to_mips = CilToMipsVisitor() + mips_code = cil_to_mips.visit(cil_ast) + return mips_code \ No newline at end of file diff --git a/src/code_generation/cool_to_cil.py b/src/code_generation/cool_to_cil.py new file mode 100644 index 000000000..35d9bfdf2 --- /dev/null +++ b/src/code_generation/cool_to_cil.py @@ -0,0 +1,895 @@ +from semantic.tools.scope import Scope +from semantic.tools.var import VariableInfo +from semantic.visitor import visitor +from nodes import ast_nodes as CoolAST +from nodes import cil_ast_nodes as CilAST +from nodes import expr_nodes as CoolExpr +from nodes import cil_expr_nodes as CilExpr +from nodes import operations_nodes as CoolOp + +class CoolToCilVisitor: + def __init__(self, context): + self.context = context + self.types = {} + self.data = {} + self.code = [] + self.current_type = None + self.current_function = None + self.context.set_type_tags() + self.context.set_type_max_tags() + self.label_num = 0 + + def next_label(self): + self.label_num += 1 + new_label = f'label_{self.label_num}' + return new_label + + def register_type(self, type_name): + type_node = CilAST.TypeNode(type_name) + self.types[type_name] = type_node + return type_node + + def register_data(self, msg): + variable_name = f'msg_{len(self.data)}' + self.data[variable_name] = msg + return variable_name + + def register_function(self, function_name): + function_node = CilAST.FunctionNode(function_name,[],[],[]) + self.code.append(function_node) + return function_node + + def register_local_variable(self, variable_name): + local_variable_node = CilExpr.LocalVariableDeclarationNode(variable_name) + self.current_function.local_vars.append(local_variable_node) + return variable_name + + def define_local_variable_in_scope(self, scope, type_name = None, cool_variable_name = None, variable_name = "l" ): + cil_variable_name = f'{variable_name}_{len(self.current_function.local_vars)}' + if type_name != None: + cil_variable_name = f'{type_name}.{variable_name}' + scope.define_cil_local(cool_variable_name,cil_variable_name, None) + self.register_local_variable(cil_variable_name) + return cil_variable_name + + def register_param(self, param_name): + param_node = CilExpr.ParamDeclarationNode(param_name.name) + self.current_function.params.append(param_node) + return param_name.name + + def register_instruction(self, instruction): + self.current_function.instructions.append(instruction) + return instruction + + # ---------------------------------- Visitor ----------------------------------------------- # + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(CoolAST.ProgramNode) + def visit(self, node, scope = None): + scope = Scope() + + #Adding main function + self.current_function = self.register_function('main') + instance = self.define_local_variable_in_scope(scope = scope, variable_name="instance") + result = self.define_local_variable_in_scope(scope = scope, variable_name="result") + tag = self.context.get_type('Main').tag + self.register_instruction(CilExpr.AllocateNode(instance,'Main',tag)) + self.register_instruction(CilExpr.CallNode(result,'Main','Main_init',[CilExpr.ArgNode(instance)])) + self.register_instruction(CilExpr.CallNode(result,'Main','Main.main',[CilExpr.ArgNode(instance)])) + self.register_instruction(CilExpr.ReturnNode(None)) + self.current_function = None + + #Auxiliar strings + self.register_data('Abort called from class ') + self.register_data('\n') + self.data['empty_str'] = '' + + #Adding built-in types in .TYPES section + for t in ['Object', 'Int', 'String', 'Bool', 'IO']: + builtin_type = self.context.get_type(t) + cil_type = self.register_type(t) + cil_type.attributes = [f'{attr.name}' for attr in builtin_type.attributes] + cil_type.methods = {f'{method}':f'{name}.{method}' for name, method in builtin_type.get_all_methods()} + if t in ['Int','String','Bool']: + cil_type.attributes.append('value') + + #-------------------------------------Object---------------------------------------# + #init + self.current_function = self.register_function('Object_init') + self.register_param(VariableInfo('self',None)) + self.register_instruction(CilExpr.ReturnNode(None)) + + #abort + self.current_function = self.register_function('Object.abort') + self.register_param(VariableInfo('self',None)) + msg = self.define_local_variable_in_scope(scope=scope,variable_name='msg') + key_msg = '' + key_eol = '' + for key in self.data.keys(): + if self.data[key] == 'Abort called from class ': + key_msg = key + elif self.data[key] == '\n': + key_eol = key + self.register_instruction(CilExpr.LoadStrNode(msg,key_msg)) + self.register_instruction(CilExpr.PrintStringNode(msg)) + class_name = self.define_local_variable_in_scope(scope=scope,variable_name="class_name") + self.register_instruction(CilExpr.TypeOfNode(class_name,'self')) + self.register_instruction(CilExpr.PrintStringNode(class_name)) + end_of_line = self.define_local_variable_in_scope(scope=scope,variable_name="eol") + self.register_instruction(CilExpr.LoadStrNode(end_of_line,key_eol)) + self.register_instruction(CilExpr.PrintStringNode(end_of_line)) + self.register_instruction(CilExpr.AbortNode()) + + #type_name + self.current_function = self.register_function('Object.type_name') + self.register_param(VariableInfo('self',None)) + class_name = self.define_local_variable_in_scope(scope=scope,variable_name="class_name") + self.register_instruction(CilExpr.TypeOfNode(class_name,'self')) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('String').tag + self.register_instruction(CilExpr.AllocateNode(instance,'String',tag)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(class_name) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,'String','String_init',[arg1,arg2])) + self.register_instruction(CilExpr.ReturnNode(instance)) + + #copy + self.current_function = self.register_function('Object.copy') + self.register_param(VariableInfo('self',None)) + object_copy = self.define_local_variable_in_scope(scope=scope, variable_name='object_copy') + self.register_instruction(CilExpr.CopyNode(object_copy,'self')) + self.register_instruction(CilExpr.ReturnNode(object_copy)) + + #-------------------------------------IO---------------------------------------# + #init + self.current_function = self.register_function('IO_init') + self.register_param(VariableInfo('self',None)) + self.register_instruction(CilExpr.ReturnNode(None)) + + #out_string + self.current_function = self.register_function('IO.out_string') + self.register_param(VariableInfo('self',None)) + self.register_param(VariableInfo('x', None)) + v = self.define_local_variable_in_scope(scope=scope, variable_name="v") + self.register_instruction(CilExpr.GetAttrNode(v,'String','value','x')) + self.register_instruction(CilExpr.PrintStringNode(v)) + self.register_instruction(CilExpr.ReturnNode('self')) + + #out_int + self.current_function = self.register_function('IO.out_int') + self.register_param(VariableInfo('self',None)) + self.register_param(VariableInfo('x', None)) + v = self.define_local_variable_in_scope(scope=scope, variable_name="v") + self.register_instruction(CilExpr.GetAttrNode(v,'Int','value','x')) + self.register_instruction(CilExpr.PrintIntegerNode(v)) + self.register_instruction(CilExpr.ReturnNode('self')) + + #in_string + self.current_function = self.register_function('IO.in_string') + self.register_param(VariableInfo('self',None)) + msg = self.define_local_variable_in_scope(scope=scope,variable_name="read_string") + self.register_instruction(CilExpr.ReadStringNode(msg)) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('String').tag + self.register_instruction(CilExpr.AllocateNode(instance,'String',tag)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(msg) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,'String','String_init',[arg1,arg2])) + self.register_instruction(CilExpr.ReturnNode(instance)) + + #in_int + self.current_function = self.register_function('IO.in_int') + self.register_param(VariableInfo('self',None)) + num = self.define_local_variable_in_scope(scope=scope,variable_name="read_int") + self.register_instruction(CilExpr.ReadIntegerNode(num)) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(instance,'Int',tag)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(num) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,'Int','Int_init',[arg1,arg2])) + self.register_instruction(CilExpr.ReturnNode(instance)) + + #-------------------------------------Int---------------------------------------# + #init + self.current_function = self.register_function('Int_init') + self.register_param(VariableInfo('self',None)) + self.register_param(VariableInfo('v',None)) + self.register_instruction(CilExpr.SetAttrNode('Int','value','v', 'self')) + self.register_instruction(CilExpr.ReturnNode(None)) + + #-------------------------------------String---------------------------------------# + #init + self.current_function = self.register_function('String_init') + self.register_param(VariableInfo('self',None)) + self.register_param(VariableInfo('v',None)) + self.register_instruction(CilExpr.SetAttrNode('String','value','v', 'self')) + self.register_instruction(CilExpr.ReturnNode(None)) + + #length + self.current_function = self.register_function('String.length') + self.register_param(VariableInfo('self',None)) + str_length = self.define_local_variable_in_scope(scope=scope, variable_name="length") + self.register_instruction(CilExpr.LengthNode(str_length,'self')) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(instance,'Int',tag)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(str_length) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,'Int','Int_init',[arg1,arg2])) + self.register_instruction(CilExpr.ReturnNode(instance)) + + #concat + self.current_function = self.register_function('String.concat') + self.register_param(VariableInfo('self',None)) + self.register_param(VariableInfo('s',None)) + str1 = self.define_local_variable_in_scope(scope=scope, variable_name="str1") + self.register_instruction(CilExpr.GetAttrNode(str1,'String','value','self')) + len1 = self.define_local_variable_in_scope(scope=scope, variable_name="len1") + self.register_instruction(CilExpr.CallNode(len1,'String','String.length',[CilExpr.ArgNode('self')])) + str2 = self.define_local_variable_in_scope(scope=scope, variable_name="str2") + self.register_instruction(CilExpr.GetAttrNode(str2,'String','value','s')) + len2 = self.define_local_variable_in_scope(scope=scope, variable_name="len2") + self.register_instruction(CilExpr.CallNode(len2,'String','String.length',[CilExpr.ArgNode('s')])) + ## Get real value from memory address returned by Length + len1_value = self.define_local_variable_in_scope(scope=scope,variable_name="len1_value") + self.register_instruction(CilExpr.GetAttrNode(len1_value,'Int','value',len1)) + len2_value = self.define_local_variable_in_scope(scope=scope,variable_name="len2_value") + self.register_instruction(CilExpr.GetAttrNode(len2_value,'Int','value',len2)) + ## New string, result from concat + result_string = self.define_local_variable_in_scope(scope=scope, variable_name="result_string") + self.register_instruction(CilExpr.ConcatNode(result_string,str1,str2,len1_value,len2_value)) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('String').tag + self.register_instruction(CilExpr.AllocateNode(instance,'String',tag)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(result_string) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,'String','String_init',[arg1,arg2])) + self.register_instruction(CilExpr.ReturnNode(instance)) + + #substr + self.current_function = self.register_function('String.substr') + self.register_param(VariableInfo('self',None)) + self.register_param(VariableInfo('index',None)) + self.register_param(VariableInfo('len',None)) + i_value = self.define_local_variable_in_scope(scope=scope,variable_name="i_value") + self.register_instruction(CilExpr.GetAttrNode(i_value,'Int','value','index')) + l_value = self.define_local_variable_in_scope(scope=scope,variable_name="l_value") + self.register_instruction(CilExpr.GetAttrNode(l_value,'Int','value','len')) + ## New string, result from substr + result_substr = self.define_local_variable_in_scope(scope=scope,variable_name="substr_result") + self.register_instruction(CilExpr.SubStrNode(result_substr,i_value,'self',l_value)) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('String').tag + self.register_instruction(CilExpr.AllocateNode(instance,'String',tag)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(result_substr) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,'String','String_init',[arg1,arg2])) + self.register_instruction(CilExpr.ReturnNode(instance)) + + #-------------------------------------Bool---------------------------------------# + #init + self.current_function = self.register_function('Bool_init') + self.register_param(VariableInfo('self',None)) + self.register_param(VariableInfo('v',None)) + self.register_instruction(CilExpr.SetAttrNode('Bool','value','v', 'self')) + self.register_instruction(CilExpr.ReturnNode(None)) + + #-----------String Equals------------------# + self.current_function = self.register_function('String_equals') + self.register_param(VariableInfo('str1',None)) + self.register_param(VariableInfo('str2',None)) + str1_value = self.define_local_variable_in_scope(scope=scope,variable_name="str1") + self.register_instruction(CilExpr.GetAttrNode(str1_value,'String','value','str1')) + str2_value = self.define_local_variable_in_scope(scope=scope,variable_name="str2") + self.register_instruction(CilExpr.GetAttrNode(str2_value,'String','value','str2')) + equals_result = self.define_local_variable_in_scope(scope=scope,variable_name="result") + self.register_instruction(CilExpr.StringEqualsNode(equals_result,str1_value,str2_value)) + self.register_instruction(CilExpr.ReturnNode(equals_result)) + + #Visit class nodes + for _class in node.classes: + self.visit(_class, scope.create_child()) + + program_node = CilAST.ProgramNode(self.types,self.data,self.code) + return program_node + + @visitor.when(CoolAST.ClassNode) + def visit(self, node, scope): + self.current_type = self.context.get_type(node.name) + cil_type = self.register_type(self.current_type.name) + cil_type.attributes = [f'{attr.name}' for _, attr in self.current_type.get_all_attributes()] + cil_type.methods = {f'{method}':f'{name}.{method}' for name, method in self.current_type.get_all_methods()} + scope.define_cil_local('self',self.current_type.name,self.current_type) + + function_declarations = [] + attribute_declarations = [] + + for feature in node.features: + if isinstance(feature, CoolAST.ClassMethodNode): + function_declarations.append(feature) + else: + attribute_declarations.append(feature) + scope.define_cil_local(feature.name, feature.name, node.name) + + #init + self.current_function = self.register_function(f'{node.name}_init') + self.register_param(VariableInfo('self',None)) + #init parents + result = self.define_local_variable_in_scope(scope=scope,variable_name="result") + self.register_instruction(CilExpr.CallNode(result, node.parent, f'{node.parent}_init',[CilExpr.ArgNode('self')])) + self.register_instruction(CilExpr.ReturnNode(None)) + + for attribute in attribute_declarations: + self.visit(attribute,scope) + + self.current_function = None + + for function in function_declarations: + self.visit(function,scope.create_child()) + + self.current_type = None + + @visitor.when(CoolAST.AttrInitNode) + def visit(self, node, scope): + expression_value = self.visit(node.expression, scope) + instruction = CilExpr.SetAttrNode(self.current_type.name,node.name,expression_value,'self') + self.register_instruction(instruction) + + @visitor.when(CoolAST.AttrDefNode) + def visit(self, node, scope): + instance = None + if node.attr_type in ['Int', 'Bool', 'String']: + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type(node.attr_type).tag + self.register_instruction(CilExpr.AllocateNode(instance,node.attr_type,tag)) + value = self.define_local_variable_in_scope(scope=scope, variable_name='value') + if node.attr_type == 'String': + self.register_instruction(CilExpr.LoadStrNode(value,'empty_str')) + else: + self.register_instruction(CilExpr.LoadIntNode(value,0)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(value) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,node.attr_type,f'{node.attr_type}_init',[arg1,arg2])) + instruction = CilExpr.SetAttrNode(self.current_type.name,node.name,instance,'self') + self.register_instruction(instruction) + + @visitor.when(CoolAST.ClassMethodNode) + def visit(self, node, scope): + cil_method_name = f'{self.current_type.name}.{node.name}' + self.types[self.current_type.name].methods[node.name] = cil_method_name + self.current_function = self.register_function(cil_method_name) + self.register_param(VariableInfo('self',self.current_type)) + for param in node.params: + self.register_param(VariableInfo(param.name,param.param_type)) + value = self.visit(node.expression, scope) + self.register_instruction(CilExpr.ReturnNode(value)) + + @visitor.when(CoolExpr.DynamicCallNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope,variable_name="result") + + expression_value = self.visit(node.obj, scope) + + args = [] + for arg in reversed(node.args): + param = self.visit(arg, scope) + args.append(CilExpr.ArgNode(param)) + args.append(CilExpr.ArgNode(expression_value)) + + dynamic_type = node.obj.expr_type.name + self.register_instruction(CilExpr.VCallNode(result,dynamic_type,node.method,args,expression_value)) + return result + + @visitor.when(CoolExpr.StaticCallNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope,variable_name="result") + + expression_value = self.visit(node.obj, scope) + + args = [] + for arg in reversed(node.args): + param = self.visit(arg, scope) + args.append(CilExpr.ArgNode(param)) + args.append(CilExpr.ArgNode(expression_value)) + + instance = self.define_local_variable_in_scope(scope=scope,variable_name="instance") + tag = self.context.get_type(node.static_type).tag + self.register_instruction(CilExpr.AllocateNode(instance,node.static_type,tag)) + self.register_instruction(CilExpr.VCallNode(result,node.static_type,node.method,args,instance)) + return result + + @visitor.when(CoolExpr.AssignNode) + def visit(self, node, scope): + expression_value = self.visit(node.expression, scope) + self.define_local_variable_in_scope(scope=scope, variable_name="result") + is_param = False + for param in self.current_function.params: + if param.name == node.name: + is_param = True + break + if is_param: + self.register_instruction(CilExpr.AssignNode(node.name,expression_value)) + elif self.current_type.has_attr(node.name): + self.register_instruction(CilExpr.SetAttrNode(self.current_type.name,node.name,expression_value,'self')) + else: + cil_node_name = scope.find_cil_local(node.name) + self.register_instruction(CilExpr.AssignNode(cil_node_name, expression_value)) + + return expression_value + + @visitor.when(CoolExpr.CaseNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + case_expression = self.visit(node.expression,scope) + + label = self.next_label() + label_for_exit = self.next_label() + + self.register_instruction(CilExpr.CaseNode(case_expression,label)) + + #Getting tags of each action + tags_list = [] + act_dict = {} + for action in node.act_list: + tag = self.context.get_type(action.act_type).tag + tags_list.append(tag) + act_dict[tag] = action + + #Sort the tags_list + tags_list.sort() + #For each tag in descending order visit the corresponding action and create the nodes + for tag in reversed(tags_list): + action = act_dict[tag] + self.register_instruction(CilExpr.LabelNode(label)) + label = self.next_label() + act_type = self.context.get_type(action.act_type) + self.register_instruction(CilExpr.ActionNode(case_expression,act_type.tag,act_type.max_tag,label)) + act_scope = scope.create_child() + act_id = self.define_local_variable_in_scope(scope=act_scope,variable_name=action.name, cool_variable_name=action.name) + self.register_instruction(CilExpr.AssignNode(act_id,case_expression)) + act_expression = self.visit(action.body,act_scope) + self.register_instruction(CilExpr.AssignNode(result,act_expression)) + self.register_instruction(CilExpr.GotoNode(label_for_exit)) + + self.register_instruction(CilExpr.LabelNode(label)) + #If not found any match case, goto error + self.register_instruction(CilExpr.GotoNode('case_no_match_error')) + self.register_instruction(CilExpr.LabelNode(label_for_exit)) + return result + + @visitor.when(CoolExpr.ActionNode) + def visit(self, node, scope): + pass + + @visitor.when(CoolExpr.IfNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + predicate_value = self.visit(node.predicate,scope) + then_label = self.next_label() + self.register_instruction(CilExpr.IfGotoNode(predicate_value,then_label)) + else_value = self.visit(node.else_expr,scope) + self.register_instruction(CilExpr.AssignNode(result,else_value)) + end_if_label = self.next_label() + self.register_instruction(CilExpr.GotoNode(end_if_label)) + self.register_instruction(CilExpr.LabelNode(then_label)) + then_value = self.visit(node.then_expr,scope) + self.register_instruction(CilExpr.AssignNode(result,then_value)) + self.register_instruction(CilExpr.LabelNode(end_if_label)) + return result + + @visitor.when(CoolExpr.WhileNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + conditional_label = self.next_label() + body_label = self.next_label() + end_label = self.next_label() + self.register_instruction(CilExpr.LabelNode(conditional_label)) + predicate_value = self.visit(node.predicate,scope) + self.register_instruction(CilExpr.IfGotoNode(predicate_value,body_label)) + self.register_instruction(CilExpr.GotoNode(end_label)) + self.register_instruction(CilExpr.LabelNode(body_label)) + self.visit(node.expression, scope) + self.register_instruction(CilExpr.GotoNode(conditional_label)) + self.register_instruction(CilExpr.LabelNode(end_label)) + self.register_instruction(CilExpr.LoadVoidNode(result)) + return result + + @visitor.when(CoolExpr.BlockNode) + def visit(self, node, scope): + for expr in node.expr_list: + result = self.visit(expr, scope) + return result + + @visitor.when(CoolExpr.LetNode) + def visit(self, node, scope): + let_scope = scope.create_child() + + for var in node.init_list: + self.visit(var, let_scope) + + body_result = self.visit(node.body, let_scope) + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + self.register_instruction(CilExpr.AssignNode(result,body_result)) + return result + + @visitor.when(CoolAST.LetInitNode) + def visit(self, node, scope): + expression_value = self.visit(node.expression, scope) + variable = self.define_local_variable_in_scope(scope=scope,variable_name=node.name,cool_variable_name=node.name) + self.register_instruction(CilExpr.AssignNode(variable,expression_value)) + return variable + + @visitor.when(CoolAST.LetDefNode) + def visit(self, node, scope): + instance = None + if node.let_type in ['Int', 'Bool', 'String']: + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type(node.let_type).tag + self.register_instruction(CilExpr.AllocateNode(instance,node.let_type,tag)) + value = self.define_local_variable_in_scope(scope=scope, variable_name='value') + if node.let_type == 'String': + self.register_instruction(CilExpr.LoadStrNode(value,'empty_str')) + else: + self.register_instruction(CilExpr.LoadIntNode(value,0)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(value) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,node.let_type,f'{node.let_type}_init',[arg1,arg2])) + variable = self.define_local_variable_in_scope(scope=scope,variable_name=node.name,cool_variable_name=node.name) + self.register_instruction(CilExpr.AssignNode(variable,instance)) + return variable + + @visitor.when(CoolExpr.NewNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope,variable_name="result") + init = self.define_local_variable_in_scope(scope=scope,variable_name="init") + + if node.new_type == 'SELF_TYPE': + tag = self.current_type.tag + name = self.current_type.name + self.register_instruction(CilExpr.AllocateNode(result,name,tag)) + self.register_instruction(CilExpr.CallNode(init,name,f'{name}_init',[result])) + else : + tag = self.context.get_type(node.new_type).tag + self.register_instruction(CilExpr.AllocateNode(result,node.new_type,tag)) + self.register_instruction(CilExpr.CallNode(init,self.current_type.name,f'{node.new_type}_init',[CilExpr.ArgNode(result)])) + + return result + + @visitor.when(CoolExpr.IsVoidNode) + def visit(self, node, scope): + expression_value = self.visit(node.expression, scope) + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + self.register_instruction(CilExpr.IsVoidNode(result,expression_value)) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('Bool').tag + self.register_instruction(CilExpr.AllocateNode(instance,'Bool',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name='init') + arg1 = CilExpr.ArgNode(result) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,'Bool','Bool_init',[arg1,arg2])) + self.register_instruction(CilExpr.ReturnNode(instance)) + return instance + + @visitor.when(CoolOp.SumNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + left = self.define_local_variable_in_scope(scope=scope, variable_name="left") + right = self.define_local_variable_in_scope(scope=scope, variable_name="right") + + left_value = self.visit(node.left, scope) + right_value = self.visit(node.right, scope) + + self.register_instruction(CilExpr.GetAttrNode(left,node.left.expr_type.name,"value",left_value)) + self.register_instruction(CilExpr.GetAttrNode(right,node.right.expr_type.name,"value",right_value)) + self.register_instruction(CilExpr.BinaryOperatorNode(op,left,"+",right)) + + #Allocate Int result + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(result,'Int',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Int','Int_init',[arg1,arg2])) + + return result + + @visitor.when(CoolOp.SubNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + left = self.define_local_variable_in_scope(scope=scope, variable_name="left") + right = self.define_local_variable_in_scope(scope=scope, variable_name="right") + + left_value = self.visit(node.left, scope) + right_value = self.visit(node.right, scope) + + self.register_instruction(CilExpr.GetAttrNode(left,node.left.expr_type.name,"value",left_value)) + self.register_instruction(CilExpr.GetAttrNode(right,node.right.expr_type.name,"value",right_value)) + self.register_instruction(CilExpr.BinaryOperatorNode(op,left,"-",right)) + + #Allocate Int result + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(result,'Int',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Int','Int_init',[arg1,arg2])) + + return result + + @visitor.when(CoolOp.MultNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + left = self.define_local_variable_in_scope(scope=scope, variable_name="left") + right = self.define_local_variable_in_scope(scope=scope, variable_name="right") + + left_value = self.visit(node.left, scope) + right_value = self.visit(node.right, scope) + + self.register_instruction(CilExpr.GetAttrNode(left,node.left.expr_type.name,"value",left_value)) + self.register_instruction(CilExpr.GetAttrNode(right,node.right.expr_type.name,"value",right_value)) + self.register_instruction(CilExpr.BinaryOperatorNode(op,left,"*",right)) + + #Allocate Int result + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(result,'Int',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Int','Int_init',[arg1,arg2])) + + return result + + @visitor.when(CoolOp.DivNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + left = self.define_local_variable_in_scope(scope=scope, variable_name="left") + right = self.define_local_variable_in_scope(scope=scope, variable_name="right") + + left_value = self.visit(node.left, scope) + right_value = self.visit(node.right, scope) + + self.register_instruction(CilExpr.GetAttrNode(left,node.left.expr_type.name,"value",left_value)) + self.register_instruction(CilExpr.GetAttrNode(right,node.right.expr_type.name,"value",right_value)) + self.register_instruction(CilExpr.BinaryOperatorNode(op,left,"/",right)) + + #Allocate Int result + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(result,'Int',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Int','Int_init',[arg1,arg2])) + + return result + + @visitor.when(CoolOp.LessEqualNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + left = self.define_local_variable_in_scope(scope=scope, variable_name="left") + right = self.define_local_variable_in_scope(scope=scope, variable_name="right") + + left_value = self.visit(node.left, scope) + right_value = self.visit(node.right, scope) + + self.register_instruction(CilExpr.GetAttrNode(left,node.left.expr_type.name,"value",left_value)) + self.register_instruction(CilExpr.GetAttrNode(right,node.right.expr_type.name,"value",right_value)) + self.register_instruction(CilExpr.BinaryOperatorNode(op,left,"<=",right)) + + #Allocate Bool result + tag = self.context.get_type('Bool').tag + self.register_instruction(CilExpr.AllocateNode(result,'Bool',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Bool','Bool_init',[arg1,arg2])) + + return result + + @visitor.when(CoolOp.LessNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + left = self.define_local_variable_in_scope(scope=scope, variable_name="left") + right = self.define_local_variable_in_scope(scope=scope, variable_name="right") + + left_value = self.visit(node.left, scope) + right_value = self.visit(node.right, scope) + + self.register_instruction(CilExpr.GetAttrNode(left,node.left.expr_type.name,"value",left_value)) + self.register_instruction(CilExpr.GetAttrNode(right,node.right.expr_type.name,"value",right_value)) + self.register_instruction(CilExpr.BinaryOperatorNode(op,left,"<",right)) + + #Allocate Bool result + tag = self.context.get_type('Bool').tag + self.register_instruction(CilExpr.AllocateNode(result,'Bool',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Bool','Bool_init',[arg1,arg2])) + + return result + + @visitor.when(CoolOp.LogicNotNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + expression = self.define_local_variable_in_scope(scope=scope) + + expression_value = self.visit(node.expression, scope) + + self.register_instruction(CilExpr.GetAttrNode(expression,node.expression.expr_type.name,"value",expression_value)) + self.register_instruction(CilExpr.UnaryOperatorNode(op,"~",expression)) + + #Allocate Int result + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(result,'Int',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Int','Int_init',[arg1,arg2])) + + return result + + @visitor.when(CoolOp.NotNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + expression = self.define_local_variable_in_scope(scope=scope) + + expression_value = self.visit(node.expression, scope) + + self.register_instruction(CilExpr.GetAttrNode(expression,node.expression.expr_type.name,"value",expression_value)) + self.register_instruction(CilExpr.UnaryOperatorNode(op,"not",expression)) + + #Allocate Bool result + tag = self.context.get_type('Bool').tag + self.register_instruction(CilExpr.AllocateNode(result,'Bool',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Bool','Bool_init',[arg1,arg2])) + + return result + + @visitor.when(CoolExpr.EqualsNode) + def visit(self, node, scope): + result = self.define_local_variable_in_scope(scope=scope, variable_name="result") + op = self.define_local_variable_in_scope(scope=scope, variable_name="op") + left = self.define_local_variable_in_scope(scope=scope, variable_name="left") + right = self.define_local_variable_in_scope(scope=scope, variable_name="right") + + left_value = self.visit(node.left, scope) + right_value = self.visit(node.right, scope) + + if node.left.expr_type.name == "String": + arg1 = CilExpr.ArgNode(right_value) + arg2 = CilExpr.ArgNode(left_value) + self.register_instruction(CilExpr.CallNode(op,'String','String_equals',[arg1,arg2])) + + #Allocate Bool result + tag = self.context.get_type('Bool').tag + self.register_instruction(CilExpr.AllocateNode(result,'Bool',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Bool','Bool_init',[arg1,arg2])) + + return result + + elif node.left.expr_type.name in ['Int', 'Bool']: + self.register_instruction(CilExpr.GetAttrNode(left,node.left.expr_type.name,"value",left_value)) + self.register_instruction(CilExpr.GetAttrNode(right,node.right.expr_type.name,"value",right_value)) + + else: + self.register_instruction(CilExpr.AssignNode(left,left_value)) + self.register_instruction(CilExpr.AssignNode(right,right_value)) + + self.register_instruction(CilExpr.BinaryOperatorNode(op,left,"=",right)) + + #Allocate Bool result + tag = self.context.get_type('Bool').tag + self.register_instruction(CilExpr.AllocateNode(result,'Bool',tag)) + init = self.define_local_variable_in_scope(scope=scope, variable_name="init") + arg1 = CilExpr.ArgNode(op) + arg2 = CilExpr.ArgNode(result) + self.register_instruction(CilExpr.CallNode(init,'Bool','Bool_init',[arg1,arg2])) + + return result + + @visitor.when(CoolExpr.IdNode) + def visit(self, node, scope): + is_param = False + for param in self.current_function.params: + if param.name == node.name: + is_param = True + break + if is_param: + return node.name + elif self.current_type.has_attr(node.name): + result = self.define_local_variable_in_scope(scope=scope, variable_name=node.name, type_name=self.current_type.name) + self.register_instruction(CilExpr.GetAttrNode(result,self.current_type.name,node.name,'self')) + return result + else: + return scope.find_cil_local(node.name) + + @visitor.when(CoolExpr.IntegerNode) + def visit(self, node, scope): + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('Int').tag + self.register_instruction(CilExpr.AllocateNode(instance,'Int',tag)) + value = self.define_local_variable_in_scope(scope=scope, variable_name='value') + self.register_instruction(CilExpr.LoadIntNode(value,node.value)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(value) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,"Int",'Int_init',[arg1,arg2])) + return instance + + @visitor.when(CoolExpr.BooleanNode) + def visit(self, node, scope): + boolean = 0 + if str(node.value) == "true": + boolean = 1 + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('Bool').tag + self.register_instruction(CilExpr.AllocateNode(instance,'Bool',tag)) + value = self.define_local_variable_in_scope(scope=scope, variable_name='value') + self.register_instruction(CilExpr.LoadIntNode(value,boolean)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(value) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,"Bool",'Bool_init',[arg1,arg2])) + return instance + + @visitor.when(CoolExpr.StringNode) + def visit(self, node, scope): + str_name = "" + for s in self.data.keys(): + if self.data[s] == node.value: + str_name = s + break + if str_name == "": + str_name = self.register_data(node.value) + + value = self.define_local_variable_in_scope(scope=scope) + self.register_instruction(CilExpr.LoadStrNode(value,str_name)) + instance = self.define_local_variable_in_scope(scope=scope, variable_name="instance") + tag = self.context.get_type('String').tag + self.register_instruction(CilExpr.AllocateNode(instance,'String',tag)) + result = self.define_local_variable_in_scope(scope=scope, variable_name='result') + arg1 = CilExpr.ArgNode(value) + arg2 = CilExpr.ArgNode(instance) + self.register_instruction(CilExpr.CallNode(result,"String",'String_init',[arg1,arg2])) + return instance + + + + + + + + + + + + + + + + diff --git a/src/coolc.sh b/src/coolc.sh index 3088de4f9..7bd4218b3 100755 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -4,8 +4,8 @@ INPUT_FILE=$1 OUTPUT_FILE=${INPUT_FILE:0: -2}mips # Si su compilador no lo hace ya, aquí puede imprimir la información de contacto -echo "LINEA_CON_NOMBRE_Y_VERSION_DEL_COMPILADOR" # TODO: Recuerde cambiar estas -echo "Copyright (c) 2019: Nombre1, Nombre2, Nombre3" # TODO: líneas a los valores correctos +echo "Cool Compiler version 1.0" # TODO: Recuerde cambiar estas +echo "Copyright (c) 2021: Laura Brito Guerrero, Sheyla Cruz Castro, Ariel Antonio Huerta Martín" # TODO: líneas a los valores correctos # Llamar al compilador -echo "Compiling $INPUT_FILE into $OUTPUT_FILE" +python3 main.py $INPUT_FILE diff --git a/src/lexer/__init__.py b/src/lexer/__init__.py new file mode 100644 index 000000000..f19d07a61 --- /dev/null +++ b/src/lexer/__init__.py @@ -0,0 +1,2 @@ +from .error_token import ErrorToken +from .lexer import MyLexer diff --git a/src/lexer/error_token.py b/src/lexer/error_token.py new file mode 100644 index 000000000..dac7fcc37 --- /dev/null +++ b/src/lexer/error_token.py @@ -0,0 +1,15 @@ +from ply.lex import LexToken + +class ErrorToken(LexToken): + def __init__(self, msg, line, column): + super().__init__() + self.type = 'LexicographicError' + self.value = msg + self.line = line + self.column = column + + def __str__(self): + return f'({self.line}, {self.column}) - {self.type}: {self.value}' + + def __repr__(self): + return str(self) \ No newline at end of file diff --git a/src/lexer/lexer.py b/src/lexer/lexer.py new file mode 100644 index 000000000..fd77cd55a --- /dev/null +++ b/src/lexer/lexer.py @@ -0,0 +1,262 @@ +import ply.lex as lex +import sys +from .error_token import ErrorToken + +class MyLexer(): + def __init__(self, debug=False, lextab="lextab", optimize="False", outputdir="", debuglog=None, errorlog=None): + self.build( + debug=debug, lextab=lextab, optimize=optimize, outputdir=outputdir, debuglog=debuglog, errorlog=errorlog) + + # Build the lexer + def build(self, **kwargs): + self.tokens = self.get_basic_tok() + list(self.get_reserved_keywds().values()) + list(self.get_builtin_types().values()) + self.reserved = list(self.get_reserved_keywds().values()) + list(self.get_builtin_types().values()) + self.errors = [] + self.lexer = lex.lex(module=self, **kwargs) + + # The tokens list + def get_basic_tok(self): + return [ + "INTEGER", + "STRING", + "BOOLEAN", + "PLUS", + "MINUS", + "MULTIPLY", + "DIVIDE", + "EQUAL", + "LESS", + "LESSEQ", + "ASSIGN", + "NOX", + "ID", + "TYPE", + "LPAREN", + "RPAREN", + "LBRACE", + "RBRACE", + "COLON", + "SEMIC", + "COMMA", + "DOT", + "ARROBA", + "ARROW", + "LexicographicError" + ] + + def get_reserved_keywds(self): + return { + "class": "CLASS", + "case": "CASE", + "esac": "ESAC", + "let": "LET", + "in": "IN", + "inherits": "INHERITS", + "isvoid": "ISVOID", + "new": "NEW", + "if": "IF", + "else": "ELSE", + "then": "THEN", + "fi": "FI", + "while": "WHILE", + "loop": "LOOP", + "pool": "POOL", + "true": "TRUE", + "false": "FALSE", + "not": "NOT", + "of": "OF" + } + + def get_builtin_types(self): + return { + "Object": "OBJECT_TYPE", + "Int": "INT_TYPE", + "String": "STRING_TYPE", + "Bool": "BOOL_TYPE", + "SELF_TYPE": "SELF_TYPE", + "Main": "MAIN_TYPE", + "IO": "IO_TYPE" + } + + # Regular expression rules for simple tokens + t_PLUS = r'\+' + t_MINUS = r'\-' + t_MULTIPLY = r'\*' + t_DIVIDE = r'\/' + t_EQUAL = r'\=' + t_LESS = r'\<' + t_LESSEQ = r'\<\=' + t_ASSIGN = r'\<\-' + t_NOX = r'~' + t_LPAREN = r'\(' + t_RPAREN = r'\)' + t_LBRACE = r'\{' + t_RBRACE = r'\}' + t_COLON = r'\:' + t_SEMIC = r'\;' + t_COMMA = r'\,' + t_DOT = r'\.' + t_ARROBA = r'\@' + t_ARROW = r'\=\>' + t_ignore = ' \t\r\f' + t_ignore_LINE_COMMENT = r"\-\-[^\n]*" + + # Regular expression rules with some action code + def t_INTEGER(self, tok): + r"\d+" + tok.value = int(tok.value) + return tok + + def t_ID(self, tok): + r"[a-z][a-zA-Z_0-9]*" + if self.get_reserved_keywds().__contains__(str.lower(tok.value)): + tok.value = str.lower(tok.value) + tok.type = self.get_reserved_keywds()[str.lower(tok.value)] + else: + tok.type = "ID" + return tok + + def t_TYPE(self, tok): + r"[A-Z][a-zA-Z_0-9]*" + if self.get_reserved_keywds().__contains__(str.lower(tok.value)): + tok.value = str.lower(tok.value) + tok.type = self.get_reserved_keywds()[str.lower(tok.value)] + else: + tok.type = "TYPE" + return tok + + def t_newline(self, tok): + r"\n+" + tok.lexer.lineno += len(tok.value) + + states = ( + ('STRING', 'exclusive'), + ('COMMENT', 'exclusive') + ) + + # String Matching State + t_STRING_ignore = '' + + def t_STRING_newline(self, tok): + r"\n" + tok.lexer.lineno += 1 + if not tok.lexer.backslashed: + error = ErrorToken(f'Unterminated string constant', tok.lineno, self.find_col(tok.lexer.lexdata,tok.lexpos)) + self.errors.append(error) + tok.lexer.pop_state() + return error + else: + tok.lexer.backslashed = False + + def t_start_string_state(self, tok): + r"\"" + tok.lexer.push_state("STRING") + tok.lexer.backslashed = False + tok.lexer.string = "" + + def t_STRING_end(self, tok): + r"\"" + if not tok.lexer.backslashed: + tok.lexer.pop_state() + tok.value = tok.lexer.string + tok.type = "STRING" + return tok + else: + tok.lexer.string += '"' + tok.lexer.backslashed = False + + def t_STRING_null(self, tok): + r"\0" + error = ErrorToken(f'String contains null character', tok.lineno, self.find_col(tok.lexer.lexdata,tok.lexpos)) + self.errors.append(error) + + def t_STRING_anything(self, tok): + r"[^\n]" + if tok.lexer.backslashed: + if tok.value == 'b': + tok.lexer.string += '\b' + elif tok.value == 'n': + tok.lexer.string += '\n' + elif tok.value == 'f': + tok.lexer.string += '\f' + elif tok.value == 't': + tok.lexer.string += '\t' + elif tok.value == '\\': + tok.lexer.string += '\\' + else: + tok.lexer.string += tok.value + tok.lexer.backslashed = False + else: + if tok.value != '\\': + tok.lexer.string += tok.value + else: + tok.lexer.backslashed = True + + def t_STRING_error(self, tok): + error = ErrorToken(f'{tok.value[0]} in string constant', tok.lineno, self.find_col(tok.lexer.lexdata,tok.lexpos)) + self.errors.append(error) + return error + + def t_STRING_eof(self, tok): + error = ErrorToken(f'EOF in string constant', tok.lineno, self.find_col(tok.lexer.lexdata,tok.lexpos)) + tok.lexer.pop_state() + self.errors.append(error) + return error + + # Comments Multiline State + t_COMMENT_ignore = '' + + def t_COMMENT_newline(self, tok): + r"\n+" + tok.lexer.lineno += len(tok.value) + + def t_start_comment_state(self, tok): + r'\(\*' + tok.lexer.push_state("COMMENT") + tok.lexer.comment_count = 0 + + def t_COMMENT_end(self, tok): + r'\*\)' + if tok.lexer.comment_count == 0: + tok.lexer.pop_state() + else: + tok.lexer.comment_count -= 1 + + def t_COMMENT_another(self, tok): + r'\(\*' + tok.lexer.comment_count += 1 + + def t_COMMENT_error(self, tok): + tok.lexer.skip(1) + + def t_COMMENT_eof(self, tok): + error = ErrorToken(f'EOF in comment', tok.lineno, self.find_col(tok.lexer.lexdata,tok.lexpos)) + tok.lexer.pop_state() + self.errors.append(error) + return error + + # Error handling + def t_error(self, tok): + error = ErrorToken(f'ERROR "{tok.value[0]}"', tok.lineno, self.find_col(tok.lexer.lexdata,tok.lexpos)) + tok.lexer.skip(1) + self.errors.append(error) + return error + + def find_col(self, input, lexpos): + _start = input.rfind('\n', 0, lexpos) + 1 + return (lexpos - _start) + 1 + + def token(self): + return self.lexer.token() + + def tokenize(self, _cool_program): + self.lexer.input(_cool_program) + _tokens = [] + while True: + _tok = self.token() + if not _tok: + raise Exception() + _tokens.append(_tok) + return(_tokens) + + \ No newline at end of file diff --git a/src/lextab.py b/src/lextab.py new file mode 100644 index 000000000..65b4ff945 --- /dev/null +++ b/src/lextab.py @@ -0,0 +1,10 @@ +# lextab.py. This file automatically created by PLY (version 3.11). Don't edit! +_tabversion = '3.10' +_lextokens = set(('ARROBA', 'ARROW', 'ASSIGN', 'BOOLEAN', 'BOOL_TYPE', 'CASE', 'CLASS', 'COLON', 'COMMA', 'DIVIDE', 'DOT', 'ELSE', 'EQUAL', 'ESAC', 'FALSE', 'FI', 'ID', 'IF', 'IN', 'INHERITS', 'INTEGER', 'INT_TYPE', 'IO_TYPE', 'ISVOID', 'LBRACE', 'LESS', 'LESSEQ', 'LET', 'LOOP', 'LPAREN', 'LexicographicError', 'MAIN_TYPE', 'MINUS', 'MULTIPLY', 'NEW', 'NOT', 'NOX', 'OBJECT_TYPE', 'OF', 'PLUS', 'POOL', 'RBRACE', 'RPAREN', 'SELF_TYPE', 'SEMIC', 'STRING', 'STRING_TYPE', 'THEN', 'TRUE', 'TYPE', 'WHILE')) +_lexreflags = 64 +_lexliterals = '' +_lexstateinfo = {'INITIAL': 'inclusive', 'STRING': 'exclusive', 'COMMENT': 'exclusive'} +_lexstatere = {'INITIAL': [('(?P\\d+)|(?P[a-z][a-zA-Z_0-9]*)|(?P[A-Z][a-zA-Z_0-9]*)|(?P\\n+)|(?P\\")|(?P\\(\\*)|(?P\\-\\-[^\\n]*)|(?P\\=\\>)|(?P\\<\\-)|(?P\\<\\=)|(?P\\@)|(?P\\:)|(?P\\,)|(?P\\/)|(?P\\.)|(?P\\=)|(?P\\{)|(?P\\<)|(?P\\()|(?P\\-)|(?P\\*)|(?P\\+)|(?P\\})|(?P\\))|(?P\\;)|(?P~)', [None, ('t_INTEGER', 'INTEGER'), ('t_ID', 'ID'), ('t_TYPE', 'TYPE'), ('t_newline', 'newline'), ('t_start_string_state', 'start_string_state'), ('t_start_comment_state', 'start_comment_state'), (None, None), (None, 'ARROW'), (None, 'ASSIGN'), (None, 'LESSEQ'), (None, 'ARROBA'), (None, 'COLON'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'DOT'), (None, 'EQUAL'), (None, 'LBRACE'), (None, 'LESS'), (None, 'LPAREN'), (None, 'MINUS'), (None, 'MULTIPLY'), (None, 'PLUS'), (None, 'RBRACE'), (None, 'RPAREN'), (None, 'SEMIC'), (None, 'NOX')])], 'STRING': [('(?P\\n)|(?P\\")|(?P\\0)|(?P[^\\n])', [None, ('t_STRING_newline', 'newline'), ('t_STRING_end', 'end'), ('t_STRING_null', 'null'), ('t_STRING_anything', 'anything')])], 'COMMENT': [('(?P\\n+)|(?P\\*\\))|(?P\\(\\*)', [None, ('t_COMMENT_newline', 'newline'), ('t_COMMENT_end', 'end'), ('t_COMMENT_another', 'another')])]} +_lexstateignore = {'COMMENT': '', 'STRING': '', 'INITIAL': ' \t\r\x0c'} +_lexstateerrorf = {'COMMENT': 't_COMMENT_error', 'STRING': 't_STRING_error', 'INITIAL': 't_error'} +_lexstateeoff = {'COMMENT': 't_COMMENT_eof', 'STRING': 't_STRING_eof'} diff --git a/src/main.py b/src/main.py new file mode 100644 index 000000000..dde01645d --- /dev/null +++ b/src/main.py @@ -0,0 +1,44 @@ +from code_generation import MyCodeGenerator +from lexer import MyLexer +from parser import MyParser +from semantic import MySemanticAnalyzer +import sys + +if __name__ == "__main__": + + _mylexer = MyLexer() + _myparser = MyParser() + + if len(sys.argv) > 1: + _file = sys.argv[1] + _cool_program = open(_file, encoding="utf-8").read() + try: + _mylexer_result = _mylexer.tokenize(_cool_program) + except: + pass + + if _mylexer.errors: + print(_mylexer.errors[0]) + exit(1) + try: + myAst = _myparser.parse(_cool_program) + except: + pass + + if _myparser.errors: + print(_myparser.errors[0]) + exit(1) + + # SemanticTODO + semantic_analyzer = MySemanticAnalyzer(myAst) + context, scope = semantic_analyzer.analyze() + + for e in semantic_analyzer.errors: + print(e) + exit(1) + + # CodeGenTODO + code_generator = MyCodeGenerator(context=context) + mips_code = code_generator.compile(myAst, scope) + with open(f'{sys.argv[1][:-3]}.mips','w') as f: + f.write(f'{mips_code}') diff --git a/src/makefile b/src/makefile old mode 100644 new mode 100755 diff --git a/src/nodes/__init__.py b/src/nodes/__init__.py new file mode 100644 index 000000000..b8f0abecb --- /dev/null +++ b/src/nodes/__init__.py @@ -0,0 +1,4 @@ +from .ast_nodes import * +from .expr_nodes import * +from .operations_nodes import * + diff --git a/src/nodes/ast_nodes.py b/src/nodes/ast_nodes.py new file mode 100644 index 000000000..c07728de6 --- /dev/null +++ b/src/nodes/ast_nodes.py @@ -0,0 +1,69 @@ +class AST: + def __init__(self): + pass + +class ProgramNode(AST): + def __init__(self, classes): + super(ProgramNode, self).__init__() + self.classes = classes + +class ClassNode(AST): + def __init__(self, name, parent, features, row , col): + super(ClassNode, self).__init__() + self.name = name + self.parent = parent + self.features = features + self.row = row + self.col = col + +class ClassMethodNode(AST): + def __init__(self, name, params, expression, return_type, row , col): + super(ClassMethodNode, self).__init__() + self.name = name + self.params = params + self.expression = expression + self.return_type = return_type + self.row = row + self.col = col + +class AttrInitNode(AST): + def __init__(self, name, attr_type, expression, row , col): + super(AttrInitNode, self).__init__() + self.name = name + self.attr_type = attr_type + self.expression = expression + self.row = row + self.col = col + +class AttrDefNode(AST): + def __init__(self, name, attr_type, row , col): + super(AttrDefNode, self).__init__() + self.name = name + self.attr_type = attr_type + self.row = row + self.col = col + +class LetInitNode(AST): + def __init__(self, name, let_type, expression, row , col): + super(LetInitNode, self).__init__() + self.name = name + self.let_type = let_type + self.expression = expression + self.row = row + self.col = col + +class LetDefNode(AST): + def __init__(self, name, let_type, row , col): + super(LetDefNode, self).__init__() + self.name = name + self.let_type = let_type + self.row = row + self.col = col + +class FormalParamNode(AST): + def __init__(self, name, param_type, row , col): + super(FormalParamNode, self).__init__() + self.name = name + self.param_type = param_type + self.row = row + self.col = col \ No newline at end of file diff --git a/src/nodes/cil_ast_nodes.py b/src/nodes/cil_ast_nodes.py new file mode 100644 index 000000000..61a5f69d5 --- /dev/null +++ b/src/nodes/cil_ast_nodes.py @@ -0,0 +1,25 @@ +class CilAST: + def __init__(self): + pass + +class ProgramNode(CilAST): + def __init__(self, types, data, code): + super(ProgramNode, self).__init__() + self.types = types + self.data = data + self.code = code + +class TypeNode(CilAST): + def __init__(self, name): + super(TypeNode, self).__init__() + self.name = name + self.attributes = [] + self.methods = {} + +class FunctionNode(CilAST): + def __init__(self, name, params = [], local_vars = [], instructions = []): + super(FunctionNode, self).__init__() + self.name = name + self.params = params + self.local_vars = local_vars + self.instructions = instructions \ No newline at end of file diff --git a/src/nodes/cil_expr_nodes.py b/src/nodes/cil_expr_nodes.py new file mode 100644 index 000000000..beaeb7ebe --- /dev/null +++ b/src/nodes/cil_expr_nodes.py @@ -0,0 +1,223 @@ +from .cil_ast_nodes import CilAST + +class CilExprNode(CilAST): + def __init__(self): + super(CilExprNode, self).__init__() + +class ParamDeclarationNode(CilExprNode): + def __init__(self, name): + super(ParamDeclarationNode, self).__init__() + self.name = name + +class LocalVariableDeclarationNode(CilExprNode): + def __init__(self, name): + super(LocalVariableDeclarationNode, self).__init__() + self.name = name + +class AssignNode(CilExprNode): + def __init__(self, dest, expression): + super(AssignNode, self).__init__() + self.dest = dest + self.expression = expression + +class UnaryOperatorNode(CilExprNode): + def __init__(self, local_var, op, expr_value): + super(UnaryOperatorNode, self).__init__() + self.local_var = local_var + self.op = op + self.expr_value = expr_value + +class BinaryOperatorNode(CilExprNode): + def __init__(self, local_var, left, op, right): + super(BinaryOperatorNode, self).__init__() + self.local_var = local_var + self.left = left + self.op = op + self.right = right + +class GetAttrNode(CilExprNode): + def __init__(self, variable, type, attr, instance): + super(GetAttrNode, self).__init__() + self.variable = variable + self.type = type + self.attr = attr + self.instance = instance + +class SetAttrNode(CilExprNode): + def __init__(self, type, attr, value, instance): + super(SetAttrNode, self).__init__() + self.type = type + self.attr = attr + self.value = value + self.instance = instance + +class AllocateNode(CilExprNode): + def __init__(self, local_var, type, tag): + super(AllocateNode, self).__init__() + self.local_var = local_var + self.type = type + self.tag = tag + +class TypeOfNode(CilExprNode): + def __init__(self, local_var, variable): + super(TypeOfNode, self).__init__() + self.local_var = local_var + self.variable = variable + +class CallNode(CilExprNode): + def __init__(self, local_var, type, method_name, params): + super(CallNode, self).__init__() + self.local_var = local_var + self.method_name = method_name + self.params = params + self.type = type + +class VCallNode(CilExprNode): + def __init__(self, local_var, type, method_name, params, instance): + super(VCallNode, self).__init__() + self.local_var = local_var + self.type = type + self.method_name = method_name + self.params = params + self.instance = instance + +class ArgNode(CilExprNode): + def __init__(self, arg_name): + super(ArgNode, self).__init__() + self.arg_name = arg_name + +class IfGotoNode(CilExprNode): + def __init__(self, variable, label): + super(IfGotoNode, self).__init__() + self.variable = variable + self.label = label + +class LabelNode(CilExprNode): + def __init__(self, label): + super(LabelNode, self).__init__() + self.label = label + +class GotoNode(CilExprNode): + def __init__(self, label): + super(GotoNode, self).__init__() + self.label = label + +class ReturnNode(CilExprNode): + def __init__(self, return_value): + super(ReturnNode, self).__init__() + self.return_value = return_value + +class IntegerNode(CilExprNode): + def __init__(self, value): + super(IntegerNode, self).__init__() + self.valye = value + +class StringNode(CilExprNode): + def __init__(self, value): + super(StringNode, self).__init__() + self.valye = value + +class LoadVoidNode(CilExprNode): + def __init__(self, local_var): + super(LoadVoidNode, self).__init__() + self.local_var = local_var + +class LoadStrNode(CilExprNode): + def __init__(self, local_var, msg): + super(LoadStrNode, self).__init__() + self.local_var = local_var + self.msg = msg + +class LoadIntNode(CilExprNode): + def __init__(self, local_var, num): + super(LoadIntNode, self).__init__() + self.local_var = local_var + self.num = num + +class LengthNode(CilExprNode): + def __init__(self, local_var, variable): + super(LengthNode, self).__init__() + self.local_var = local_var + self.variable = variable + +class ConcatNode(CilExprNode): + def __init__(self, local_var, str1, str2, len1, len2): + super(ConcatNode, self).__init__() + self.local_var = local_var + self.str1 = str1 + self.str2 = str2 + self.len1 = len1 + self.len2 = len2 + +class SubStrNode(CilExprNode): + def __init__(self, local_var, index, str, len): + super(SubStrNode, self).__init__() + self.local_var = local_var + self.index = index + self.str = str + self.len = len + +class StrNode(CilExprNode): + def __init__(self,local_var, num): + super(StrNode, self).__init__() + self.local_var = local_var + self.num = num + +class ReadNode(CilExprNode): + def __init__(self, line): + super(ReadNode, self).__init__() + self.line = line + +class ReadIntegerNode(ReadNode): + pass + +class ReadStringNode(ReadNode): + pass + +class PrintNode(CilExprNode): + def __init__(self, line): + super(PrintNode, self).__init__() + self.line = line + +class PrintIntegerNode(PrintNode): + pass + +class PrintStringNode(PrintNode): + pass + +class AbortNode(CilExprNode): + def __init__(self): + super(AbortNode, self).__init__() + +class CaseNode(CilExprNode): + def __init__(self, local_expr, first_label): + super(CaseNode, self).__init__() + self.local_expr = local_expr + self.first_label = first_label + +class ActionNode(CilExprNode): + def __init__(self, local_expr, tag, max_tag, next_label): + super(ActionNode, self).__init__() + self.local_expr = local_expr + self.tag = tag + self.max_tag = max_tag + self.next_label = next_label + +class StringEqualsNode(CilExprNode): + def __init__(self, local_var, str1, str2): + super(StringEqualsNode, self).__init__() + self.local_var = local_var + self.str1 = str1 + self.str2 = str2 + +class IsVoidNode(CilExprNode): + def __init__(self, local_var, expr): + super(IsVoidNode, self).__init__() + self.local_var = local_var + self.expr = expr + +class CopyNode(CilExprNode): + def __init__(self, local_var, type): + super(CopyNode, self).__init__() + self.local_var = local_var + self.type = type \ No newline at end of file diff --git a/src/nodes/expr_nodes.py b/src/nodes/expr_nodes.py new file mode 100644 index 000000000..ed5f42c60 --- /dev/null +++ b/src/nodes/expr_nodes.py @@ -0,0 +1,130 @@ +from .ast_nodes import AST + +class ExpressionNode(AST): + def __init__(self): + super(ExpressionNode, self).__init__() + self.expr_type = None + +class ActionNode(ExpressionNode): + def __init__(self, name, act_type, body, row , col): + super(ActionNode, self).__init__() + self.name = name + self.act_type = act_type + self.body = body + self.row = row + self.col = col + +class DynamicCallNode(ExpressionNode): + def __init__(self, obj, method, args, row , col): + super(DynamicCallNode, self).__init__() + self.obj = obj + self.method = method + self.args = args + self.row = row + self.col = col + +class StaticCallNode(ExpressionNode): + def __init__(self, obj, static_type, method, args, row, col): + super(StaticCallNode, self).__init__() + self.obj = obj + self.static_type = static_type + self.method = method + self.args = args + self.row = row + self.col = col + +class AssignNode(ExpressionNode): + def __init__(self, name, expression, row, col): + super(AssignNode, self).__init__() + self.name = name + self.expression = expression + self.row = row + self.col = col + +class IfNode(ExpressionNode): + def __init__(self, predicate, then_expr, else_expr, row, col): + super(IfNode, self).__init__() + self.predicate = predicate + self.then_expr = then_expr + self.else_expr = else_expr + self.row = row + self.col = col + +class WhileNode(ExpressionNode): + def __init__(self, predicate, expression, row, col): + super(WhileNode, self).__init__() + self.predicate = predicate + self.expression = expression + self.row = row + self.col = col + +class BlockNode(ExpressionNode): + def __init__(self, expr_list, row , col): + super(BlockNode, self).__init__() + self.expr_list = expr_list + +class LetNode(ExpressionNode): + def __init__(self, init_list, body, row, col): + super(LetNode, self).__init__() + self.init_list = init_list + self.body = body + self.row = row + self.col = col + +class CaseNode(ExpressionNode): + def __init__(self, expression, act_list, row, col): + super(CaseNode, self).__init__() + self.expression = expression + self.act_list = act_list + self.row = row + self.col = col + +class NewNode(ExpressionNode): + def __init__(self, new_type, row, col): + super(NewNode, self).__init__() + self.new_type = new_type + self.row = row + self.col = col + +class IsVoidNode(ExpressionNode): + def __init__(self, expression, row, col): + super(IsVoidNode, self).__init__() + self.expression = expression + self.row = row + self.col = col + +class IdNode(ExpressionNode): + def __init__(self, name, row, col): + super(IdNode, self).__init__() + self.name = name + self.row = row + self.col = col + +class EqualsNode(ExpressionNode): + def __init__(self, left, right, row, col): + super(EqualsNode, self).__init__() + self.left = left + self.right = right + self.row = row + self.col = col + +class IntegerNode(ExpressionNode): + def __init__(self, value, row, col): + super(IntegerNode, self).__init__() + self.value = value + self.row = row + self.col = col + +class StringNode(ExpressionNode): + def __init__(self, value, row, col): + super(StringNode, self).__init__() + self.value = value + self.row = row + self.col = col + +class BooleanNode(ExpressionNode): + def __init__(self, value, row, col): + super(BooleanNode, self).__init__() + self.value = value + self.row = row + self.col = col diff --git a/src/nodes/operations_nodes.py b/src/nodes/operations_nodes.py new file mode 100644 index 000000000..7bc8dadc1 --- /dev/null +++ b/src/nodes/operations_nodes.py @@ -0,0 +1,83 @@ +from .expr_nodes import ExpressionNode + +class BinaryOpNode(ExpressionNode): + def __init__(self): + super(BinaryOpNode, self).__init__() + pass + +class UnaryOpNode(ExpressionNode): + def __init__(self): + super(UnaryOpNode, self).__init__() + pass + +class ArithBinOpNode(BinaryOpNode): + def __init__(self): + super(ArithBinOpNode, self).__init__() + pass + +class LogicBinOpNode(BinaryOpNode): + def __init__(self): + super(LogicBinOpNode, self).__init__() + pass + +class NotNode(UnaryOpNode): + def __init__(self, expression, row, col): + super(NotNode, self).__init__() + self.expression = expression + self.row = row + self.col = col + +class LogicNotNode(UnaryOpNode): + def __init__(self, expression, row, col): + super(LogicNotNode, self).__init__() + self.expression = expression + self.row = row + self.col = col + +class SumNode(ArithBinOpNode): + def __init__(self, left, right, row, col): + super(SumNode, self).__init__() + self.left = left + self.right = right + self.row = row + self.col = col + +class SubNode(ArithBinOpNode): + def __init__(self, left, right, row, col): + super(SubNode, self).__init__() + self.left = left + self.right = right + self.row = row + self.col = col + +class MultNode(ArithBinOpNode): + def __init__(self, left, right, row, col): + super(MultNode, self).__init__() + self.left = left + self.right = right + self.row = row + self.col = col + +class DivNode(ArithBinOpNode): + def __init__(self, left, right, row, col): + super(DivNode, self).__init__() + self.left = left + self.right = right + self.row = row + self.col = col + +class LessNode(LogicBinOpNode): + def __init__(self, left, right, row, col): + super(LessNode, self).__init__() + self.left = left + self.right = right + self.row = row + self.col = col + +class LessEqualNode(LogicBinOpNode): + def __init__(self, left, right, row, col): + super(LessEqualNode, self).__init__() + self.left = left + self.right = right + self.row = row + self.col = col diff --git a/src/parser/__init__.py b/src/parser/__init__.py new file mode 100644 index 000000000..11bb53991 --- /dev/null +++ b/src/parser/__init__.py @@ -0,0 +1,2 @@ +from .syntactic_error import SyntaxError +from .parser import * diff --git a/src/parser/parser.py b/src/parser/parser.py new file mode 100644 index 000000000..838af6ce3 --- /dev/null +++ b/src/parser/parser.py @@ -0,0 +1,375 @@ +import ply.yacc as yacc +from nodes import * +from lexer import MyLexer +from .syntactic_error import SyntaxError +import sys + +class MyParser(): + def __init__(self, build_parser=True, debug=False, write_tables=True, optimize=True, outputdir="", yacctab="pycoolc.yacctab", debuglog=None, errorlog=None, tracking =True): + + self.build(debug=debug, write_tables=write_tables, optimize=optimize, outputdir=outputdir, + yacctab=yacctab, debuglog=debuglog, errorlog=errorlog) + + # Build the parser + def build(self, **kwargs): + + debug = kwargs.get("debug") + write_tables = kwargs.get("write_tables") + optimize = kwargs.get("optimize") + outputdir = kwargs.get("outputdir") + yacctab = kwargs.get("yacctab") + debuglog = kwargs.get("debuglog") + + self.lexer = MyLexer() + self.tokens = self.lexer.tokens + self.errors = [] + self.parser = yacc.yacc(module=self, write_tables=write_tables, debug=debug, optimize=optimize, + outputdir=outputdir, tabmodule=yacctab, debuglog=debuglog, errorlog=yacc.NullLogger()) + + def parse(self, _cool_program): + return self.parser.parse(_cool_program) + + def find_col(self, input, lexpos): + _start = input.rfind('\n', 0, lexpos) + 1 + return (lexpos - _start) + 1 + + # Precedence rules + precedence = ( + ('right', 'ASSIGN'), + ('right', 'NOT'), + ('nonassoc', 'LESS', 'LESSEQ', 'EQUAL'), + ('left', 'PLUS', 'MINUS'), + ('left', 'MULTIPLY', 'DIVIDE'), + ('right', 'ISVOID'), + ('right', 'NOX'), + ('right', 'ARROBA'), + ('right', 'DOT') + ) + + # Grammar rules declarations + def p_program(self, p): + ''' + program : class_list + ''' + p[0] = ProgramNode(classes=p[1]) + + def p_class_list(self, p): + ''' + class_list : class_list class SEMIC + | class SEMIC + ''' + p[0] = (p[1],) if len(p) == 3 else p[1] + (p[2],) + + def p_def_class(self, p): + ''' + class : CLASS TYPE LBRACE feature_opt RBRACE + ''' + p[0] = ClassNode( + name=p[2], parent='Object', features=p[4], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + + def p_def_class_inherits(self, p): + ''' + class : CLASS TYPE INHERITS TYPE LBRACE feature_opt RBRACE + ''' + p[0] = ClassNode( + name=p[2], parent=p[4], features=p[6], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(4))) + + def p_feature_list(self, p): + ''' + feature_list : feature_list feature SEMIC + | feature SEMIC + ''' + p[0] = (p[1],) if len(p) == 3 else p[1] + (p[2],) + + def p_feature_opt(self, p): + ''' + feature_opt : feature_list + | empty + ''' + p[0] = tuple() if p.slice[1].type == "empty" else p[1] + + def p_feature_f_class_method(self, p): + ''' + feature : ID LPAREN formal_param_list RPAREN COLON TYPE LBRACE expr RBRACE + ''' + p[0] = ClassMethodNode( + name=p[1], params=p[3], expression=p[8], return_type=p[6], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_feature_class_method(self, p): + ''' + feature : ID LPAREN RPAREN COLON TYPE LBRACE expr RBRACE + ''' + p[0] = ClassMethodNode( + name=p[1], params=tuple(), expression=p[7], return_type=p[5], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_feature_attr(self, p): + ''' + feature : attr_init + ''' + p[0] = p[1] + + def p_attr_init(self, p): + ''' + attr_init : ID COLON TYPE ASSIGN expr + | attr_def + ''' + p[0] = p[1] if len(p) == 2 else AttrInitNode( + name=p[1], attr_type=p[3], expression=p[5], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_attr_def(self, p): + ''' + attr_def : ID COLON TYPE + ''' + p[0] = AttrDefNode( + name=p[1], attr_type=p[3], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_action_list(self, p): + ''' + action_list : action_list action + | action + ''' + p[0] = (p[1],) if len(p) == 2 else tuple(p[1]) + (p[2],) + + + def p_let_var(self, p): + ''' + let_var : let_init + | let_var COMMA let_init + ''' + p[0] = (p[1],) if len(p) == 2 else p[1] + (p[3],) + + def p_let_init(self, p): + ''' + let_init : ID COLON TYPE ASSIGN expr + | let_def + ''' + p[0] = p[1] if len(p) == 2 else LetInitNode( + name=p[1], let_type=p[3], expression=p[5], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + + def p_let_def(self, p): + ''' + let_def : ID COLON TYPE + ''' + p[0] = LetDefNode( + name=p[1], let_type=p[3], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_formal_param_list(self, p): + ''' + formal_param_list : formal_param_list COMMA formal_param + | formal_param + ''' + p[0] = (p[1],) if len(p) == 2 else p[1] + (p[3],) + + def p_formal_param(self, p): + ''' + formal_param : ID COLON TYPE + ''' + p[0] = FormalParamNode( + name=p[1], param_type=p[3], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_args_list(self, p): + ''' + args_list : args_list COMMA expr + | expr + ''' + p[0] = (p[1],) if len(p) == 2 else p[1] + (p[3],) + + def p_args_list_opt(self, p): + ''' + args_list_opt : args_list + | empty + ''' + p[0] = tuple() if p.slice[1].type == "empty" else p[1] + + def p_action(self, p): + ''' + action : ID COLON TYPE ARROW expr SEMIC + ''' + p[0] = ActionNode( + name=p[1], act_type=p[3], body=p[5], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_dynamic_call(self, p): + ''' + expr : expr DOT ID LPAREN args_list_opt RPAREN + ''' + p[0] = DynamicCallNode( + obj=p[1], method=p[3], args=p[5], row=p.lineno(3), col=self.find_col(p.lexer.lexdata, p.lexpos(3))) + + def p_expr_static_call(self, p): + ''' + expr : expr ARROBA TYPE DOT ID LPAREN args_list_opt RPAREN + ''' + p[0] = StaticCallNode( + obj=p[1], static_type=p[3], method=p[5], args=p[7], row=p.lineno(5), col=self.find_col(p.lexer.lexdata, p.lexpos(5))) + + def p_expr_self_call(self, p): + ''' + expr : ID LPAREN args_list_opt RPAREN + ''' + p[0] = DynamicCallNode( + obj=IdNode('self', row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))), method=p[1], args=p[3], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_assign(self, p): + ''' + expr : ID ASSIGN expr + ''' + p[0] = AssignNode( + name=p[1], expression=p[3], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_if(self, p): + ''' + expr : IF expr THEN expr ELSE expr FI + ''' + p[0] = IfNode( + predicate=p[2], then_expr=p[4], else_expr=p[6], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_while(self, p): + ''' + expr : WHILE expr LOOP expr POOL + ''' + p[0] = WhileNode( + predicate=p[2], expression=p[4], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_block_list(self, p): + ''' + block_list : block_list expr SEMIC + | expr SEMIC + ''' + p[0] = (p[1],) if len(p) == 3 else p[1] + (p[2],) + + def p_expr_block(self, p): + ''' + expr : LBRACE block_list RBRACE + ''' + p[0] = BlockNode( + expr_list=p[2], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_simple_let(self, p): + ''' + expr : let_expr + ''' + p[0] = p[1] + + def p_expr_let(self, p): + ''' + let_expr : LET let_var IN expr + ''' + p[0] = LetNode( + init_list=p[2], body=p[4], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + + def p_expr_case(self, p): + ''' + expr : CASE expr OF action_list ESAC + ''' + p[0] = CaseNode( + expression=p[2], act_list=p[4], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_new(self, p): + ''' + expr : NEW TYPE + ''' + p[0] = NewNode( + new_type=p[2], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + + def p_expr_isvoid(self, p): + ''' + expr : ISVOID expr + ''' + p[0] = IsVoidNode( + expression=p[2], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + + def p_expr_id(self, p): + ''' + expr : ID + ''' + p[0] = IdNode( + name=p[1], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_int(self, p): + ''' + expr : INTEGER + ''' + p[0] = IntegerNode( + value=p[1], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_str(self, p): + ''' + expr : STRING + ''' + p[0] = StringNode( + value=p[1], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_bool(self, p): + ''' + expr : TRUE + | FALSE + ''' + p[0] = BooleanNode( + value=p[1], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_binary_op(self, p): + ''' + expr : expr PLUS expr + | expr MINUS expr + | expr MULTIPLY expr + | expr DIVIDE expr + | expr LESS expr + | expr LESSEQ expr + | expr EQUAL expr + ''' + if p[2] == '+': + p[0] = SumNode( + left=p[1], right=p[3], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + elif p[2] == '-': + p[0] = SubNode( + left=p[1], right=p[3], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + elif p[2] == '*': + p[0] = MultNode( + left=p[1], right=p[3], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + elif p[2] == '/': + p[0] = DivNode( + left=p[1], right=p[3], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + elif p[2] == '<': + p[0] = LessNode( + left=p[1], right=p[3], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + elif p[2] == '<=': + p[0] = LessEqualNode( + left=p[1], right=p[3], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + elif p[2] == '=': + p[0] = EqualsNode( + left=p[1], right=p[3], row=p.lineno(2), col=self.find_col(p.lexer.lexdata, p.lexpos(2))) + + def p_expr_unary_op(self, p): + ''' + expr : NOX expr + | NOT expr + ''' + if p[1] == '~': + p[0] = LogicNotNode( + expression=p[2], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + elif p[1].lower() == 'not': + p[0] = NotNode( + expression=p[2], row=p.lineno(1), col=self.find_col(p.lexer.lexdata, p.lexpos(1))) + + def p_expr_parenthesis(self, p): + ''' + expr : LPAREN expr RPAREN + ''' + p[0] = p[2] + + def p_empty(self, p): + ''' + empty : + ''' + p[0] = None + + # Error rule for Syntax Errors handling + def p_error(self, p): + if p: + self.errors.append(SyntaxError(f'"ERROR at or near {p.value}"', p.lineno, self.find_col(p.lexer.lexdata, p.lexpos))) + self.parser.errok() + else: + self.errors.append(SyntaxError('"ERROR at or near EOF"',0,0)) + return + + \ No newline at end of file diff --git a/src/parser/parsetab.py b/src/parser/parsetab.py new file mode 100644 index 000000000..f9a0e3fa4 --- /dev/null +++ b/src/parser/parsetab.py @@ -0,0 +1,90 @@ + +# parsetab.py +# This file is automatically generated. Do not edit. +# pylint: disable=W,C,R +_tabversion = '3.10' + +_lr_method = 'LALR' + +_lr_signature = 'rightASSIGNrightNOTnonassocLESSLESSEQEQUALleftPLUSMINUSleftMULTIPLYDIVIDErightISVOIDrightNOXrightARROBArightDOTARROBA ARROW ASSIGN BOOLEAN BOOL_TYPE CASE CLASS COLON COMMA DIVIDE DOT ELSE EQUAL ESAC FALSE FI ID IF IN INHERITS INTEGER INT_TYPE IO_TYPE ISVOID LBRACE LESS LESSEQ LET LOOP LPAREN LexicographicError MAIN_TYPE MINUS MULTIPLY NEW NOT NOX OBJECT_TYPE OF PLUS POOL RBRACE RPAREN SELF_TYPE SEMIC STRING STRING_TYPE THEN TRUE TYPE WHILE\n program : class_list\n \n class_list : class_list class SEMIC\n | class SEMIC\n \n class : CLASS TYPE LBRACE feature_opt RBRACE\n \n class : CLASS TYPE INHERITS TYPE LBRACE feature_opt RBRACE\n \n feature_list : feature_list feature SEMIC\n | feature SEMIC\n \n feature_opt : feature_list\n | empty\n \n feature : ID LPAREN formal_param_list RPAREN COLON TYPE LBRACE expr RBRACE\n \n feature : ID LPAREN RPAREN COLON TYPE LBRACE expr RBRACE\n \n feature : attr_init\n \n attr_init : ID COLON TYPE ASSIGN expr \n | attr_def\n \n attr_def : ID COLON TYPE\n \n action_list : action_list action\n | action\n \n action : ID COLON TYPE ARROW expr SEMIC\n \n let_var : let_init\n | let_var COMMA let_init\n \n let_init : ID COLON TYPE ASSIGN expr \n | let_def\n \n let_def : ID COLON TYPE\n \n formal_param_list : formal_param_list COMMA formal_param\n | formal_param\n \n formal_param : ID COLON TYPE\n \n args_list : args_list COMMA expr\n | expr\n \n args_list_opt : args_list\n | empty\n \n expr : expr DOT ID LPAREN args_list_opt RPAREN\n \n expr : expr ARROBA TYPE DOT ID LPAREN args_list_opt RPAREN\n \n expr : ID LPAREN args_list_opt RPAREN\n \n expr : ID ASSIGN expr\n \n expr : IF expr THEN expr ELSE expr FI\n \n expr : WHILE expr LOOP expr POOL\n \n block_list : block_list expr SEMIC\n | expr SEMIC\n \n expr : LBRACE block_list RBRACE\n \n expr : let_expr\n \n let_expr : LET let_var IN expr\n \n expr : CASE expr OF action_list ESAC\n \n expr : NEW TYPE\n \n expr : ISVOID expr\n \n expr : ID\n \n expr : INTEGER\n \n expr : STRING\n \n expr : TRUE \n | FALSE\n \n expr : expr PLUS expr\n | expr MINUS expr\n | expr MULTIPLY expr\n | expr DIVIDE expr\n | expr LESS expr\n | expr LESSEQ expr\n | expr EQUAL expr\n \n expr : NOX expr\n | NOT expr\n \n expr : LPAREN expr RPAREN\n \n empty :\n ' + +_lr_action_items = {'CLASS':([0,2,6,8,],[4,4,-3,-2,]),'$end':([1,2,6,8,],[0,-1,-3,-2,]),'SEMIC':([3,5,14,16,17,19,20,30,37,42,43,48,52,53,54,55,76,78,79,80,81,92,95,96,97,98,99,100,101,102,105,106,113,114,124,127,132,133,137,143,145,146,],[6,8,21,-12,-14,-4,25,-15,-5,-45,-13,-40,-46,-47,-48,-49,107,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,120,-11,-33,-41,-10,-36,-42,-31,-35,-32,147,]),'TYPE':([4,10,23,32,35,39,50,64,111,135,],[7,18,30,38,41,59,78,94,126,140,]),'LBRACE':([7,18,36,41,44,45,46,47,49,51,56,57,59,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[9,24,47,60,47,47,47,47,47,47,47,47,86,47,47,47,47,47,47,47,47,47,47,47,47,47,47,-38,47,47,47,-37,47,47,47,47,]),'INHERITS':([7,],[10,]),'RBRACE':([9,11,12,13,21,24,25,31,42,48,52,53,54,55,75,78,79,80,81,87,92,95,96,97,98,99,100,101,102,105,107,112,114,120,124,132,133,137,143,145,],[-60,19,-8,-9,-7,-60,-6,37,-45,-40,-46,-47,-48,-49,105,-43,-44,-57,-58,113,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-38,127,-33,-37,-41,-36,-42,-31,-35,-32,]),'ID':([9,12,21,22,24,25,34,36,44,45,46,47,49,51,56,57,58,60,61,62,63,65,66,67,68,69,70,71,75,86,103,104,107,108,109,110,115,116,117,120,121,122,131,134,136,138,144,147,],[15,15,-7,26,15,-6,26,42,42,42,42,42,42,42,42,42,84,42,42,42,93,42,42,42,42,42,42,42,42,42,42,42,-38,123,42,84,42,42,130,-37,123,-17,42,-16,42,42,42,-18,]),'LPAREN':([15,36,42,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,93,103,104,107,109,115,116,120,130,131,136,138,144,],[22,44,61,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,116,44,44,-38,44,44,44,-37,138,44,44,44,44,]),'COLON':([15,26,28,33,84,123,],[23,32,35,39,111,135,]),'RPAREN':([22,27,29,38,40,42,48,52,53,54,55,61,72,78,79,80,81,88,89,90,91,92,95,96,97,98,99,100,101,102,105,114,116,124,128,129,132,133,137,138,142,143,145,],[28,33,-25,-26,-24,-45,-40,-46,-47,-48,-49,-60,102,-43,-44,-57,-58,114,-29,-30,-28,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-60,-41,-27,137,-36,-42,-31,-60,145,-35,-32,]),'COMMA':([27,29,38,40,42,48,52,53,54,55,78,79,80,81,82,83,85,89,91,92,95,96,97,98,99,100,101,102,105,114,124,125,126,128,132,133,137,141,143,145,],[34,-25,-26,-24,-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,110,-19,-22,115,-28,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-20,-23,-27,-36,-42,-31,-21,-35,-32,]),'ASSIGN':([30,42,126,],[36,62,136,]),'IF':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-38,45,45,45,-37,45,45,45,45,]),'WHILE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,-38,46,46,46,-37,46,46,46,46,]),'CASE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,-38,49,49,49,-37,49,49,49,49,]),'NEW':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-38,50,50,50,-37,50,50,50,50,]),'ISVOID':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,-38,51,51,51,-37,51,51,51,51,]),'INTEGER':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,-38,52,52,52,-37,52,52,52,52,]),'STRING':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,-38,53,53,53,-37,53,53,53,53,]),'TRUE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,-38,54,54,54,-37,54,54,54,54,]),'FALSE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,-38,55,55,55,-37,55,55,55,55,]),'NOX':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,-38,56,56,56,-37,56,56,56,56,]),'NOT':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,-38,57,57,57,-37,57,57,57,57,]),'LET':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,-38,58,58,58,-37,58,58,58,58,]),'DOT':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,94,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,63,-40,-46,-47,-48,-49,63,63,63,63,63,-43,63,63,63,63,63,63,117,63,63,63,63,63,63,63,-59,-39,63,63,-33,63,63,63,63,-36,-42,-31,63,63,-35,-32,63,]),'ARROBA':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,64,-40,-46,-47,-48,-49,64,64,64,64,64,-43,64,64,64,64,64,64,64,64,64,64,64,64,64,-59,-39,64,64,-33,64,64,64,64,-36,-42,-31,64,64,-35,-32,64,]),'PLUS':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,65,-40,-46,-47,-48,-49,65,65,65,65,65,-43,-44,-57,65,65,65,65,-50,-51,-52,-53,65,65,65,-59,-39,65,65,-33,65,65,65,65,-36,-42,-31,65,65,-35,-32,65,]),'MINUS':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,66,-40,-46,-47,-48,-49,66,66,66,66,66,-43,-44,-57,66,66,66,66,-50,-51,-52,-53,66,66,66,-59,-39,66,66,-33,66,66,66,66,-36,-42,-31,66,66,-35,-32,66,]),'MULTIPLY':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,67,-40,-46,-47,-48,-49,67,67,67,67,67,-43,-44,-57,67,67,67,67,67,67,-52,-53,67,67,67,-59,-39,67,67,-33,67,67,67,67,-36,-42,-31,67,67,-35,-32,67,]),'DIVIDE':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,68,-40,-46,-47,-48,-49,68,68,68,68,68,-43,-44,-57,68,68,68,68,68,68,-52,-53,68,68,68,-59,-39,68,68,-33,68,68,68,68,-36,-42,-31,68,68,-35,-32,68,]),'LESS':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,69,-40,-46,-47,-48,-49,69,69,69,69,69,-43,-44,-57,69,69,69,69,-50,-51,-52,-53,None,None,None,-59,-39,69,69,-33,69,69,69,69,-36,-42,-31,69,69,-35,-32,69,]),'LESSEQ':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,70,-40,-46,-47,-48,-49,70,70,70,70,70,-43,-44,-57,70,70,70,70,-50,-51,-52,-53,None,None,None,-59,-39,70,70,-33,70,70,70,70,-36,-42,-31,70,70,-35,-32,70,]),'EQUAL':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,71,-40,-46,-47,-48,-49,71,71,71,71,71,-43,-44,-57,71,71,71,71,-50,-51,-52,-53,None,None,None,-59,-39,71,71,-33,71,71,71,71,-36,-42,-31,71,71,-35,-32,71,]),'THEN':([42,48,52,53,54,55,73,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,103,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,-35,-32,]),'LOOP':([42,48,52,53,54,55,74,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,104,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,-35,-32,]),'OF':([42,48,52,53,54,55,77,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,108,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,-35,-32,]),'ELSE':([42,48,52,53,54,55,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,118,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,131,-41,-36,-42,-31,-35,-32,]),'POOL':([42,48,52,53,54,55,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,119,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,132,-41,-36,-42,-31,-35,-32,]),'FI':([42,48,52,53,54,55,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,139,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,143,-35,-32,]),'IN':([42,48,52,53,54,55,78,79,80,81,82,83,85,92,95,96,97,98,99,100,101,102,105,114,124,125,126,132,133,137,141,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,109,-19,-22,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-20,-23,-36,-42,-31,-21,-35,-32,]),'ESAC':([121,122,134,147,],[133,-17,-16,-18,]),'ARROW':([140,],[144,]),} + +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items + +_lr_goto_items = {'program':([0,],[1,]),'class_list':([0,],[2,]),'class':([0,2,],[3,5,]),'feature_opt':([9,24,],[11,31,]),'feature_list':([9,24,],[12,12,]),'empty':([9,24,61,116,138,],[13,13,90,90,90,]),'feature':([9,12,24,],[14,20,14,]),'attr_init':([9,12,24,],[16,16,16,]),'attr_def':([9,12,24,],[17,17,17,]),'formal_param_list':([22,],[27,]),'formal_param':([22,34,],[29,40,]),'expr':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,109,115,116,131,136,138,144,],[43,72,73,74,76,77,79,80,81,87,91,92,95,96,97,98,99,100,101,106,112,118,119,124,128,91,139,141,91,146,]),'let_expr':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,109,115,116,131,136,138,144,],[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,]),'block_list':([47,],[75,]),'let_var':([58,],[82,]),'let_init':([58,110,],[83,125,]),'let_def':([58,110,],[85,85,]),'args_list_opt':([61,116,138,],[88,129,142,]),'args_list':([61,116,138,],[89,89,89,]),'action_list':([108,],[121,]),'action':([108,121,],[122,134,]),} + +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +_lr_productions = [ + ("S' -> program","S'",1,None,None,None), + ('program -> class_list','program',1,'p_program','parser.py',56), + ('class_list -> class_list class SEMIC','class_list',3,'p_class_list','parser.py',62), + ('class_list -> class SEMIC','class_list',2,'p_class_list','parser.py',63), + ('class -> CLASS TYPE LBRACE feature_opt RBRACE','class',5,'p_def_class','parser.py',69), + ('class -> CLASS TYPE INHERITS TYPE LBRACE feature_opt RBRACE','class',7,'p_def_class_inherits','parser.py',76), + ('feature_list -> feature_list feature SEMIC','feature_list',3,'p_feature_list','parser.py',83), + ('feature_list -> feature SEMIC','feature_list',2,'p_feature_list','parser.py',84), + ('feature_opt -> feature_list','feature_opt',1,'p_feature_opt','parser.py',90), + ('feature_opt -> empty','feature_opt',1,'p_feature_opt','parser.py',91), + ('feature -> ID LPAREN formal_param_list RPAREN COLON TYPE LBRACE expr RBRACE','feature',9,'p_feature_f_class_method','parser.py',97), + ('feature -> ID LPAREN RPAREN COLON TYPE LBRACE expr RBRACE','feature',8,'p_feature_class_method','parser.py',104), + ('feature -> attr_init','feature',1,'p_feature_attr','parser.py',111), + ('attr_init -> ID COLON TYPE ASSIGN expr','attr_init',5,'p_attr_init','parser.py',117), + ('attr_init -> attr_def','attr_init',1,'p_attr_init','parser.py',118), + ('attr_def -> ID COLON TYPE','attr_def',3,'p_attr_def','parser.py',125), + ('action_list -> action_list action','action_list',2,'p_action_list','parser.py',132), + ('action_list -> action','action_list',1,'p_action_list','parser.py',133), + ('action -> ID COLON TYPE ARROW expr SEMIC','action',6,'p_action','parser.py',139), + ('let_var -> let_init','let_var',1,'p_let_var','parser.py',146), + ('let_var -> let_var COMMA let_init','let_var',3,'p_let_var','parser.py',147), + ('let_init -> ID COLON TYPE ASSIGN expr','let_init',5,'p_let_init','parser.py',153), + ('let_init -> let_def','let_init',1,'p_let_init','parser.py',154), + ('let_def -> ID COLON TYPE','let_def',3,'p_let_def','parser.py',161), + ('formal_param_list -> formal_param_list COMMA formal_param','formal_param_list',3,'p_formal_param_list','parser.py',168), + ('formal_param_list -> formal_param','formal_param_list',1,'p_formal_param_list','parser.py',169), + ('formal_param -> ID COLON TYPE','formal_param',3,'p_formal_param','parser.py',175), + ('args_list -> args_list COMMA expr','args_list',3,'p_args_list','parser.py',182), + ('args_list -> expr','args_list',1,'p_args_list','parser.py',183), + ('args_list_opt -> args_list','args_list_opt',1,'p_args_list_opt','parser.py',189), + ('args_list_opt -> empty','args_list_opt',1,'p_args_list_opt','parser.py',190), + ('expr -> expr DOT ID LPAREN args_list_opt RPAREN','expr',6,'p_expr_dynamic_call','parser.py',196), + ('expr -> expr ARROBA TYPE DOT ID LPAREN args_list_opt RPAREN','expr',8,'p_expr_static_call','parser.py',203), + ('expr -> ID LPAREN args_list_opt RPAREN','expr',4,'p_expr_self_call','parser.py',210), + ('expr -> ID ASSIGN expr','expr',3,'p_expr_assign','parser.py',217), + ('expr -> IF expr THEN expr ELSE expr FI','expr',7,'p_expr_if','parser.py',224), + ('expr -> WHILE expr LOOP expr POOL','expr',5,'p_expr_while','parser.py',231), + ('block_list -> block_list expr SEMIC','block_list',3,'p_block_list','parser.py',238), + ('block_list -> expr SEMIC','block_list',2,'p_block_list','parser.py',239), + ('expr -> LBRACE block_list RBRACE','expr',3,'p_expr_block','parser.py',245), + ('expr -> let_expr','expr',1,'p_expr_simple_let','parser.py',252), + ('let_expr -> LET let_var IN expr','let_expr',4,'p_expr_let','parser.py',258), + ('expr -> CASE expr OF action_list ESAC','expr',5,'p_expr_case','parser.py',265), + ('expr -> NEW TYPE','expr',2,'p_expr_new','parser.py',272), + ('expr -> ISVOID expr','expr',2,'p_expr_isvoid','parser.py',279), + ('expr -> ID','expr',1,'p_expr_id','parser.py',286), + ('expr -> INTEGER','expr',1,'p_expr_int','parser.py',293), + ('expr -> STRING','expr',1,'p_expr_str','parser.py',300), + ('expr -> TRUE','expr',1,'p_expr_bool','parser.py',307), + ('expr -> FALSE','expr',1,'p_expr_bool','parser.py',308), + ('expr -> expr PLUS expr','expr',3,'p_expr_binary_op','parser.py',315), + ('expr -> expr MINUS expr','expr',3,'p_expr_binary_op','parser.py',316), + ('expr -> expr MULTIPLY expr','expr',3,'p_expr_binary_op','parser.py',317), + ('expr -> expr DIVIDE expr','expr',3,'p_expr_binary_op','parser.py',318), + ('expr -> expr LESS expr','expr',3,'p_expr_binary_op','parser.py',319), + ('expr -> expr LESSEQ expr','expr',3,'p_expr_binary_op','parser.py',320), + ('expr -> expr EQUAL expr','expr',3,'p_expr_binary_op','parser.py',321), + ('expr -> NOX expr','expr',2,'p_expr_unary_op','parser.py',347), + ('expr -> NOT expr','expr',2,'p_expr_unary_op','parser.py',348), + ('expr -> LPAREN expr RPAREN','expr',3,'p_expr_parenthesis','parser.py',359), + ('empty -> ','empty',0,'p_empty','parser.py',365), +] diff --git a/src/parser/syntactic_error.py b/src/parser/syntactic_error.py new file mode 100644 index 000000000..70c46be66 --- /dev/null +++ b/src/parser/syntactic_error.py @@ -0,0 +1,13 @@ +class SyntaxError(): + def __init__(self, msg, line, column): + super().__init__() + self.type = 'SyntacticError' + self.value = msg + self.line = line + self.column = column + + def __str__(self): + return f'({self.line}, {self.column}) - {self.type}: {self.value}' + + def __repr__(self): + return str(self) \ No newline at end of file diff --git a/src/semantic/__init__.py b/src/semantic/__init__.py new file mode 100644 index 000000000..88fb8925f --- /dev/null +++ b/src/semantic/__init__.py @@ -0,0 +1 @@ +from .semantic_analyzer import MySemanticAnalyzer \ No newline at end of file diff --git a/src/semantic/semantic_analyzer.py b/src/semantic/semantic_analyzer.py new file mode 100755 index 000000000..81d05675c --- /dev/null +++ b/src/semantic/semantic_analyzer.py @@ -0,0 +1,25 @@ +from .visitor import * + +class MySemanticAnalyzer: + def __init__(self, ast): + self.ast = ast + self.errors = [] + + def analyze(self): + + type_collector = TypeCollector(self.errors) + type_collector.visit(self.ast) + context = type_collector.context + + #building types + type_builder = TypeBuilder(context, self.errors) + type_builder.visit(self.ast) + + if len(self.errors) > 0: + return context, None + + #checking types + type_checker = TypeChecker(context, self.errors) + scope = type_checker.visit(self.ast) + + return context, scope \ No newline at end of file diff --git a/src/semantic/tools/attribute.py b/src/semantic/tools/attribute.py new file mode 100755 index 000000000..5b96c73d6 --- /dev/null +++ b/src/semantic/tools/attribute.py @@ -0,0 +1,10 @@ +class Attribute: + def __init__(self, name, typex): + self.name = name + self.type = typex + + def __str__(self): + return f'[attrib] {self.name} : {self.type.name};' + + def __repr__(self): + return str(self) diff --git a/src/semantic/tools/context.py b/src/semantic/tools/context.py new file mode 100755 index 000000000..ca251e09d --- /dev/null +++ b/src/semantic/tools/context.py @@ -0,0 +1,83 @@ +from .type import * +from .error import SemanticException + +class Context: + def __init__(self): + self.types = {} + self.graph = {} + self.classes = {} + self.types['ErrorType'] = Error_Type() + + def create_builtin_types(self): + self.types['SELF_TYPE'] = Type('SELF_TYPE') + + self.types['Object'] = Object_Type() + self.types['IO'] = IO_Type() + self.types['String'] = String_Type() + self.types['Int'] = Int_Type() + self.types['Bool'] = Bool_Type() + self.graph['Object'] = ['IO', 'String', 'Bool', 'Int'] + self.graph['IO'] = [] + self.graph['String'] = [] + self.graph['Int'] = [] + self.graph['Bool'] = [] + + self.types['IO'].set_parent(self.types['Object']) + self.types['String'].set_parent(self.types['Object']) + self.types['Int'].set_parent(self.types['Object']) + self.types['Bool'].set_parent(self.types['Object']) + + self.types['Object'].define_method('abort', [], [], self.types['Object']) + self.types['Object'].define_method('type_name', [], [], self.types['String']) + self.types['Object'].define_method('copy', [], [], self.types['SELF_TYPE']) + + self.types['IO'].define_method('out_string', ['x'], [self.types['String']], self.types['SELF_TYPE']) + self.types['IO'].define_method('out_int', ['x'], [self.types['Int']], self.types['SELF_TYPE']) + self.types['IO'].define_method('in_string', [], [], self.types['String']) + self.types['IO'].define_method('in_int', [], [], self.types['Int']) + + self.types['String'].define_method('length', [], [], self.types['Int']) + self.types['String'].define_method('concat', ['s'], [self.types['String']], self.types['String']) + self.types['String'].define_method('substr', ['i', 'l'], [self.types['Int'], self.types['Int']], self.types['String']) + + def create_type(self, node): + if node.name in self.types: + raise SemanticException( + f'Type with the same name ({node.name}) already in context.') + typex = self.types[node.name] = Type(node.name) + self.classes[node.name] = node + if not self.graph.__contains__(node.name): + self.graph[node.name] = [] + if self.graph.__contains__(node.parent): + self.graph[node.parent].append(node.name) + else: + self.graph[node.parent] = [node.name] + return typex + + def get_type(self, name: str): + try: + return self.types[name] + except KeyError: + raise SemanticException(f'Type "{name}" is not defined.') + + def set_type_tags(self, node='Object', tag=0): + self.types[node].tag = tag + for i,t in enumerate(self.graph[node]): + self.set_type_tags(t, tag + i + 1) + + def set_type_max_tags(self, node='Object'): + if not self.graph[node]: + self.types[node].max_tag = self.types[node].tag + else: + for t in self.graph[node]: + self.set_type_max_tags(t) + maximum = 0 + for t in self.graph[node]: + maximum = max(maximum, self.types[t].max_tag) + self.types[node].max_tag = maximum + + def __str__(self): + return '{\n\t' + '\n\t'.join(y for x in self.types.values() for y in str(x).split('\n')) + '\n}' + + def __repr__(self): + return str(self) diff --git a/src/semantic/tools/error.py b/src/semantic/tools/error.py new file mode 100755 index 000000000..90b4d30a0 --- /dev/null +++ b/src/semantic/tools/error.py @@ -0,0 +1,45 @@ +#errors +wrong_signature_ = 'Method "%s" already defined in "%s" with a different signature.' +param_wrong_signature = 'Parameter "%s" is already defined in method "%s".' +param_not_exist_ = 'The type of param "%s" in method "%s" not exist, in the class "%s".' +wrong_type_ = 'Type %s expected.' +read_only_ = 'Variable "self" is read-only.' +local_already_defined_ = 'Variable "%s" is already defined in method "%s".' +incompatible_types_ = 'Cannot convert "%s" into "%s".' +var_not_defined_ = 'Variable "%s" is not defined.' +invalid_op_ = 'Operation is not defined between "%s" and "%s".' +incorrect_type_ = 'Incorrect type "%s" waiting "%s".' +autotype_ = 'Cannot infer the type of "%s".' +used_before_assignment_ = 'Variable "%s" used before being assigned.' +circular_dependency_ = 'Circular dependency in "%s".' +b_op_not_defined_ = '%s operations are not defined between "%s" and "%s".' +u_op_not_defined_ = '%s operations are not defined for "%s".' +incorrect_count_params_ = 'Method "%s" of "%s" only accepts "%s" argument(s).' +invalid_SELFTYPE = 'Invalid use of SELF_TYPE.' +self_name = "self cannot be the name of a formal parameter." +self_let_ = "'self' cannot be bound in a 'let' expression." +other_branch_declared_ = 'The type "%s" is declared in another branch.' +attr_not_exist_ = 'The type of attr "%s" in class "%s" not exist.' +invalid_return_type_ = 'The return type "%s" in method "%s" not exist, in the class "%s".' +inherits_builtin_type = 'Type "%s" inherits from a builint type.' +main_method_not_exist_ = 'The main method is not defined in class Main.' +Main_not_defined_ = "The class Main is not defined." + +class SemanticException(Exception): + @property + def text(self): + return self.args[0] + +class SemanticError(): + def __init__(self,message, line, column, type = 'SemanticError'): + self.type = type + self.value = message + self.line = line + self.column = column + self.text = f'({self.line}, {self.column}) - {self.type}: {self.value}' + + def __str__(self): + return f'({self.line}, {self.column}) - {self.type}: {self.value}' + + def __repr__(self): + return str(self) diff --git a/src/semantic/tools/methods.py b/src/semantic/tools/methods.py new file mode 100755 index 000000000..f15909839 --- /dev/null +++ b/src/semantic/tools/methods.py @@ -0,0 +1,16 @@ +class Method: + def __init__(self, name, param_names, params_types, return_type): + self.name = name + self.param_names = param_names + self.param_types = params_types + self.return_type = return_type + + def __str__(self): + params = ', '.join(f'{n}:{t.name}' for n, t in zip( + self.param_names, self.param_types)) + return f'[method] {self.name}({params}): {self.return_type.name};' + + def __eq__(self, other): + return other.name == self.name and \ + other.return_type == self.return_type and \ + other.param_types == self.param_types \ No newline at end of file diff --git a/src/semantic/tools/scope.py b/src/semantic/tools/scope.py new file mode 100755 index 000000000..4b08ebbd9 --- /dev/null +++ b/src/semantic/tools/scope.py @@ -0,0 +1,61 @@ +import itertools as itt +from .var import VariableInfo + +class Scope: + def __init__(self, parent=None): + self.locals = [] + self.cil_locals = {} + self.parent = parent + self.children = [] + self.index = 0 if parent is None else len(parent) + + def __len__(self): + return len(self.locals) + + def create_child(self): + child = Scope(self) + self.children.append(child) + return child + + def define_variable(self, vname, vtype): + info = VariableInfo(vname, vtype) + self.locals.append(info) + return info + + def define_cil_local(self, vname, cilname, vtype = None): + self.define_variable(vname, vtype) + self.cil_locals[vname] = cilname + + + def get_cil_local(self, vname): + if self.cil_locals.__contains__(vname): + return self.cil_locals[vname] + else: + return None + + def find_cil_local(self, vname, index=None): + locals = self.cil_locals.items() if index is None else itt.islice(self.cil_locals.items(), index) + try: + return next(cil_name for name, cil_name in locals if name == vname) + except StopIteration: + return self.parent.find_cil_local(vname, self.index) if (self.parent is not None) else None + + def find_variable(self, vname, index=None): + locals = self.locals if index is None else itt.islice( + self.locals, index) + try: + return next(x for x in locals if x.name == vname) + except StopIteration: + return self.parent.find_variable(vname, self.index) if (self.parent is not None) else None + + def is_defined(self, vname): + return self.find_variable(vname) is not None + + def is_defined_cil_local(self, vname): + return self.find_cil_local(vname ) is not None + + def is_local(self, vname): + return any(True for x in self.locals if x.name == vname) + + def remove_local(self, vname): + self.locals = [local for local in self.locals if local.name != vname] diff --git a/src/semantic/tools/type.py b/src/semantic/tools/type.py new file mode 100755 index 000000000..c47961aba --- /dev/null +++ b/src/semantic/tools/type.py @@ -0,0 +1,213 @@ +import itertools as itt +from .error import SemanticException +from .attribute import Attribute +from .methods import Method + +class Type: + def __init__(self, name: str): + self.name = name + self.sealed = False # indicates if this type is restricted for inheritance + self.attributes = [] + self.methods = {} + self.parent = None + self.tag = None + self.max_tag = None # biggest tag reachable in dfs from this type + + def set_parent(self, parent): + if self.parent is not None: + raise SemanticException(f'Parent type is already set for {self.name}.') + self.parent = parent + + def has_attr(self, name: str): + try: + attr_name = self.get_attribute(name) + except: + return False + else: + return True + + def get_attribute(self, name: str): + try: + return next(attr for attr in self.attributes if attr.name == name) + except StopIteration: + if self.parent is None: + raise SemanticException( + f'Attribute "{name}" is not defined in {self.name}.') + try: + return self.parent.get_attribute(name) + except SemanticException: + raise SemanticException( + f'Attribute "{name}" is not defined in {self.name}.') + + def define_attribute(self, name: str, typex): + if name == 'self': + raise SemanticException( + "'self' cannot be the name of an attribute") + try: + self.get_attribute(name) + except SemanticException: + attribute = Attribute(name, typex) + self.attributes.append(attribute) + return attribute + else: + raise SemanticException( + f'Attribute "{name}" is already defined in {self.name}.') + + def get_method(self, name: str): + try: + return self.methods[name] + except KeyError: + if self.parent is None: + raise SemanticException( + f'Method "{name}" is not defined in {self.name}.') + try: + return self.parent.get_method(name) + except SemanticException: + raise SemanticException( + f'Method "{name}" is not defined in {self.name}.') + + + def define_method(self, name: str, param_names: list, param_types: list, return_type): + try: + method = self.get_method(name) + except SemanticException: + method = self.methods[name] = Method( + name, param_names, param_types, return_type) + return method + else: + try: + self.methods[name] + except KeyError: + if method.return_type != return_type or method.param_types != param_types: + raise SemanticException( + f'Method "{name}" is already defined in {self.name} with a different signature') + else: + self.methods[name] = Method(name, param_names, param_types, return_type) + else: + raise SemanticException( + f'Method "{name}" is already defined in {self.name}') + + return method + + def get_all_attributes(self): + all_attributes = self.parent and self.parent.get_all_attributes() or [] + all_attributes += [(self.name, attr) for attr in self.attributes] + return all_attributes + + def get_all_methods(self): + all_methods = self.parent and self.parent.get_all_methods() or [] + all_methods += [(self.name, method) for method in self.methods] + return all_methods + + def conforms_to(self, other): + return other.bypass() or self == other or self.parent is not None and self.parent.conforms_to(other) + + def bypass(self): + return False + + def ancestors_path(self): + l = [] + l.append(self) + current_parent = self.parent + while (current_parent is not None): + l.append(current_parent) + current_parent = current_parent.parent + return l + + def join(self, other): + if self.name == other.name: + return self + + other_path = other.ancestors_path() + for p in self.ancestors_path(): + for o in other_path: + if o.name == p.name: + return p + return other + + def multiple_join(self, args): + least_type = self + + for t in args: + if isinstance(least_type, Error_Type) or isinstance(t, Error_Type): + least_type = Error_Type() + return least_type + least_type = least_type.join(t) + + return least_type + + def __str__(self): + output = f'type {self.name}' + parent = '' if self.parent is None else f' : {self.parent.name}' + output += parent + output += ' {' + output += '\n\t' if self.attributes or self.methods else '' + output += '\n\t'.join(str(x) for x in self.attributes) + output += '\n\t' if self.attributes else '' + output += '\n\t'.join(str(x) for x in self.methods.values()) + output += '\n' if self.methods else '' + output += '}\n' + return output + + def __repr__(self): + return str(self) + + +class Error_Type(Type): + def __init__(self): + Type.__init__(self, '') + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, Type) + + +class Object_Type(Type): + def __init__(self): + Type.__init__(self, 'Object') + + def bypass(self): + return True + + def __eq__(self, other): + return other.name == self.name or isinstance(other, Object_Type) + + +class IO_Type(Type): + def __init__(self): + Type.__init__(self, 'IO') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, IO_Type) + + +class String_Type(Type): + def __init__(self): + Type.__init__(self, 'String') + self.sealed = True + + def __eq__(self, other): + return other.name == self.name or isinstance(other, String_Type) + + +class Int_Type(Type): + def __init__(self): + Type.__init__(self, 'Int') + self.sealed = True + + def __eq__(self, other): + return other.name == self.name or isinstance(other, Int_Type) + + +class Bool_Type(Type): + def __init__(self): + Type.__init__(self, 'Bool') + self.sealed = True + + def __eq__(self, other): + return other.name == self.name or isinstance(other, Bool_Type) diff --git a/src/semantic/tools/var.py b/src/semantic/tools/var.py new file mode 100755 index 000000000..8c72d63f8 --- /dev/null +++ b/src/semantic/tools/var.py @@ -0,0 +1,13 @@ +import itertools as itt + + +class VariableInfo: + def __init__(self, name, vtype): + self.name = name + self.type = vtype + + def __str__(self): + return f'{self.name} : {self.type.name}' + + def __repr__(self): + return str(self) \ No newline at end of file diff --git a/src/semantic/visitor/__init__.py b/src/semantic/visitor/__init__.py new file mode 100755 index 000000000..6da6a8b6f --- /dev/null +++ b/src/semantic/visitor/__init__.py @@ -0,0 +1,4 @@ +from .type_collector import TypeCollector +from .type_builder import TypeBuilder +from .type_checker import TypeChecker +#from .s import * \ No newline at end of file diff --git a/src/semantic/visitor/type_builder.py b/src/semantic/visitor/type_builder.py new file mode 100755 index 000000000..9250415bb --- /dev/null +++ b/src/semantic/visitor/type_builder.py @@ -0,0 +1,148 @@ +from semantic.tools.error import SemanticError, SemanticException, circular_dependency_, attr_not_exist_, invalid_return_type_, param_not_exist_, inherits_builtin_type, main_method_not_exist_, Main_not_defined_ +from semantic.tools.type import Error_Type +from nodes.ast_nodes import ProgramNode, ClassNode, ClassMethodNode, AttrInitNode, AttrDefNode +from semantic.visitor import visitor + + +class TypeBuilder: + def __init__(self, context, errors=[]): + self.context = context + self.current_type = None + self.errors = errors + self.sort = [] # topologic sort for types + self.visited = {key: False for key in self.context.graph.keys()} # types visited by dfs + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node): + self.topological_sort() + for t in self.sort: + if t not in ['Object', 'Int', 'String', 'Bool', 'IO']: + try: + class_node = self.context.classes[t] + except KeyError: + pass + else: + self.visit(class_node) + if not self.context.types.__contains__('Main'): + error = SemanticError(Main_not_defined_, 0, 0,'TypeError') + self.errors.append(error) + else: + if not self.context.types['Main'].methods.__contains__('main'): + main_node = self.context.classes['Main'] + error = SemanticError(main_method_not_exist_, main_node.row, main_node.col,'AttributeError') + self.errors.append(error) + + + @visitor.when(ClassNode) + def visit(self, node): + try: + self.current_type = self.context.get_type(node.name) + if node.parent: + try: + parent = self.context.get_type(node.parent) + except SemanticException as e: + error = SemanticError(e.text, node.row, node.col, 'TypeError') + self.errors.append(error) + parent = Error_Type() + self.current_type.set_parent(parent) + else: + if parent.name in ['Int', 'String', 'Bool']: + parent = Error_Type() + error = SemanticError(inherits_builtin_type.replace("%s", node.name, 1), node.row, node.col) + self.errors.append(error) + self.current_type.set_parent(parent) + + except SemanticException as e: + error = SemanticError(e.text, node.row, node.col, 'TypeError') + self.errors.append(error) + + for f in node.features: + self.visit(f) + + @visitor.when(ClassMethodNode) + def visit(self, node): + try: + param_names = [] + param_types = [] + for p in node.params: + param_names.append(p.name) + try: + param_type = self.context.get_type(p.param_type) + except SemanticException: + param_type = Error_Type() + error = SemanticError(param_not_exist_.replace("%s", p.name, 1).replace("%s", node.name, 1).replace("%s", self.current_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + param_types.append(param_type) + + try: + return_type = self.context.get_type(node.return_type) + except SemanticException: + return_type = Error_Type() + error = SemanticError(invalid_return_type_.replace( "%s", node.return_type, 1).replace("%s", node.name, 1).replace("%s", self.current_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + self.current_type.define_method( + node.name, param_names, param_types, return_type) + except SemanticException as e: + error = SemanticError(e.text, node.row, node.col) + self.errors.append(error) + + @visitor.when(AttrInitNode) + def visit(self, node): + try: + attr_type = self.context.get_type(node.attr_type) + except SemanticException: + attr_type = Error_Type() + error = SemanticError(attr_not_exist_.replace( "%s", node.name, 1).replace("%s", self.current_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + try: + self.current_type.define_attribute(node.name, attr_type) + except SemanticException as e: + error = SemanticError(e.text, node.row, node.col) + self.errors.append(error) + + @visitor.when(AttrDefNode) + def visit(self, node): + try: + attr_type = self.context.get_type(node.attr_type) + except SemanticException: + attr_type = Error_Type() + error = SemanticError(attr_not_exist_.replace( "%s", node.name, 1).replace("%s", self.current_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + try: + self.current_type.define_attribute(node.name, attr_type) + except SemanticException as e: + error = SemanticError(e.text, node.row, node.col) + self.errors.append(error) + + + def dfs(self, actual_type): + self.sort.append(actual_type) + self.visited[actual_type] = True + for children in self.context.graph[actual_type]: + self.dfs(children) + + def topological_sort(self): + indeg = {key: 0 for key in self.context.graph.keys()} + for u in self.context.graph.keys(): + for v in self.context.graph[u]: + indeg[v] += 1 + + roots = [key for key in indeg.keys() if indeg[key] == 0] + + for v in roots: + self.dfs(v) + + visited = [x for x in self.visited] + visited.reverse() + for t in visited: + if not self.visited[t] and not t in ['Object', 'Int', 'String', 'Bool', 'IO']: + class_node = self.context.classes[t] + error = SemanticError(circular_dependency_.replace('%s', t, 1), class_node.row, class_node.col) + self.errors.append(error) + break diff --git a/src/semantic/visitor/type_checker.py b/src/semantic/visitor/type_checker.py new file mode 100755 index 000000000..6566a61c9 --- /dev/null +++ b/src/semantic/visitor/type_checker.py @@ -0,0 +1,488 @@ +from semantic.tools.error import incompatible_types_, param_wrong_signature, invalid_SELFTYPE, self_name, incorrect_count_params_, read_only_, var_not_defined_, other_branch_declared_, wrong_type_, self_let_, SemanticError, SemanticException +from semantic.tools.type import Error_Type +from semantic.tools.scope import Scope +#from nodes import * +from nodes.ast_nodes import * +from nodes.expr_nodes import * +from nodes.operations_nodes import * +from semantic.visitor import visitor + + +class TypeChecker: + def __init__(self, context, errors=[]): + self.context = context + self.current_type = None + self.current_method = None + self.errors = errors + + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(ProgramNode) + def visit(self, node, scope=None): + scope = Scope() + for c in node.classes: + self.visit(c, scope.create_child()) + return scope + + @visitor.when(ClassNode) + def visit(self, node, scope): + self.current_type = self.context.get_type(node.name) + scope.define_variable('self', self.current_type) + + attributes = self.current_type.get_all_attributes() + for _, attr in attributes: + if attr.type.name == 'SELF_TYPE': + scope.define_variable(attr.name, self.current_type) + else: + scope.define_variable(attr.name, attr.type) + + for feature in node.features: + self.visit(feature, scope) + + @visitor.when(AttrInitNode) + def visit(self, node, scope): + try: + node_type = self.current_type.get_attribute(node.name).type + except SemanticException as ex: + node_type = Error_Type() + error = SemanticError(ex.text, node.row, node.col, 'AttributeError') + self.errors.append(error) + + self.visit(node.expression, scope) + expr_type = node.expression.expr_type + + if not expr_type.conforms_to(node_type): + error = SemanticError(incompatible_types_.replace( + '%s', expr_type.name, 1).replace('%s', node_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + @visitor.when(AttrDefNode) + def visit(self, node, scope): + try: + self.current_type.get_attribute(node.name) + except SemanticException as ex: + error = SemanticError(ex.text, node.row, node.col, 'AttributeError') + self.errors.append(error) + + @visitor.when(ClassMethodNode) + def visit(self, node, scope): + try: + self.current_method = self.current_type.get_method(node.name) + except SemanticException as ex: + error = SemanticError(ex.text, node.row, node.col, 'AttributeError') + self.errors.append(error) + + method_scope = scope.create_child() + + for param in node.params: + self.visit(param, method_scope) + + self.visit(node.expression, method_scope) + + expr_type = node.expression.expr_type + + return_type = self.current_method.return_type + + if expr_type.name == 'SELF_TYPE': + if not self.current_type.conforms_to(return_type): + error = SemanticError(incompatible_types_.replace( + '%s', expr_type.name, 1).replace('%s', self.current_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + elif not expr_type.conforms_to(return_type): + error = SemanticError(incompatible_types_.replace( + '%s', expr_type.name, 1).replace('%s', return_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + + @visitor.when(FormalParamNode) + def visit(self, node, scope): + try: + node_type = self.context.get_type(node.param_type) + if node_type.name == 'SELF_TYPE': + node_type = Error_Type() + error = SemanticError(invalid_SELFTYPE, node.row, node.col) + self.errors.append(error) + + except SemanticException as ex: + node_type = Error_Type() + error = SemanticError(ex.text, node.row, node.col, 'TypeError') + self.errors.append(error) + + if node.name == 'self': + error = SemanticError(self_name, node.row, node.col) + self.errors.append(error) + elif not scope.is_local(node.name): + scope.define_variable(node.name, node_type) + else: + error = SemanticError(param_wrong_signature.replace( + '%s', node.name, 1).replace('%s', self.current_method.name, 1), node.row, node.col) + self.errors.append(error) + + @visitor.when(DynamicCallNode) + def visit(self, node, scope): + self.visit(node.obj, scope) + instance_type = node.obj.expr_type + + if instance_type.name == 'SELF_TYPE': + instance_type = scope.find_variable('self').type + try: + instance_method = instance_type.get_method(node.method) + + if len(node.args) == len(instance_method.param_types): + for arg, param_type in zip(node.args, instance_method.param_types): + self.visit(arg, scope) + arg_type = arg.expr_type + + if not arg_type.conforms_to(param_type): + error = SemanticError(incompatible_types_.replace( + '%s', arg_type.name, 1).replace('%s', param_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + else: + error = SemanticError(incorrect_count_params_.replace("%s", instance_method.name, 1).replace("%s", instance_type.name, 1).replace("%s", str(len(instance_method.param_types)), 1), node.row, node.col) + self.errors.append(error) + + if instance_method.return_type.name == 'SELF_TYPE': + node_type = instance_type + else: + node_type = instance_method.return_type + + except SemanticException as ex: + node_type = Error_Type() + error = SemanticError(ex.text, node.row, node.col, 'AttributeError') + self.errors.append(error) + + node.expr_type = node_type + + @visitor.when(StaticCallNode) + def visit(self, node, scope): + self.visit(node.obj, scope) + instance_type = node.obj.expr_type + + try: + static_type = self.context.get_type(node.static_type) + except SemanticException as ex: + static_type = Error_Type() + error = SemanticError(ex.text, node.row, node.col, 'TypeError') + self.errors.append(error) + + if not instance_type.conforms_to(static_type): + error = SemanticError(incompatible_types_.replace( + '%s', instance_type.name, 1).replace('%s', static_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + try: + method = static_type.get_method(node.method) + + if len(node.args) == len(method.param_types): + for arg, param_type in zip(node.args, method.param_types): + self.visit(arg, scope) + arg_type = arg.expr_type + + if not arg_type.conforms_to(param_type): + error = SemanticError(incompatible_types_.replace( + '%s', arg_type.name, 1).replace('%s', param_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + else: + error = SemanticError( incorrect_count_params_.replace('%s', method.name, 1).replace('%s', static_type.name, 1).replace('%s', str(len(method.param_types)), 1), node.row, node.col) + self.errors.append(error) + + if method.return_type.name == 'SELF_TYPE': + node_type = instance_type + node_type = method.return_type + + except SemanticException as ex: + error = SemanticError(ex.text, node.row, node.col, 'AttributeError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(AssignNode) + def visit(self, node, scope): + self.visit(node.expression, scope) + node_type = node.expression.expr_type + + if scope.is_defined(node.name): + var = scope.find_variable(node.name) + + if var.name == 'self': + error = SemanticError(read_only_, node.row, node.col) + self.errors.append(error) + node_type = Error_Type() + elif not node_type.conforms_to(var.type): + error = SemanticError(incompatible_types_.replace( + '%s', node_type.name, 1).replace('%s', var.type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + else: + error = SemanticError(var_not_defined_.replace( + '%s', node.name, 1), node.row, node.col, 'NameError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(CaseNode) + def visit(self, node, scope): + self.visit(node.expression, scope) + action_expr_types = [] + var_declared = [] + + for action in node.act_list: + var_type = action.act_type + if not var_type in var_declared: + var_declared.append(var_type) + else: + error = SemanticError(other_branch_declared_.replace("%s", var_type, 1), action.row, action.col) + self.errors.append(error) + self.visit(action, scope.create_child()) + action_expr_types.append(action.expr_type) + + t_0 = action_expr_types.pop(0) + node_type = t_0.multiple_join(action_expr_types) + + node.expr_type = node_type + + @visitor.when(ActionNode) + def visit(self, node, scope): + try: + action_type = self.context.get_type(node.act_type) + except SemanticException as ex: + error = SemanticError(ex.text, node.row, node.col , 'TypeError') + self.errors.append(error) + action_type = Error_Type() + + scope.define_variable(node.name, action_type) + + self.visit(node.body, scope) + node.expr_type = node.body.expr_type + + @visitor.when(IfNode) + def visit(self, node, scope): + self.visit(node.predicate, scope) + predicate_type = node.predicate.expr_type + + if predicate_type.name != 'Bool': + error = SemanticError(wrong_type_.replace('%s', 'Bool', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + self.visit(node.then_expr, scope) + then_type = node.then_expr.expr_type + self.visit(node.else_expr, scope) + else_type = node.else_expr.expr_type + + node.expr_type = then_type.join(else_type) + + + @visitor.when(WhileNode) + def visit(self, node, scope): + self.visit(node.predicate, scope) + predicate_type = node.predicate.expr_type + + if predicate_type.name != 'Bool': + error = SemanticError(wrong_type_.replace('%s', 'Bool', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + self.visit(node.expression, scope) + + node.expr_type = self.context.get_type('Object') + + @visitor.when(BlockNode) + def visit(self, node, scope): + for expr in node.expr_list: + self.visit(expr, scope) + + node.expr_type = node.expr_list[-1].expr_type + + @visitor.when(LetNode) + def visit(self, node, scope): + let_scope = scope.create_child() + + for var in node.init_list: + self.visit(var, let_scope) + + self.visit(node.body, let_scope) + + node.expr_type = node.body.expr_type + + @visitor.when(LetInitNode) + def visit(self, node, scope): + try: + node_type = self.context.get_type(node.let_type) + if node_type.name == 'SELF_TYPE': + node_type = scope.find_variable('self').type + except SemanticException as ex: + error = SemanticError(ex.text, node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + self.visit(node.expression, scope) + expr_type = node.expression.expr_type + + if not expr_type.conforms_to(node_type): + error = SemanticError(incompatible_types_.replace( + '%s', expr_type.name, 1).replace('%s', node_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + + if node.name == 'self': + error = SemanticError(self_let_, node.row, node.col) + self.errors.append(error) + else: + if scope.is_local(node.name): + scope.remove_local(node.name) + + scope.define_variable(node.name, node_type) + + @visitor.when(LetDefNode) + def visit(self, node, scope): + try: + node_type = self.context.get_type(node.let_type) + if node_type.name == 'SELF_TYPE': + node_type = scope.find_variable('self').type + except SemanticException as ex: + error = SemanticError(ex.text, node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + if node.name == 'self': + error = SemanticError(self_let_, node.row, node.col) + self.errors.append(error) + else: + if scope.is_local(node.name): + scope.remove_local(node.name) + + scope.define_variable(node.name, node_type) + + @visitor.when(NewNode) + def visit(self, node, scope): + try: + node_type = self.context.get_type(node.new_type) + if node_type.name == 'SELF_TYPE': + node_type = scope.find_variable('self').type + except SemanticException as ex: + error = SemanticError(ex.text, node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(IsVoidNode) + def visit(self, node, scope): + self.visit(node.expression, scope) + node.expr_type = self.context.get_type('Bool') + + @visitor.when(ArithBinOpNode) + def visit(self, node, scope): + node_type = self.context.get_type('Int') + + self.visit(node.left, scope) + left_type = node.left.expr_type + + if left_type.name != 'Int': + error = SemanticError(wrong_type_.replace('%s', 'Int', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + self.visit(node.right, scope) + right_type = node.right.expr_type + + if right_type.name != 'Int': + error = SemanticError(wrong_type_.replace('%s', 'Int', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(LogicBinOpNode) + def visit(self, node, scope): + node_type = self.context.get_type('Bool') + + self.visit(node.left, scope) + left_type = node.left.expr_type + + if left_type.name != 'Int': + error = SemanticError(wrong_type_.replace('%s', 'Int', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + self.visit(node.right, scope) + right_type = node.right.expr_type + + if right_type.name != 'Int': + error = SemanticError(wrong_type_.replace('%s', 'Int', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(NotNode) + def visit(self, node, scope): + node_type = self.context.get_type('Bool') + + self.visit(node.expression, scope) + expr_type = node.expression.expr_type + + if expr_type.name != 'Bool': + error = SemanticError(wrong_type_.replace('%s', 'Bool', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(LogicNotNode) + def visit(self, node, scope): + node_type = self.context.get_type('Int') + + self.visit(node.expression, scope) + expr_type = node.expression.expr_type + + if expr_type.name != 'Int': + error = SemanticError(wrong_type_.replace('%s', 'Int', 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(EqualsNode) + def visit(self, node, scope): + node_type = self.context.get_type('Bool') + + self.visit(node.left, scope) + left_type = node.left.expr_type + + self.visit(node.right, scope) + right_type = node.right.expr_type + + if (left_type.name in ['Int', 'Bool', 'String'] or right_type.name in ['Int', 'Bool', 'String']) and left_type.name != right_type.name: + error = SemanticError(wrong_type_.replace('%s', left_type.name, 1), node.row, node.col, 'TypeError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + + @visitor.when(IdNode) + def visit(self, node, scope): + if scope.is_defined(node.name): + node_type = scope.find_variable(node.name).type + else: + error = SemanticError(var_not_defined_.replace( + '%s', node.name, 1), node.row, node.col, 'NameError') + self.errors.append(error) + node_type = Error_Type() + + node.expr_type = node_type + + @visitor.when(IntegerNode) + def visit(self, node, scope): + node.expr_type = self.context.get_type('Int') + + @visitor.when(StringNode) + def visit(self, node, scope): + node.expr_type = self.context.get_type('String') + + @visitor.when(BooleanNode) + def visit(self, node, scope): + node.expr_type = self.context.get_type('Bool') diff --git a/src/semantic/visitor/type_collector.py b/src/semantic/visitor/type_collector.py new file mode 100755 index 000000000..df1a4fd7d --- /dev/null +++ b/src/semantic/visitor/type_collector.py @@ -0,0 +1,32 @@ +from semantic.tools.context import Context +from semantic.tools.error import SemanticError, SemanticException +from nodes.ast_nodes import ProgramNode, ClassNode +from semantic.visitor import visitor + +class TypeCollector(object): + def __init__(self, errors=[]): + self.context = None + self.errors = errors + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node): + self.context = Context() + self.context.create_builtin_types() + for dec in node.classes: + if dec.name in ['Object', 'Int', 'String', 'Bool', 'IO']: + error = SemanticError("Is an error redefine a builint type", dec.row, dec.col) + self.errors.append(error) + else: + self.visit(dec) + + @visitor.when(ClassNode) + def visit(self, node): + try: + self.context.create_type(node) + except SemanticException as e: + error = SemanticError(e.text, node.row, node.col) + self.errors.append(error) diff --git a/src/semantic/visitor/visitor.py b/src/semantic/visitor/visitor.py new file mode 100755 index 000000000..f3acbd02b --- /dev/null +++ b/src/semantic/visitor/visitor.py @@ -0,0 +1,58 @@ +import inspect + +__all__ = ['on', 'when'] + +def on(param_name): + def f(fn): + dispatcher = Dispatcher(param_name, fn) + return dispatcher + return f + + +def when(param_type): + def f(fn): + frame = inspect.currentframe().f_back + func_name = fn.func_name if 'func_name' in dir(fn) else fn.__name__ + dispatcher = frame.f_locals[func_name] + if not isinstance(dispatcher, Dispatcher): + dispatcher = dispatcher.dispatcher + dispatcher.add_target(param_type, fn) + def ff(*args, **kw): + return dispatcher(*args, **kw) + ff.dispatcher = dispatcher + return ff + return f + + +class Dispatcher(object): + def __init__(self, param_name, fn): + frame = inspect.currentframe().f_back.f_back + top_level = frame.f_locals == frame.f_globals + self.param_index = self.__argspec(fn).args.index(param_name) + self.param_name = param_name + self.targets = {} + + def __call__(self, *args, **kw): + typ = args[self.param_index].__class__ + d = self.targets.get(typ) + if d is not None: + return d(*args, **kw) + else: + issub = issubclass + t = self.targets + ks = t.keys() + ans = [t[k](*args, **kw) for k in ks if issub(typ, k)] + if len(ans) == 1: + return ans.pop() + return ans + + def add_target(self, typ, target): + self.targets[typ] = target + + @staticmethod + def __argspec(fn): + # Support for Python 3 type hints requires inspect.getfullargspec + if hasattr(inspect, 'getfullargspec'): + return inspect.getfullargspec(fn) + else: + return inspect.getargspec(fn) diff --git a/src/venv/bin/Activate.ps1 b/src/venv/bin/Activate.ps1 new file mode 100644 index 000000000..2fb3852c3 --- /dev/null +++ b/src/venv/bin/Activate.ps1 @@ -0,0 +1,241 @@ +<# +.Synopsis +Activate a Python virtual environment for the current PowerShell session. + +.Description +Pushes the python executable for a virtual environment to the front of the +$Env:PATH environment variable and sets the prompt to signify that you are +in a Python virtual environment. Makes use of the command line switches as +well as the `pyvenv.cfg` file values present in the virtual environment. + +.Parameter VenvDir +Path to the directory that contains the virtual environment to activate. The +default value for this is the parent of the directory that the Activate.ps1 +script is located within. + +.Parameter Prompt +The prompt prefix to display when this virtual environment is activated. By +default, this prompt is the name of the virtual environment folder (VenvDir) +surrounded by parentheses and followed by a single space (ie. '(.venv) '). + +.Example +Activate.ps1 +Activates the Python virtual environment that contains the Activate.ps1 script. + +.Example +Activate.ps1 -Verbose +Activates the Python virtual environment that contains the Activate.ps1 script, +and shows extra information about the activation as it executes. + +.Example +Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv +Activates the Python virtual environment located in the specified location. + +.Example +Activate.ps1 -Prompt "MyPython" +Activates the Python virtual environment that contains the Activate.ps1 script, +and prefixes the current prompt with the specified string (surrounded in +parentheses) while the virtual environment is active. + +.Notes +On Windows, it may be required to enable this Activate.ps1 script by setting the +execution policy for the user. You can do this by issuing the following PowerShell +command: + +PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + +For more information on Execution Policies: +https://go.microsoft.com/fwlink/?LinkID=135170 + +#> +Param( + [Parameter(Mandatory = $false)] + [String] + $VenvDir, + [Parameter(Mandatory = $false)] + [String] + $Prompt +) + +<# Function declarations --------------------------------------------------- #> + +<# +.Synopsis +Remove all shell session elements added by the Activate script, including the +addition of the virtual environment's Python executable from the beginning of +the PATH variable. + +.Parameter NonDestructive +If present, do not remove this function from the global namespace for the +session. + +#> +function global:deactivate ([switch]$NonDestructive) { + # Revert to original values + + # The prior prompt: + if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { + Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt + Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT + } + + # The prior PYTHONHOME: + if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { + Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME + Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME + } + + # The prior PATH: + if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { + Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH + Remove-Item -Path Env:_OLD_VIRTUAL_PATH + } + + # Just remove the VIRTUAL_ENV altogether: + if (Test-Path -Path Env:VIRTUAL_ENV) { + Remove-Item -Path env:VIRTUAL_ENV + } + + # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: + if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { + Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force + } + + # Leave deactivate function in the global namespace if requested: + if (-not $NonDestructive) { + Remove-Item -Path function:deactivate + } +} + +<# +.Description +Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the +given folder, and returns them in a map. + +For each line in the pyvenv.cfg file, if that line can be parsed into exactly +two strings separated by `=` (with any amount of whitespace surrounding the =) +then it is considered a `key = value` line. The left hand string is the key, +the right hand is the value. + +If the value starts with a `'` or a `"` then the first and last character is +stripped from the value before being captured. + +.Parameter ConfigDir +Path to the directory that contains the `pyvenv.cfg` file. +#> +function Get-PyVenvConfig( + [String] + $ConfigDir +) { + Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" + + # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). + $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue + + # An empty map will be returned if no config file is found. + $pyvenvConfig = @{ } + + if ($pyvenvConfigPath) { + + Write-Verbose "File exists, parse `key = value` lines" + $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath + + $pyvenvConfigContent | ForEach-Object { + $keyval = $PSItem -split "\s*=\s*", 2 + if ($keyval[0] -and $keyval[1]) { + $val = $keyval[1] + + # Remove extraneous quotations around a string value. + if ("'""".Contains($val.Substring(0, 1))) { + $val = $val.Substring(1, $val.Length - 2) + } + + $pyvenvConfig[$keyval[0]] = $val + Write-Verbose "Adding Key: '$($keyval[0])'='$val'" + } + } + } + return $pyvenvConfig +} + + +<# Begin Activate script --------------------------------------------------- #> + +# Determine the containing directory of this script +$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$VenvExecDir = Get-Item -Path $VenvExecPath + +Write-Verbose "Activation script is located in path: '$VenvExecPath'" +Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" +Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" + +# Set values required in priority: CmdLine, ConfigFile, Default +# First, get the location of the virtual environment, it might not be +# VenvExecDir if specified on the command line. +if ($VenvDir) { + Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" +} +else { + Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." + $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") + Write-Verbose "VenvDir=$VenvDir" +} + +# Next, read the `pyvenv.cfg` file to determine any required value such +# as `prompt`. +$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir + +# Next, set the prompt from the command line, or the config file, or +# just use the name of the virtual environment folder. +if ($Prompt) { + Write-Verbose "Prompt specified as argument, using '$Prompt'" +} +else { + Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" + if ($pyvenvCfg -and $pyvenvCfg['prompt']) { + Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" + $Prompt = $pyvenvCfg['prompt']; + } + else { + Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virutal environment)" + Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" + $Prompt = Split-Path -Path $venvDir -Leaf + } +} + +Write-Verbose "Prompt = '$Prompt'" +Write-Verbose "VenvDir='$VenvDir'" + +# Deactivate any currently active virtual environment, but leave the +# deactivate function in place. +deactivate -nondestructive + +# Now set the environment variable VIRTUAL_ENV, used by many tools to determine +# that there is an activated venv. +$env:VIRTUAL_ENV = $VenvDir + +if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { + + Write-Verbose "Setting prompt to '$Prompt'" + + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT { "" } + Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT + New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt + + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " + _OLD_VIRTUAL_PROMPT + } +} + +# Clear PYTHONHOME +if (Test-Path -Path Env:PYTHONHOME) { + Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME + Remove-Item -Path Env:PYTHONHOME +} + +# Add the venv to the PATH +Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH +$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/src/venv/bin/activate b/src/venv/bin/activate new file mode 100644 index 000000000..44737126c --- /dev/null +++ b/src/venv/bin/activate @@ -0,0 +1,76 @@ +# This file must be used with "source bin/activate" *from bash* +# you cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # This should detect bash and zsh, which have a hash command that must + # be called to get it to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r + fi + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + if [ ! "${1:-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +VIRTUAL_ENV="/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv" +export VIRTUAL_ENV + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/bin:$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + if [ "x(venv) " != x ] ; then + PS1="(venv) ${PS1:-}" + else + if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1" + else + PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1" + fi + fi + export PS1 +fi + +# This should detect bash and zsh, which have a hash command that must +# be called to get it to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r +fi diff --git a/src/venv/bin/activate.csh b/src/venv/bin/activate.csh new file mode 100644 index 000000000..c5172ccc4 --- /dev/null +++ b/src/venv/bin/activate.csh @@ -0,0 +1,37 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV "/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv" + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/bin:$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + if ("venv" != "") then + set env_name = "venv" + else + if (`basename "VIRTUAL_ENV"` == "__") then + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + set env_name = `basename \`dirname "$VIRTUAL_ENV"\`` + else + set env_name = `basename "$VIRTUAL_ENV"` + endif + endif + set prompt = "[$env_name] $prompt" + unset env_name +endif + +alias pydoc python -m pydoc + +rehash diff --git a/src/venv/bin/activate.fish b/src/venv/bin/activate.fish new file mode 100644 index 000000000..38dd5266e --- /dev/null +++ b/src/venv/bin/activate.fish @@ -0,0 +1,75 @@ +# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org) +# you cannot run it directly + +function deactivate -d "Exit virtualenv and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + functions -e fish_prompt + set -e _OLD_FISH_PROMPT_OVERRIDE + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + + set -e VIRTUAL_ENV + if test "$argv[1]" != "nondestructive" + # Self destruct! + functions -e deactivate + end +end + +# unset irrelevant variables +deactivate nondestructive + +set -gx VIRTUAL_ENV "/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv" + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/bin" $PATH + +# unset PYTHONHOME if set +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # save the current fish_prompt function as the function _old_fish_prompt + functions -c fish_prompt _old_fish_prompt + + # with the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command + set -l old_status $status + + # Prompt override? + if test -n "(venv) " + printf "%s%s" "(venv) " (set_color normal) + else + # ...Otherwise, prepend env + set -l _checkbase (basename "$VIRTUAL_ENV") + if test $_checkbase = "__" + # special case for Aspen magic directories + # see http://www.zetadev.com/software/aspen/ + printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal) + else + printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal) + end + end + + # Restore the return status of the previous command. + echo "exit $old_status" | . + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" +end diff --git a/src/venv/bin/easy_install b/src/venv/bin/easy_install new file mode 100755 index 000000000..1e88bc95b --- /dev/null +++ b/src/venv/bin/easy_install @@ -0,0 +1,8 @@ +#!/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from setuptools.command.easy_install import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/src/venv/bin/pip b/src/venv/bin/pip new file mode 100755 index 000000000..9c3bb9364 --- /dev/null +++ b/src/venv/bin/pip @@ -0,0 +1,8 @@ +#!/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/src/venv/bin/pip3 b/src/venv/bin/pip3 new file mode 100755 index 000000000..9c3bb9364 --- /dev/null +++ b/src/venv/bin/pip3 @@ -0,0 +1,8 @@ +#!/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pip._internal.cli.main import main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(main()) diff --git a/src/venv/bin/py.test b/src/venv/bin/py.test new file mode 100755 index 000000000..3f77f6b9f --- /dev/null +++ b/src/venv/bin/py.test @@ -0,0 +1,8 @@ +#!/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pytest import console_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(console_main()) diff --git a/src/venv/bin/pytest b/src/venv/bin/pytest new file mode 100755 index 000000000..3f77f6b9f --- /dev/null +++ b/src/venv/bin/pytest @@ -0,0 +1,8 @@ +#!/home/shey/Documents/Escuela/4to/Cmp/cool-compiler-2021/src/venv/bin/python3 +# -*- coding: utf-8 -*- +import re +import sys +from pytest import console_main +if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) + sys.exit(console_main()) diff --git a/src/venv/bin/python b/src/venv/bin/python new file mode 120000 index 000000000..b8a0adbbb --- /dev/null +++ b/src/venv/bin/python @@ -0,0 +1 @@ +python3 \ No newline at end of file diff --git a/src/venv/bin/python3 b/src/venv/bin/python3 new file mode 120000 index 000000000..ae65fdaa1 --- /dev/null +++ b/src/venv/bin/python3 @@ -0,0 +1 @@ +/usr/bin/python3 \ No newline at end of file diff --git a/src/venv/lib64 b/src/venv/lib64 new file mode 120000 index 000000000..7951405f8 --- /dev/null +++ b/src/venv/lib64 @@ -0,0 +1 @@ +lib \ No newline at end of file diff --git a/src/venv/pyvenv.cfg b/src/venv/pyvenv.cfg new file mode 100644 index 000000000..8dbc2bab8 --- /dev/null +++ b/src/venv/pyvenv.cfg @@ -0,0 +1,3 @@ +home = /usr/bin +include-system-site-packages = false +version = 3.8.5 diff --git a/src/venv/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl b/src/venv/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl new file mode 100644 index 000000000..bd54b9bf4 Binary files /dev/null and b/src/venv/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/appdirs-1.4.3-py2.py3-none-any.whl b/src/venv/share/python-wheels/appdirs-1.4.3-py2.py3-none-any.whl new file mode 100644 index 000000000..a52728b76 Binary files /dev/null and b/src/venv/share/python-wheels/appdirs-1.4.3-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/certifi-2019.11.28-py2.py3-none-any.whl b/src/venv/share/python-wheels/certifi-2019.11.28-py2.py3-none-any.whl new file mode 100644 index 000000000..77ec5fbdf Binary files /dev/null and b/src/venv/share/python-wheels/certifi-2019.11.28-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/chardet-3.0.4-py2.py3-none-any.whl b/src/venv/share/python-wheels/chardet-3.0.4-py2.py3-none-any.whl new file mode 100644 index 000000000..09a68abf4 Binary files /dev/null and b/src/venv/share/python-wheels/chardet-3.0.4-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/colorama-0.4.3-py2.py3-none-any.whl b/src/venv/share/python-wheels/colorama-0.4.3-py2.py3-none-any.whl new file mode 100644 index 000000000..071333268 Binary files /dev/null and b/src/venv/share/python-wheels/colorama-0.4.3-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/contextlib2-0.6.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/contextlib2-0.6.0-py2.py3-none-any.whl new file mode 100644 index 000000000..c0e697532 Binary files /dev/null and b/src/venv/share/python-wheels/contextlib2-0.6.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/distlib-0.3.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/distlib-0.3.0-py2.py3-none-any.whl new file mode 100644 index 000000000..819ffabc9 Binary files /dev/null and b/src/venv/share/python-wheels/distlib-0.3.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl new file mode 100644 index 000000000..78243cc0b Binary files /dev/null and b/src/venv/share/python-wheels/distro-1.4.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/html5lib-1.0.1-py2.py3-none-any.whl b/src/venv/share/python-wheels/html5lib-1.0.1-py2.py3-none-any.whl new file mode 100644 index 000000000..dd1359688 Binary files /dev/null and b/src/venv/share/python-wheels/html5lib-1.0.1-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/idna-2.8-py2.py3-none-any.whl b/src/venv/share/python-wheels/idna-2.8-py2.py3-none-any.whl new file mode 100644 index 000000000..ccd236bb6 Binary files /dev/null and b/src/venv/share/python-wheels/idna-2.8-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl new file mode 100644 index 000000000..d013ec546 Binary files /dev/null and b/src/venv/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl b/src/venv/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl new file mode 100644 index 000000000..26ddc279b Binary files /dev/null and b/src/venv/share/python-wheels/lockfile-0.12.2-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/msgpack-0.6.2-py2.py3-none-any.whl b/src/venv/share/python-wheels/msgpack-0.6.2-py2.py3-none-any.whl new file mode 100644 index 000000000..12ecde965 Binary files /dev/null and b/src/venv/share/python-wheels/msgpack-0.6.2-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/packaging-20.3-py2.py3-none-any.whl b/src/venv/share/python-wheels/packaging-20.3-py2.py3-none-any.whl new file mode 100644 index 000000000..6978f2aa5 Binary files /dev/null and b/src/venv/share/python-wheels/packaging-20.3-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl b/src/venv/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl new file mode 100644 index 000000000..3ce172aef Binary files /dev/null and b/src/venv/share/python-wheels/pep517-0.8.2-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/pip-20.0.2-py2.py3-none-any.whl b/src/venv/share/python-wheels/pip-20.0.2-py2.py3-none-any.whl new file mode 100644 index 000000000..17982ec22 Binary files /dev/null and b/src/venv/share/python-wheels/pip-20.0.2-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl new file mode 100644 index 000000000..4aa6219f4 Binary files /dev/null and b/src/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/progress-1.5-py2.py3-none-any.whl b/src/venv/share/python-wheels/progress-1.5-py2.py3-none-any.whl new file mode 100644 index 000000000..dfa9185af Binary files /dev/null and b/src/venv/share/python-wheels/progress-1.5-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/pyparsing-2.4.6-py2.py3-none-any.whl b/src/venv/share/python-wheels/pyparsing-2.4.6-py2.py3-none-any.whl new file mode 100644 index 000000000..6ace19132 Binary files /dev/null and b/src/venv/share/python-wheels/pyparsing-2.4.6-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/pytoml-0.1.21-py2.py3-none-any.whl b/src/venv/share/python-wheels/pytoml-0.1.21-py2.py3-none-any.whl new file mode 100644 index 000000000..bf9e9b363 Binary files /dev/null and b/src/venv/share/python-wheels/pytoml-0.1.21-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl new file mode 100644 index 000000000..34e8c3e13 Binary files /dev/null and b/src/venv/share/python-wheels/requests-2.22.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl b/src/venv/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl new file mode 100644 index 000000000..bfbb61c83 Binary files /dev/null and b/src/venv/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/setuptools-44.0.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/setuptools-44.0.0-py2.py3-none-any.whl new file mode 100644 index 000000000..a334395f4 Binary files /dev/null and b/src/venv/share/python-wheels/setuptools-44.0.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/six-1.14.0-py2.py3-none-any.whl b/src/venv/share/python-wheels/six-1.14.0-py2.py3-none-any.whl new file mode 100644 index 000000000..d49a86467 Binary files /dev/null and b/src/venv/share/python-wheels/six-1.14.0-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl b/src/venv/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl new file mode 100644 index 000000000..00080d686 Binary files /dev/null and b/src/venv/share/python-wheels/urllib3-1.25.8-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl b/src/venv/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl new file mode 100644 index 000000000..76ff3422b Binary files /dev/null and b/src/venv/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl differ diff --git a/src/venv/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl b/src/venv/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl new file mode 100644 index 000000000..772e407fb Binary files /dev/null and b/src/venv/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl differ diff --git a/src/yacctab.py b/src/yacctab.py new file mode 100644 index 000000000..fd9124707 --- /dev/null +++ b/src/yacctab.py @@ -0,0 +1,90 @@ + +# yacctab.py +# This file is automatically generated. Do not edit. +# pylint: disable=W,C,R +_tabversion = '3.10' + +_lr_method = 'LALR' + +_lr_signature = 'rightASSIGNrightNOTnonassocLESSLESSEQEQUALleftPLUSMINUSleftMULTIPLYDIVIDErightISVOIDrightNOXrightARROBArightDOTARROBA ARROW ASSIGN BOOLEAN BOOL_TYPE CASE CLASS COLON COMMA DIVIDE DOT ELSE EQUAL ESAC FALSE FI ID IF IN INHERITS INTEGER INT_TYPE IO_TYPE ISVOID LBRACE LESS LESSEQ LET LOOP LPAREN LexicographicError MAIN_TYPE MINUS MULTIPLY NEW NOT NOX OBJECT_TYPE OF PLUS POOL RBRACE RPAREN SELF_TYPE SEMIC STRING STRING_TYPE THEN TRUE TYPE WHILE\n program : class_list\n \n class_list : class_list class SEMIC\n | class SEMIC\n \n class : CLASS TYPE LBRACE feature_opt RBRACE\n \n class : CLASS TYPE INHERITS TYPE LBRACE feature_opt RBRACE\n \n feature_list : feature_list feature SEMIC\n | feature SEMIC\n \n feature_opt : feature_list\n | empty\n \n feature : ID LPAREN formal_param_list RPAREN COLON TYPE LBRACE expr RBRACE\n \n feature : ID LPAREN RPAREN COLON TYPE LBRACE expr RBRACE\n \n feature : attr_init\n \n attr_init : ID COLON TYPE ASSIGN expr \n | attr_def\n \n attr_def : ID COLON TYPE\n \n action_list : action_list action\n | action\n \n let_var : let_init\n | let_var COMMA let_init\n \n let_init : ID COLON TYPE ASSIGN expr \n | let_def\n \n let_def : ID COLON TYPE\n \n formal_param_list : formal_param_list COMMA formal_param\n | formal_param\n \n formal_param : ID COLON TYPE\n \n args_list : args_list COMMA expr\n | expr\n \n args_list_opt : args_list\n | empty\n \n action : ID COLON TYPE ARROW expr SEMIC\n \n expr : expr DOT ID LPAREN args_list_opt RPAREN\n \n expr : expr ARROBA TYPE DOT ID LPAREN args_list_opt RPAREN\n \n expr : ID LPAREN args_list_opt RPAREN\n \n expr : ID ASSIGN expr\n \n expr : IF expr THEN expr ELSE expr FI\n \n expr : WHILE expr LOOP expr POOL\n \n block_list : block_list expr SEMIC\n | expr SEMIC\n \n expr : LBRACE block_list RBRACE\n \n expr : let_expr\n \n let_expr : LET let_var IN expr\n \n expr : CASE expr OF action_list ESAC\n \n expr : NEW TYPE\n \n expr : ISVOID expr\n \n expr : ID\n \n expr : INTEGER\n \n expr : STRING\n \n expr : TRUE \n | FALSE\n \n expr : expr PLUS expr\n | expr MINUS expr\n | expr MULTIPLY expr\n | expr DIVIDE expr\n | expr LESS expr\n | expr LESSEQ expr\n | expr EQUAL expr\n \n expr : NOX expr\n | NOT expr\n \n expr : LPAREN expr RPAREN\n \n empty :\n ' + +_lr_action_items = {'CLASS':([0,2,6,8,],[4,4,-3,-2,]),'$end':([1,2,6,8,],[0,-1,-3,-2,]),'SEMIC':([3,5,14,16,17,19,20,30,37,42,43,48,52,53,54,55,76,78,79,80,81,92,95,96,97,98,99,100,101,102,105,106,113,114,124,127,132,133,137,143,145,146,],[6,8,21,-12,-14,-4,25,-15,-5,-45,-13,-40,-46,-47,-48,-49,107,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,120,-11,-33,-41,-10,-36,-42,-31,-35,-32,147,]),'TYPE':([4,10,23,32,35,39,50,64,111,135,],[7,18,30,38,41,59,78,94,126,140,]),'LBRACE':([7,18,36,41,44,45,46,47,49,51,56,57,59,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[9,24,47,60,47,47,47,47,47,47,47,47,86,47,47,47,47,47,47,47,47,47,47,47,47,47,47,-38,47,47,47,-37,47,47,47,47,]),'INHERITS':([7,],[10,]),'RBRACE':([9,11,12,13,21,24,25,31,42,48,52,53,54,55,75,78,79,80,81,87,92,95,96,97,98,99,100,101,102,105,107,112,114,120,124,132,133,137,143,145,],[-60,19,-8,-9,-7,-60,-6,37,-45,-40,-46,-47,-48,-49,105,-43,-44,-57,-58,113,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-38,127,-33,-37,-41,-36,-42,-31,-35,-32,]),'ID':([9,12,21,22,24,25,34,36,44,45,46,47,49,51,56,57,58,60,61,62,63,65,66,67,68,69,70,71,75,86,103,104,107,108,109,110,115,116,117,120,121,122,131,134,136,138,144,147,],[15,15,-7,26,15,-6,26,42,42,42,42,42,42,42,42,42,84,42,42,42,93,42,42,42,42,42,42,42,42,42,42,42,-38,123,42,84,42,42,130,-37,123,-17,42,-16,42,42,42,-30,]),'LPAREN':([15,36,42,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,93,103,104,107,109,115,116,120,130,131,136,138,144,],[22,44,61,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,116,44,44,-38,44,44,44,-37,138,44,44,44,44,]),'COLON':([15,26,28,33,84,123,],[23,32,35,39,111,135,]),'RPAREN':([22,27,29,38,40,42,48,52,53,54,55,61,72,78,79,80,81,88,89,90,91,92,95,96,97,98,99,100,101,102,105,114,116,124,128,129,132,133,137,138,142,143,145,],[28,33,-24,-25,-23,-45,-40,-46,-47,-48,-49,-60,102,-43,-44,-57,-58,114,-28,-29,-27,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-60,-41,-26,137,-36,-42,-31,-60,145,-35,-32,]),'COMMA':([27,29,38,40,42,48,52,53,54,55,78,79,80,81,82,83,85,89,91,92,95,96,97,98,99,100,101,102,105,114,124,125,126,128,132,133,137,141,143,145,],[34,-24,-25,-23,-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,110,-18,-21,115,-27,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-19,-22,-26,-36,-42,-31,-20,-35,-32,]),'ASSIGN':([30,42,126,],[36,62,136,]),'IF':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-38,45,45,45,-37,45,45,45,45,]),'WHILE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,-38,46,46,46,-37,46,46,46,46,]),'CASE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,-38,49,49,49,-37,49,49,49,49,]),'NEW':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-38,50,50,50,-37,50,50,50,50,]),'ISVOID':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,-38,51,51,51,-37,51,51,51,51,]),'INTEGER':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,-38,52,52,52,-37,52,52,52,52,]),'STRING':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,-38,53,53,53,-37,53,53,53,53,]),'TRUE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,-38,54,54,54,-37,54,54,54,54,]),'FALSE':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,-38,55,55,55,-37,55,55,55,55,]),'NOX':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,-38,56,56,56,-37,56,56,56,56,]),'NOT':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,57,-38,57,57,57,-37,57,57,57,57,]),'LET':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,107,109,115,116,120,131,136,138,144,],[58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,58,-38,58,58,58,-37,58,58,58,58,]),'DOT':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,94,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,63,-40,-46,-47,-48,-49,63,63,63,63,63,-43,63,63,63,63,63,63,117,63,63,63,63,63,63,63,-59,-39,63,63,-33,63,63,63,63,-36,-42,-31,63,63,-35,-32,63,]),'ARROBA':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,64,-40,-46,-47,-48,-49,64,64,64,64,64,-43,64,64,64,64,64,64,64,64,64,64,64,64,64,-59,-39,64,64,-33,64,64,64,64,-36,-42,-31,64,64,-35,-32,64,]),'PLUS':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,65,-40,-46,-47,-48,-49,65,65,65,65,65,-43,-44,-57,65,65,65,65,-50,-51,-52,-53,65,65,65,-59,-39,65,65,-33,65,65,65,65,-36,-42,-31,65,65,-35,-32,65,]),'MINUS':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,66,-40,-46,-47,-48,-49,66,66,66,66,66,-43,-44,-57,66,66,66,66,-50,-51,-52,-53,66,66,66,-59,-39,66,66,-33,66,66,66,66,-36,-42,-31,66,66,-35,-32,66,]),'MULTIPLY':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,67,-40,-46,-47,-48,-49,67,67,67,67,67,-43,-44,-57,67,67,67,67,67,67,-52,-53,67,67,67,-59,-39,67,67,-33,67,67,67,67,-36,-42,-31,67,67,-35,-32,67,]),'DIVIDE':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,68,-40,-46,-47,-48,-49,68,68,68,68,68,-43,-44,-57,68,68,68,68,68,68,-52,-53,68,68,68,-59,-39,68,68,-33,68,68,68,68,-36,-42,-31,68,68,-35,-32,68,]),'LESS':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,69,-40,-46,-47,-48,-49,69,69,69,69,69,-43,-44,-57,69,69,69,69,-50,-51,-52,-53,None,None,None,-59,-39,69,69,-33,69,69,69,69,-36,-42,-31,69,69,-35,-32,69,]),'LESSEQ':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,70,-40,-46,-47,-48,-49,70,70,70,70,70,-43,-44,-57,70,70,70,70,-50,-51,-52,-53,None,None,None,-59,-39,70,70,-33,70,70,70,70,-36,-42,-31,70,70,-35,-32,70,]),'EQUAL':([42,43,48,52,53,54,55,72,73,74,76,77,78,79,80,81,87,91,92,95,96,97,98,99,100,101,102,105,106,112,114,118,119,124,128,132,133,137,139,141,143,145,146,],[-45,71,-40,-46,-47,-48,-49,71,71,71,71,71,-43,-44,-57,71,71,71,71,-50,-51,-52,-53,None,None,None,-59,-39,71,71,-33,71,71,71,71,-36,-42,-31,71,71,-35,-32,71,]),'THEN':([42,48,52,53,54,55,73,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,103,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,-35,-32,]),'LOOP':([42,48,52,53,54,55,74,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,104,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,-35,-32,]),'OF':([42,48,52,53,54,55,77,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,108,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,-35,-32,]),'ELSE':([42,48,52,53,54,55,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,118,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,131,-41,-36,-42,-31,-35,-32,]),'POOL':([42,48,52,53,54,55,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,119,124,132,133,137,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,132,-41,-36,-42,-31,-35,-32,]),'FI':([42,48,52,53,54,55,78,79,80,81,92,95,96,97,98,99,100,101,102,105,114,124,132,133,137,139,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-36,-42,-31,143,-35,-32,]),'IN':([42,48,52,53,54,55,78,79,80,81,82,83,85,92,95,96,97,98,99,100,101,102,105,114,124,125,126,132,133,137,141,143,145,],[-45,-40,-46,-47,-48,-49,-43,-44,-57,-58,109,-18,-21,-34,-50,-51,-52,-53,-54,-55,-56,-59,-39,-33,-41,-19,-22,-36,-42,-31,-20,-35,-32,]),'ESAC':([121,122,134,147,],[133,-17,-16,-30,]),'ARROW':([140,],[144,]),} + +_lr_action = {} +for _k, _v in _lr_action_items.items(): + for _x,_y in zip(_v[0],_v[1]): + if not _x in _lr_action: _lr_action[_x] = {} + _lr_action[_x][_k] = _y +del _lr_action_items + +_lr_goto_items = {'program':([0,],[1,]),'class_list':([0,],[2,]),'class':([0,2,],[3,5,]),'feature_opt':([9,24,],[11,31,]),'feature_list':([9,24,],[12,12,]),'empty':([9,24,61,116,138,],[13,13,90,90,90,]),'feature':([9,12,24,],[14,20,14,]),'attr_init':([9,12,24,],[16,16,16,]),'attr_def':([9,12,24,],[17,17,17,]),'formal_param_list':([22,],[27,]),'formal_param':([22,34,],[29,40,]),'expr':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,109,115,116,131,136,138,144,],[43,72,73,74,76,77,79,80,81,87,91,92,95,96,97,98,99,100,101,106,112,118,119,124,128,91,139,141,91,146,]),'let_expr':([36,44,45,46,47,49,51,56,57,60,61,62,65,66,67,68,69,70,71,75,86,103,104,109,115,116,131,136,138,144,],[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,]),'block_list':([47,],[75,]),'let_var':([58,],[82,]),'let_init':([58,110,],[83,125,]),'let_def':([58,110,],[85,85,]),'args_list_opt':([61,116,138,],[88,129,142,]),'args_list':([61,116,138,],[89,89,89,]),'action_list':([108,],[121,]),'action':([108,121,],[122,134,]),} + +_lr_goto = {} +for _k, _v in _lr_goto_items.items(): + for _x, _y in zip(_v[0], _v[1]): + if not _x in _lr_goto: _lr_goto[_x] = {} + _lr_goto[_x][_k] = _y +del _lr_goto_items +_lr_productions = [ + ("S' -> program","S'",1,None,None,None), + ('program -> class_list','program',1,'p_program','parser.py',52), + ('class_list -> class_list class SEMIC','class_list',3,'p_class_list','parser.py',58), + ('class_list -> class SEMIC','class_list',2,'p_class_list','parser.py',59), + ('class -> CLASS TYPE LBRACE feature_opt RBRACE','class',5,'p_def_class','parser.py',65), + ('class -> CLASS TYPE INHERITS TYPE LBRACE feature_opt RBRACE','class',7,'p_def_class_inherits','parser.py',72), + ('feature_list -> feature_list feature SEMIC','feature_list',3,'p_feature_list','parser.py',79), + ('feature_list -> feature SEMIC','feature_list',2,'p_feature_list','parser.py',80), + ('feature_opt -> feature_list','feature_opt',1,'p_feature_opt','parser.py',86), + ('feature_opt -> empty','feature_opt',1,'p_feature_opt','parser.py',87), + ('feature -> ID LPAREN formal_param_list RPAREN COLON TYPE LBRACE expr RBRACE','feature',9,'p_feature_f_class_method','parser.py',93), + ('feature -> ID LPAREN RPAREN COLON TYPE LBRACE expr RBRACE','feature',8,'p_feature_class_method','parser.py',100), + ('feature -> attr_init','feature',1,'p_feature_attr','parser.py',107), + ('attr_init -> ID COLON TYPE ASSIGN expr','attr_init',5,'p_attr_init','parser.py',113), + ('attr_init -> attr_def','attr_init',1,'p_attr_init','parser.py',114), + ('attr_def -> ID COLON TYPE','attr_def',3,'p_attr_def','parser.py',121), + ('action_list -> action_list action','action_list',2,'p_action_list','parser.py',128), + ('action_list -> action','action_list',1,'p_action_list','parser.py',129), + ('let_var -> let_init','let_var',1,'p_let_var','parser.py',136), + ('let_var -> let_var COMMA let_init','let_var',3,'p_let_var','parser.py',137), + ('let_init -> ID COLON TYPE ASSIGN expr','let_init',5,'p_let_init','parser.py',143), + ('let_init -> let_def','let_init',1,'p_let_init','parser.py',144), + ('let_def -> ID COLON TYPE','let_def',3,'p_let_def','parser.py',151), + ('formal_param_list -> formal_param_list COMMA formal_param','formal_param_list',3,'p_formal_param_list','parser.py',158), + ('formal_param_list -> formal_param','formal_param_list',1,'p_formal_param_list','parser.py',159), + ('formal_param -> ID COLON TYPE','formal_param',3,'p_formal_param','parser.py',165), + ('args_list -> args_list COMMA expr','args_list',3,'p_args_list','parser.py',172), + ('args_list -> expr','args_list',1,'p_args_list','parser.py',173), + ('args_list_opt -> args_list','args_list_opt',1,'p_args_list_opt','parser.py',179), + ('args_list_opt -> empty','args_list_opt',1,'p_args_list_opt','parser.py',180), + ('action -> ID COLON TYPE ARROW expr SEMIC','action',6,'p_action','parser.py',186), + ('expr -> expr DOT ID LPAREN args_list_opt RPAREN','expr',6,'p_expr_dynamic_call','parser.py',193), + ('expr -> expr ARROBA TYPE DOT ID LPAREN args_list_opt RPAREN','expr',8,'p_expr_static_call','parser.py',200), + ('expr -> ID LPAREN args_list_opt RPAREN','expr',4,'p_expr_self_call','parser.py',207), + ('expr -> ID ASSIGN expr','expr',3,'p_expr_assign','parser.py',214), + ('expr -> IF expr THEN expr ELSE expr FI','expr',7,'p_expr_if','parser.py',221), + ('expr -> WHILE expr LOOP expr POOL','expr',5,'p_expr_while','parser.py',228), + ('block_list -> block_list expr SEMIC','block_list',3,'p_block_list','parser.py',235), + ('block_list -> expr SEMIC','block_list',2,'p_block_list','parser.py',236), + ('expr -> LBRACE block_list RBRACE','expr',3,'p_expr_block','parser.py',242), + ('expr -> let_expr','expr',1,'p_expr_simple_let','parser.py',249), + ('let_expr -> LET let_var IN expr','let_expr',4,'p_expr_let','parser.py',255), + ('expr -> CASE expr OF action_list ESAC','expr',5,'p_expr_case','parser.py',262), + ('expr -> NEW TYPE','expr',2,'p_expr_new','parser.py',269), + ('expr -> ISVOID expr','expr',2,'p_expr_isvoid','parser.py',276), + ('expr -> ID','expr',1,'p_expr_id','parser.py',283), + ('expr -> INTEGER','expr',1,'p_expr_int','parser.py',290), + ('expr -> STRING','expr',1,'p_expr_str','parser.py',297), + ('expr -> TRUE','expr',1,'p_expr_bool','parser.py',304), + ('expr -> FALSE','expr',1,'p_expr_bool','parser.py',305), + ('expr -> expr PLUS expr','expr',3,'p_expr_binary_op','parser.py',312), + ('expr -> expr MINUS expr','expr',3,'p_expr_binary_op','parser.py',313), + ('expr -> expr MULTIPLY expr','expr',3,'p_expr_binary_op','parser.py',314), + ('expr -> expr DIVIDE expr','expr',3,'p_expr_binary_op','parser.py',315), + ('expr -> expr LESS expr','expr',3,'p_expr_binary_op','parser.py',316), + ('expr -> expr LESSEQ expr','expr',3,'p_expr_binary_op','parser.py',317), + ('expr -> expr EQUAL expr','expr',3,'p_expr_binary_op','parser.py',318), + ('expr -> NOX expr','expr',2,'p_expr_unary_op','parser.py',344), + ('expr -> NOT expr','expr',2,'p_expr_unary_op','parser.py',345), + ('expr -> LPAREN expr RPAREN','expr',3,'p_expr_parenthesis','parser.py',356), + ('empty -> ','empty',0,'p_empty','parser.py',362), +] diff --git a/tests/codegen/arith.mips b/tests/codegen/arith.mips new file mode 100644 index 000000000..42f9608d2 --- /dev/null +++ b/tests/codegen/arith.mips @@ -0,0 +1,12572 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +A_name: .asciiz "A" +A_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A.value +.word A.set_var +.word A.method1 +.word A.method2 +.word A.method3 +.word A.method4 +.word A.method5 +B_name: .asciiz "B" +B_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A.value +.word A.set_var +.word A.method1 +.word A.method2 +.word A.method3 +.word A.method4 +.word B.method5 +C_name: .asciiz "C" +C_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A.value +.word A.set_var +.word A.method1 +.word A.method2 +.word A.method3 +.word A.method4 +.word C.method5 +.word C.method6 +D_name: .asciiz "D" +D_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A.value +.word A.set_var +.word A.method1 +.word A.method2 +.word A.method3 +.word A.method4 +.word B.method5 +.word D.method7 +E_name: .asciiz "E" +E_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A.value +.word A.set_var +.word A.method1 +.word A.method2 +.word A.method3 +.word A.method4 +.word B.method5 +.word D.method7 +.word E.method6 +A2I_name: .asciiz "A2I" +A2I_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A2I.c2i +.word A2I.i2c +.word A2I.a2i +.word A2I.a2i_aux +.word A2I.i2a +.word A2I.i2a_aux +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.menu +.word Main.prompt +.word Main.get_int +.word Main.is_even +.word Main.class_type +.word Main.print +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "0" +msg_4: .asciiz "1" +msg_5: .asciiz "2" +msg_6: .asciiz "3" +msg_7: .asciiz "4" +msg_8: .asciiz "5" +msg_9: .asciiz "6" +msg_10: .asciiz "7" +msg_11: .asciiz "8" +msg_12: .asciiz "9" +msg_13: .asciiz "-" +msg_14: .asciiz "+" +msg_15: .asciiz " + To add a number to " +msg_16: .asciiz "...enter a: +" +msg_17: .asciiz " To negate " +msg_18: .asciiz "...enter b: +" +msg_19: .asciiz " To find the difference between " +msg_20: .asciiz "and another number...enter c: +" +msg_21: .asciiz " To find the factorial of " +msg_22: .asciiz "...enter d: +" +msg_23: .asciiz " To square " +msg_24: .asciiz "...enter e: +" +msg_25: .asciiz " To cube " +msg_26: .asciiz "...enter f: +" +msg_27: .asciiz " To find out if " +msg_28: .asciiz "is a multiple of 3...enter g: +" +msg_29: .asciiz " To divide " +msg_30: .asciiz "by 8...enter h: +" +msg_31: .asciiz " To get a new number...enter j: +" +msg_32: .asciiz " To quit...enter q: + +" +msg_33: .asciiz "Please enter a number... " +msg_34: .asciiz "Class type is now E +" +msg_35: .asciiz "Class type is now D +" +msg_36: .asciiz "Class type is now C +" +msg_37: .asciiz "Class type is now B +" +msg_38: .asciiz "Class type is now A +" +msg_39: .asciiz "Oooops +" +msg_40: .asciiz " " +msg_41: .asciiz "number " +msg_42: .asciiz "is odd! +" +msg_43: .asciiz "is even! +" +msg_44: .asciiz "a" +msg_45: .asciiz "b" +msg_46: .asciiz "c" +msg_47: .asciiz "d" +msg_48: .asciiz "e" +msg_49: .asciiz "f" +msg_50: .asciiz "g" +msg_51: .asciiz "h" +msg_52: .asciiz "j" +msg_53: .asciiz "q" +msg_54: .asciiz "is equal to " +msg_55: .asciiz "times 8 with a remainder of " +msg_56: .asciiz "is not divisible by 3. +" +msg_57: .asciiz "is divisible by 3. +" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 8:Class_size +li $a0, 32 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 8 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +A_init: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Avar = instance_1 +lw $t0, 20($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +A.value: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr A.var = A.var +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return A.var +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +A.set_var: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Avar = num +lw $t0, 8($sp) +lw $t1, 12($sp) +sw $t1, 16($t0) +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +A.method1: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return self +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +A.method2: +addi $sp, $sp, -56 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode x_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#GetAttr left_6 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#GetAttr right_7 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#BinaryOperator left_6 + right_7 +lw $a0, 28($sp) +lw $t1, 32($sp) +add $a0, $a0, $t1 +sw $a0, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#AssignNode x_3 = result_4 +lw $t1, 20($sp) +sw $t1, 16($sp) +#Allocate 6:tag B:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, B_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, B_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode B_init +move $t0, $sp +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal B_init +sw $a1, 52($sp) +#VCall set_var +move $t0, $sp +# Arg x_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 44($sp) +#AssignNode result_13 = result_10 +lw $t1, 44($sp) +sw $t1, 56($sp) +#Return result_13 +lw $a1, 56($sp) +lw $ra, 0($sp) +addi $sp, $sp, 72 +jr $ra +A.method3: +addi $sp, $sp, -52 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode x_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#GetAttr l_6 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#UnaryOperator ~ l_6 +lw $t1, 28($sp) +neg $a0, $t1 +sw $a0, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#AssignNode x_3 = result_4 +lw $t1, 20($sp) +sw $t1, 16($sp) +#Allocate 7:tag C:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 7 +sw $t1, 0($t0) +la $t1, C_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, C_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode C_init +move $t0, $sp +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal C_init +sw $a1, 48($sp) +#VCall set_var +move $t0, $sp +# Arg x_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 44($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 40($sp) +#AssignNode result_12 = result_9 +lw $t1, 40($sp) +sw $t1, 52($sp) +#Return result_12 +lw $a1, 52($sp) +lw $ra, 0($sp) +addi $sp, $sp, 64 +jr $ra +A.method4: +addi $sp, $sp, -136 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr left_3 = Int.value +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 24($sp) +# IFGoto result_1 -> label_1 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#AssignNode x_9 = instance_6 +lw $t1, 28($sp) +sw $t1, 40($sp) +#GetAttr left_12 = Int.value +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 - right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +sub $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 60($sp) +#AssignNode x_9 = result_10 +lw $t1, 44($sp) +sw $t1, 40($sp) +#Allocate 8:tag D:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 8 +sw $t1, 0($t0) +la $t1, D_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, D_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#CallNode D_init +move $t0, $sp +# Arg result_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal D_init +sw $a1, 76($sp) +#VCall set_var +move $t0, $sp +# Arg x_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 72($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 68($sp) +#AssignNode result_19 = result_16 +lw $t1, 68($sp) +sw $t1, 80($sp) +#AssignNode result_0 = result_19 +lw $t1, 80($sp) +sw $t1, 4($sp) +#Goto label_2 +b label_2 +#LabelNode label_1 +label_1: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 88($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 92($sp) +#AssignNode x_23 = instance_20 +lw $t1, 84($sp) +sw $t1, 96($sp) +#GetAttr left_26 = Int.value +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#GetAttr right_27 = Int.value +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#BinaryOperator left_26 - right_27 +lw $a0, 108($sp) +lw $t1, 112($sp) +sub $a0, $a0, $t1 +sw $a0, 104($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 116($sp) +#AssignNode x_23 = result_24 +lw $t1, 100($sp) +sw $t1, 96($sp) +#Allocate 8:tag D:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 8 +sw $t1, 0($t0) +la $t1, D_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, D_methods +sw $t1, 12($t0) +sw $t0, 128($sp) +#CallNode D_init +move $t0, $sp +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal D_init +sw $a1, 132($sp) +#VCall set_var +move $t0, $sp +# Arg x_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 124($sp) +#AssignNode result_33 = result_30 +lw $t1, 124($sp) +sw $t1, 136($sp) +#AssignNode result_0 = result_33 +lw $t1, 136($sp) +sw $t1, 4($sp) +#LabelNode label_2 +label_2: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 152 +jr $ra +A.method5: +addi $sp, $sp, -136 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode x_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 28($sp) +#AssignNode y_7 = instance_4 +lw $t1, 20($sp) +sw $t1, 32($sp) +#LabelNode label_3 +label_3: +#GetAttr left_11 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#GetAttr right_12 = Int.value +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#BinaryOperator left_11 <= right_12 +lw $a0, 48($sp) +lw $t1, 52($sp) +sle $a0, $a0, $t1 +sw $a0, 44($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 56($sp) +# IFGoto result_9 -> label_4 +lw $t0, 40($sp) +lw $a0, 16($t0) +bnez $a0, label_4 +#Goto label_5 +b label_5 +#LabelNode label_4 +label_4: +#GetAttr left_16 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#GetAttr right_17 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 72($sp) +#BinaryOperator left_16 * right_17 +lw $a0, 68($sp) +lw $t1, 72($sp) +mul $a0, $a0, $t1 +sw $a0, 64($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#AssignNode x_3 = result_14 +lw $t1, 60($sp) +sw $t1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#GetAttr left_22 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 + right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +add $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#AssignNode y_7 = result_20 +lw $t1, 84($sp) +sw $t1, 32($sp) +#Goto label_3 +b label_3 +#LabelNode label_5 +label_5: +#AssignNode result_29 = result_8 +lw $t1, 36($sp) +sw $t1, 120($sp) +#Allocate 9:tag E:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 9 +sw $t1, 0($t0) +la $t1, E_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, E_methods +sw $t1, 12($t0) +sw $t0, 128($sp) +#CallNode E_init +move $t0, $sp +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal E_init +sw $a1, 132($sp) +#VCall set_var +move $t0, $sp +# Arg x_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 124($sp) +#AssignNode result_33 = result_30 +lw $t1, 124($sp) +sw $t1, 136($sp) +#Return result_33 +lw $a1, 136($sp) +lw $ra, 0($sp) +addi $sp, $sp, 148 +jr $ra +B_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode A_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +B.method5: +addi $sp, $sp, -56 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode x_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#GetAttr left_6 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#GetAttr right_7 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#BinaryOperator left_6 * right_7 +lw $a0, 28($sp) +lw $t1, 32($sp) +mul $a0, $a0, $t1 +sw $a0, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#AssignNode x_3 = result_4 +lw $t1, 20($sp) +sw $t1, 16($sp) +#Allocate 9:tag E:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 9 +sw $t1, 0($t0) +la $t1, E_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, E_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode E_init +move $t0, $sp +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal E_init +sw $a1, 52($sp) +#VCall set_var +move $t0, $sp +# Arg x_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 44($sp) +#AssignNode result_13 = result_10 +lw $t1, 44($sp) +sw $t1, 56($sp) +#Return result_13 +lw $a1, 56($sp) +lw $ra, 0($sp) +addi $sp, $sp, 68 +jr $ra +C_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode B_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal B_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +C.method6: +addi $sp, $sp, -52 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode x_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#GetAttr l_6 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#UnaryOperator ~ l_6 +lw $t1, 28($sp) +neg $a0, $t1 +sw $a0, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#AssignNode x_3 = result_4 +lw $t1, 20($sp) +sw $t1, 16($sp) +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode A_init +move $t0, $sp +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 48($sp) +#VCall set_var +move $t0, $sp +# Arg x_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 44($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 40($sp) +#AssignNode result_12 = result_9 +lw $t1, 40($sp) +sw $t1, 52($sp) +#Return result_12 +lw $a1, 52($sp) +lw $ra, 0($sp) +addi $sp, $sp, 64 +jr $ra +C.method5: +addi $sp, $sp, -76 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode x_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#GetAttr left_10 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 44($sp) +#GetAttr right_11 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#BinaryOperator left_10 * right_11 +lw $a0, 44($sp) +lw $t1, 48($sp) +mul $a0, $a0, $t1 +sw $a0, 40($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 52($sp) +#GetAttr left_6 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#GetAttr right_7 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#BinaryOperator left_6 * right_7 +lw $a0, 28($sp) +lw $t1, 32($sp) +mul $a0, $a0, $t1 +sw $a0, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 56($sp) +#AssignNode x_3 = result_4 +lw $t1, 20($sp) +sw $t1, 16($sp) +#Allocate 9:tag E:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 9 +sw $t1, 0($t0) +la $t1, E_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, E_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode E_init +move $t0, $sp +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal E_init +sw $a1, 72($sp) +#VCall set_var +move $t0, $sp +# Arg x_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 68($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 64($sp) +#AssignNode result_18 = result_15 +lw $t1, 64($sp) +sw $t1, 76($sp) +#Return result_18 +lw $a1, 76($sp) +lw $ra, 0($sp) +addi $sp, $sp, 88 +jr $ra +D_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode B_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal B_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +D.method7: +addi $sp, $sp, -244 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#AssignNode x_0 = num +lw $t1, 252($sp) +sw $t1, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_4 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr right_5 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#BinaryOperator left_4 < right_5 +lw $a0, 20($sp) +lw $t1, 24($sp) +slt $a0, $a0, $t1 +sw $a0, 16($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_2 -> label_6 +lw $t0, 12($sp) +lw $a0, 16($t0) +bnez $a0, label_6 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 64($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 72($sp) +#GetAttr left_13 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 76($sp) +# IFGoto result_11 -> label_7 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_7 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#GetAttr left_22 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 = right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +seq $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 112($sp) +# IFGoto result_20 -> label_8 +lw $t0, 84($sp) +lw $a0, 16($t0) +bnez $a0, label_8 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 140($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 144($sp) +#GetAttr left_31 = Int.value +lw $t0, 136($sp) +lw $t1, 16($t0) +sw $t1, 128($sp) +#GetAttr right_32 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 132($sp) +#BinaryOperator left_31 = right_32 +lw $a0, 128($sp) +lw $t1, 132($sp) +seq $a0, $a0, $t1 +sw $a0, 124($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 148($sp) +# IFGoto result_29 -> label_9 +lw $t0, 120($sp) +lw $a0, 16($t0) +bnez $a0, label_9 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 176($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 180($sp) +#GetAttr left_40 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 164($sp) +#GetAttr right_41 = Int.value +lw $t0, 172($sp) +lw $t1, 16($t0) +sw $t1, 168($sp) +#BinaryOperator left_40 - right_41 +lw $a0, 164($sp) +lw $t1, 168($sp) +sub $a0, $a0, $t1 +sw $a0, 160($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 156($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 184($sp) +#VCall method7 +move $t0, $sp +# Arg result_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 248($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 152($sp) +#AssignNode result_28 = result_37 +lw $t1, 152($sp) +sw $t1, 116($sp) +#Goto label_10 +b label_10 +#LabelNode label_9 +label_9: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 192($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 196($sp) +#AssignNode result_28 = instance_46 +lw $t1, 188($sp) +sw $t1, 116($sp) +#LabelNode label_10 +label_10: +#AssignNode result_19 = result_28 +lw $t1, 116($sp) +sw $t1, 80($sp) +#Goto label_11 +b label_11 +#LabelNode label_8 +label_8: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 200($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 204($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_49 +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 208($sp) +#AssignNode result_19 = instance_49 +lw $t1, 200($sp) +sw $t1, 80($sp) +#LabelNode label_11 +label_11: +#AssignNode result_10 = result_19 +lw $t1, 80($sp) +sw $t1, 44($sp) +#Goto label_12 +b label_12 +#LabelNode label_7 +label_7: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 212($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 216($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 220($sp) +#AssignNode result_10 = instance_52 +lw $t1, 212($sp) +sw $t1, 44($sp) +#LabelNode label_12 +label_12: +#AssignNode result_1 = result_10 +lw $t1, 44($sp) +sw $t1, 8($sp) +#Goto label_13 +b label_13 +#LabelNode label_6 +label_6: +#GetAttr l_58 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 236($sp) +#UnaryOperator ~ l_58 +lw $t1, 236($sp) +neg $a0, $t1 +sw $a0, 232($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 228($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 240($sp) +#VCall method7 +move $t0, $sp +# Arg result_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 248($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 224($sp) +#AssignNode result_1 = result_55 +lw $t1, 224($sp) +sw $t1, 8($sp) +#LabelNode label_13 +label_13: +#AssignNode result_60 = result_1 +lw $t1, 8($sp) +sw $t1, 244($sp) +#Return result_60 +lw $a1, 244($sp) +lw $ra, 0($sp) +addi $sp, $sp, 256 +jr $ra +E_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode D_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal D_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +E.method6: +addi $sp, $sp, -68 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode x_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 40($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 44($sp) +#GetAttr left_6 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#GetAttr right_7 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#BinaryOperator left_6 / right_7 +lw $a0, 28($sp) +lw $t1, 32($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 48($sp) +#AssignNode x_3 = result_4 +lw $t1, 20($sp) +sw $t1, 16($sp) +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode A_init +move $t0, $sp +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 64($sp) +#VCall set_var +move $t0, $sp +# Arg x_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 56($sp) +#AssignNode result_16 = result_13 +lw $t1, 56($sp) +sw $t1, 68($sp) +#Return result_16 +lw $a1, 68($sp) +lw $ra, 0($sp) +addi $sp, $sp, 80 +jr $ra +A2I_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +A2I.c2i: +addi $sp, $sp, -496 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_14 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_14 +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 60($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 64($sp) +#CallNode String_init +move $t0, $sp +# Arg l_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 68($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_10 -> label_15 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_15 +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 96($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode String_init +move $t0, $sp +# Arg l_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 104($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 84($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_19 -> label_16 +lw $t0, 80($sp) +lw $a0, 16($t0) +bnez $a0, label_16 +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 132($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#CallNode String_init +move $t0, $sp +# Arg l_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 140($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 120($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 144($sp) +# IFGoto result_28 -> label_17 +lw $t0, 116($sp) +lw $a0, 16($t0) +bnez $a0, label_17 +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 168($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#CallNode String_init +move $t0, $sp +# Arg l_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 176($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 156($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 180($sp) +# IFGoto result_37 -> label_18 +lw $t0, 152($sp) +lw $a0, 16($t0) +bnez $a0, label_18 +#LoadStr msg_8 +la $t0, msg_8 +sw $t0, 204($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 208($sp) +#CallNode String_init +move $t0, $sp +# Arg l_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 212($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 192($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 216($sp) +# IFGoto result_46 -> label_19 +lw $t0, 188($sp) +lw $a0, 16($t0) +bnez $a0, label_19 +#LoadStr msg_9 +la $t0, msg_9 +sw $t0, 240($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 244($sp) +#CallNode String_init +move $t0, $sp +# Arg l_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 248($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 228($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 224($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 252($sp) +# IFGoto result_55 -> label_20 +lw $t0, 224($sp) +lw $a0, 16($t0) +bnez $a0, label_20 +#LoadStr msg_10 +la $t0, msg_10 +sw $t0, 276($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 280($sp) +#CallNode String_init +move $t0, $sp +# Arg l_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 284($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 264($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 260($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_65 +lw $t1, 264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 288($sp) +# IFGoto result_64 -> label_21 +lw $t0, 260($sp) +lw $a0, 16($t0) +bnez $a0, label_21 +#LoadStr msg_11 +la $t0, msg_11 +sw $t0, 312($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 316($sp) +#CallNode String_init +move $t0, $sp +# Arg l_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 320($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 300($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 296($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 324($sp) +# IFGoto result_73 -> label_22 +lw $t0, 296($sp) +lw $a0, 16($t0) +bnez $a0, label_22 +#LoadStr msg_12 +la $t0, msg_12 +sw $t0, 348($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 352($sp) +#CallNode String_init +move $t0, $sp +# Arg l_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 356($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 336($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 360($sp) +# IFGoto result_82 -> label_23 +lw $t0, 332($sp) +lw $a0, 16($t0) +bnez $a0, label_23 +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 500($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 364($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 368($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 372($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 376($sp) +#AssignNode result_81 = instance_91 +lw $t1, 368($sp) +sw $t1, 328($sp) +#Goto label_24 +b label_24 +#LabelNode label_23 +label_23: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 380($sp) +#LoadInt 9 +li $t0, 9 +sw $t0, 384($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_95 +lw $t1, 384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 388($sp) +#AssignNode result_81 = instance_94 +lw $t1, 380($sp) +sw $t1, 328($sp) +#LabelNode label_24 +label_24: +#AssignNode result_72 = result_81 +lw $t1, 328($sp) +sw $t1, 292($sp) +#Goto label_25 +b label_25 +#LabelNode label_22 +label_22: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 392($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 396($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_98 +lw $t1, 396($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 400($sp) +#AssignNode result_72 = instance_97 +lw $t1, 392($sp) +sw $t1, 292($sp) +#LabelNode label_25 +label_25: +#AssignNode result_63 = result_72 +lw $t1, 292($sp) +sw $t1, 256($sp) +#Goto label_26 +b label_26 +#LabelNode label_21 +label_21: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 404($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 408($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 412($sp) +#AssignNode result_63 = instance_100 +lw $t1, 404($sp) +sw $t1, 256($sp) +#LabelNode label_26 +label_26: +#AssignNode result_54 = result_63 +lw $t1, 256($sp) +sw $t1, 220($sp) +#Goto label_27 +b label_27 +#LabelNode label_20 +label_20: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 416($sp) +#LoadInt 6 +li $t0, 6 +sw $t0, 420($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_103 +lw $t1, 416($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 424($sp) +#AssignNode result_54 = instance_103 +lw $t1, 416($sp) +sw $t1, 220($sp) +#LabelNode label_27 +label_27: +#AssignNode result_45 = result_54 +lw $t1, 220($sp) +sw $t1, 184($sp) +#Goto label_28 +b label_28 +#LabelNode label_19 +label_19: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 428($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 432($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_107 +lw $t1, 432($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 436($sp) +#AssignNode result_45 = instance_106 +lw $t1, 428($sp) +sw $t1, 184($sp) +#LabelNode label_28 +label_28: +#AssignNode result_36 = result_45 +lw $t1, 184($sp) +sw $t1, 148($sp) +#Goto label_29 +b label_29 +#LabelNode label_18 +label_18: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 440($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 444($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 448($sp) +#AssignNode result_36 = instance_109 +lw $t1, 440($sp) +sw $t1, 148($sp) +#LabelNode label_29 +label_29: +#AssignNode result_27 = result_36 +lw $t1, 148($sp) +sw $t1, 112($sp) +#Goto label_30 +b label_30 +#LabelNode label_17 +label_17: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 452($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 456($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_112 +lw $t1, 452($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 460($sp) +#AssignNode result_27 = instance_112 +lw $t1, 452($sp) +sw $t1, 112($sp) +#LabelNode label_30 +label_30: +#AssignNode result_18 = result_27 +lw $t1, 112($sp) +sw $t1, 76($sp) +#Goto label_31 +b label_31 +#LabelNode label_16 +label_16: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 464($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 468($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_116 +lw $t1, 468($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_115 +lw $t1, 464($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 472($sp) +#AssignNode result_18 = instance_115 +lw $t1, 464($sp) +sw $t1, 76($sp) +#LabelNode label_31 +label_31: +#AssignNode result_9 = result_18 +lw $t1, 76($sp) +sw $t1, 40($sp) +#Goto label_32 +b label_32 +#LabelNode label_15 +label_15: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 476($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 480($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 484($sp) +#AssignNode result_9 = instance_118 +lw $t1, 476($sp) +sw $t1, 40($sp) +#LabelNode label_32 +label_32: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_33 +b label_33 +#LabelNode label_14 +label_14: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 488($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 492($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 496($sp) +#AssignNode result_0 = instance_121 +lw $t1, 488($sp) +sw $t1, 4($sp) +#LabelNode label_33 +label_33: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 508 +jr $ra +A2I.i2c: +addi $sp, $sp, -496 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_34 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_34 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 64($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 68($sp) +#GetAttr left_12 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 = right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +seq $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_10 -> label_35 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_35 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#GetAttr left_21 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#GetAttr right_22 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#BinaryOperator left_21 = right_22 +lw $a0, 88($sp) +lw $t1, 92($sp) +seq $a0, $a0, $t1 +sw $a0, 84($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_19 -> label_36 +lw $t0, 80($sp) +lw $a0, 16($t0) +bnez $a0, label_36 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 136($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#GetAttr left_30 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 124($sp) +#GetAttr right_31 = Int.value +lw $t0, 132($sp) +lw $t1, 16($t0) +sw $t1, 128($sp) +#BinaryOperator left_30 = right_31 +lw $a0, 124($sp) +lw $t1, 128($sp) +seq $a0, $a0, $t1 +sw $a0, 120($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 144($sp) +# IFGoto result_28 -> label_37 +lw $t0, 116($sp) +lw $a0, 16($t0) +bnez $a0, label_37 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 168($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 172($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 176($sp) +#GetAttr left_39 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 160($sp) +#GetAttr right_40 = Int.value +lw $t0, 168($sp) +lw $t1, 16($t0) +sw $t1, 164($sp) +#BinaryOperator left_39 = right_40 +lw $a0, 160($sp) +lw $t1, 164($sp) +seq $a0, $a0, $t1 +sw $a0, 156($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 180($sp) +# IFGoto result_37 -> label_38 +lw $t0, 152($sp) +lw $a0, 16($t0) +bnez $a0, label_38 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 204($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 208($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 212($sp) +#GetAttr left_48 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 196($sp) +#GetAttr right_49 = Int.value +lw $t0, 204($sp) +lw $t1, 16($t0) +sw $t1, 200($sp) +#BinaryOperator left_48 = right_49 +lw $a0, 196($sp) +lw $t1, 200($sp) +seq $a0, $a0, $t1 +sw $a0, 192($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 216($sp) +# IFGoto result_46 -> label_39 +lw $t0, 188($sp) +lw $a0, 16($t0) +bnez $a0, label_39 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 240($sp) +#LoadInt 6 +li $t0, 6 +sw $t0, 244($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 248($sp) +#GetAttr left_57 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 232($sp) +#GetAttr right_58 = Int.value +lw $t0, 240($sp) +lw $t1, 16($t0) +sw $t1, 236($sp) +#BinaryOperator left_57 = right_58 +lw $a0, 232($sp) +lw $t1, 236($sp) +seq $a0, $a0, $t1 +sw $a0, 228($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 224($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 252($sp) +# IFGoto result_55 -> label_40 +lw $t0, 224($sp) +lw $a0, 16($t0) +bnez $a0, label_40 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 276($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 280($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 284($sp) +#GetAttr left_66 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 268($sp) +#GetAttr right_67 = Int.value +lw $t0, 276($sp) +lw $t1, 16($t0) +sw $t1, 272($sp) +#BinaryOperator left_66 = right_67 +lw $a0, 268($sp) +lw $t1, 272($sp) +seq $a0, $a0, $t1 +sw $a0, 264($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 260($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_65 +lw $t1, 264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 288($sp) +# IFGoto result_64 -> label_41 +lw $t0, 260($sp) +lw $a0, 16($t0) +bnez $a0, label_41 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 312($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 316($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 320($sp) +#GetAttr left_75 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 304($sp) +#GetAttr right_76 = Int.value +lw $t0, 312($sp) +lw $t1, 16($t0) +sw $t1, 308($sp) +#BinaryOperator left_75 = right_76 +lw $a0, 304($sp) +lw $t1, 308($sp) +seq $a0, $a0, $t1 +sw $a0, 300($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 296($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 324($sp) +# IFGoto result_73 -> label_42 +lw $t0, 296($sp) +lw $a0, 16($t0) +bnez $a0, label_42 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 348($sp) +#LoadInt 9 +li $t0, 9 +sw $t0, 352($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 356($sp) +#GetAttr left_84 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 340($sp) +#GetAttr right_85 = Int.value +lw $t0, 348($sp) +lw $t1, 16($t0) +sw $t1, 344($sp) +#BinaryOperator left_84 = right_85 +lw $a0, 340($sp) +lw $t1, 344($sp) +seq $a0, $a0, $t1 +sw $a0, 336($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 360($sp) +# IFGoto result_82 -> label_43 +lw $t0, 332($sp) +lw $a0, 16($t0) +bnez $a0, label_43 +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 500($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 364($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 368($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 372($sp) +#CallNode String_init +move $t0, $sp +# Arg l_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 376($sp) +#AssignNode result_81 = instance_92 +lw $t1, 372($sp) +sw $t1, 328($sp) +#Goto label_44 +b label_44 +#LabelNode label_43 +label_43: +#LoadStr msg_12 +la $t0, msg_12 +sw $t0, 380($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 384($sp) +#CallNode String_init +move $t0, $sp +# Arg l_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_95 +lw $t1, 384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 388($sp) +#AssignNode result_81 = instance_95 +lw $t1, 384($sp) +sw $t1, 328($sp) +#LabelNode label_44 +label_44: +#AssignNode result_72 = result_81 +lw $t1, 328($sp) +sw $t1, 292($sp) +#Goto label_45 +b label_45 +#LabelNode label_42 +label_42: +#LoadStr msg_11 +la $t0, msg_11 +sw $t0, 392($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 396($sp) +#CallNode String_init +move $t0, $sp +# Arg l_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_98 +lw $t1, 396($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 400($sp) +#AssignNode result_72 = instance_98 +lw $t1, 396($sp) +sw $t1, 292($sp) +#LabelNode label_45 +label_45: +#AssignNode result_63 = result_72 +lw $t1, 292($sp) +sw $t1, 256($sp) +#Goto label_46 +b label_46 +#LabelNode label_41 +label_41: +#LoadStr msg_10 +la $t0, msg_10 +sw $t0, 404($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 408($sp) +#CallNode String_init +move $t0, $sp +# Arg l_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 412($sp) +#AssignNode result_63 = instance_101 +lw $t1, 408($sp) +sw $t1, 256($sp) +#LabelNode label_46 +label_46: +#AssignNode result_54 = result_63 +lw $t1, 256($sp) +sw $t1, 220($sp) +#Goto label_47 +b label_47 +#LabelNode label_40 +label_40: +#LoadStr msg_9 +la $t0, msg_9 +sw $t0, 416($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 420($sp) +#CallNode String_init +move $t0, $sp +# Arg l_103 +lw $t1, 416($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 424($sp) +#AssignNode result_54 = instance_104 +lw $t1, 420($sp) +sw $t1, 220($sp) +#LabelNode label_47 +label_47: +#AssignNode result_45 = result_54 +lw $t1, 220($sp) +sw $t1, 184($sp) +#Goto label_48 +b label_48 +#LabelNode label_39 +label_39: +#LoadStr msg_8 +la $t0, msg_8 +sw $t0, 428($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 432($sp) +#CallNode String_init +move $t0, $sp +# Arg l_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_107 +lw $t1, 432($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 436($sp) +#AssignNode result_45 = instance_107 +lw $t1, 432($sp) +sw $t1, 184($sp) +#LabelNode label_48 +label_48: +#AssignNode result_36 = result_45 +lw $t1, 184($sp) +sw $t1, 148($sp) +#Goto label_49 +b label_49 +#LabelNode label_38 +label_38: +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 440($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 444($sp) +#CallNode String_init +move $t0, $sp +# Arg l_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 448($sp) +#AssignNode result_36 = instance_110 +lw $t1, 444($sp) +sw $t1, 148($sp) +#LabelNode label_49 +label_49: +#AssignNode result_27 = result_36 +lw $t1, 148($sp) +sw $t1, 112($sp) +#Goto label_50 +b label_50 +#LabelNode label_37 +label_37: +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 452($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 456($sp) +#CallNode String_init +move $t0, $sp +# Arg l_112 +lw $t1, 452($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 460($sp) +#AssignNode result_27 = instance_113 +lw $t1, 456($sp) +sw $t1, 112($sp) +#LabelNode label_50 +label_50: +#AssignNode result_18 = result_27 +lw $t1, 112($sp) +sw $t1, 76($sp) +#Goto label_51 +b label_51 +#LabelNode label_36 +label_36: +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 464($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 468($sp) +#CallNode String_init +move $t0, $sp +# Arg l_115 +lw $t1, 464($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_116 +lw $t1, 468($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 472($sp) +#AssignNode result_18 = instance_116 +lw $t1, 468($sp) +sw $t1, 76($sp) +#LabelNode label_51 +label_51: +#AssignNode result_9 = result_18 +lw $t1, 76($sp) +sw $t1, 40($sp) +#Goto label_52 +b label_52 +#LabelNode label_35 +label_35: +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 476($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 480($sp) +#CallNode String_init +move $t0, $sp +# Arg l_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 484($sp) +#AssignNode result_9 = instance_119 +lw $t1, 480($sp) +sw $t1, 40($sp) +#LabelNode label_52 +label_52: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_53 +b label_53 +#LabelNode label_34 +label_34: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 488($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 492($sp) +#CallNode String_init +move $t0, $sp +# Arg l_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 496($sp) +#AssignNode result_0 = instance_122 +lw $t1, 492($sp) +sw $t1, 4($sp) +#LabelNode label_53 +label_53: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 508 +jr $ra +A2I.a2i: +addi $sp, $sp, -312 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_1 -> label_54 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_54 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 88($sp) +#VCall substr +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 64($sp) +#LoadStr msg_13 +la $t0, msg_13 +sw $t0, 92($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#CallNode String_init +move $t0, $sp +# Arg l_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 100($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 104($sp) +# IFGoto result_11 -> label_55 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_55 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 136($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 148($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 152($sp) +#VCall substr +move $t0, $sp +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 128($sp) +#LoadStr msg_14 +la $t0, msg_14 +sw $t0, 156($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#CallNode String_init +move $t0, $sp +# Arg l_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 164($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 116($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 168($sp) +# IFGoto result_27 -> label_56 +lw $t0, 112($sp) +lw $a0, 16($t0) +bnez $a0, label_56 +#VCall a2i_aux +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 172($sp) +#AssignNode result_26 = result_42 +lw $t1, 172($sp) +sw $t1, 108($sp) +#Goto label_57 +b label_57 +#LabelNode label_56 +label_56: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 200($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 204($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 208($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 212($sp) +#GetAttr left_47 = Int.value +lw $t0, 200($sp) +lw $t1, 16($t0) +sw $t1, 192($sp) +#GetAttr right_48 = Int.value +lw $t0, 204($sp) +lw $t1, 16($t0) +sw $t1, 196($sp) +#BinaryOperator left_47 - right_48 +lw $a0, 192($sp) +lw $t1, 196($sp) +sub $a0, $a0, $t1 +sw $a0, 188($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 184($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 216($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 220($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 224($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 228($sp) +#VCall substr +move $t0, $sp +# Arg result_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 180($sp) +#VCall a2i_aux +move $t0, $sp +# Arg result_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 176($sp) +#AssignNode result_26 = result_43 +lw $t1, 176($sp) +sw $t1, 108($sp) +#LabelNode label_57 +label_57: +#AssignNode result_10 = result_26 +lw $t1, 108($sp) +sw $t1, 44($sp) +#Goto label_58 +b label_58 +#LabelNode label_55 +label_55: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 268($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 272($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 276($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_67 +lw $t1, 272($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 280($sp) +#GetAttr left_64 = Int.value +lw $t0, 268($sp) +lw $t1, 16($t0) +sw $t1, 260($sp) +#GetAttr right_65 = Int.value +lw $t0, 272($sp) +lw $t1, 16($t0) +sw $t1, 264($sp) +#BinaryOperator left_64 - right_65 +lw $a0, 260($sp) +lw $t1, 264($sp) +sub $a0, $a0, $t1 +sw $a0, 256($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 284($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 288($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 292($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_72 +lw $t1, 292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 296($sp) +#VCall substr +move $t0, $sp +# Arg result_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 248($sp) +#VCall a2i_aux +move $t0, $sp +# Arg result_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 244($sp) +#GetAttr l_59 = Int.value +lw $t0, 244($sp) +lw $t1, 16($t0) +sw $t1, 240($sp) +#UnaryOperator ~ l_59 +lw $t1, 240($sp) +neg $a0, $t1 +sw $a0, 236($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 232($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 300($sp) +#AssignNode result_10 = result_57 +lw $t1, 232($sp) +sw $t1, 44($sp) +#LabelNode label_58 +label_58: +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#Goto label_59 +b label_59 +#LabelNode label_54 +label_54: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 304($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 308($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_76 +lw $t1, 308($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_75 +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 312($sp) +#AssignNode result_0 = instance_75 +lw $t1, 304($sp) +sw $t1, 4($sp) +#LabelNode label_59 +label_59: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 324 +jr $ra +A2I.a2i_aux: +addi $sp, $sp, -188 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode int_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 196($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#AssignNode j_5 = result_4 +lw $t1, 20($sp) +sw $t1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#AssignNode i_9 = instance_6 +lw $t1, 28($sp) +sw $t1, 40($sp) +#LabelNode label_60 +label_60: +#GetAttr left_13 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 < right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +slt $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 64($sp) +# IFGoto result_11 -> label_61 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_61 +#Goto label_62 +b label_62 +#LabelNode label_61 +label_61: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#GetAttr left_22 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 * right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +mul $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 128($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#VCall substr +move $t0, $sp +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 196($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 120($sp) +#VCall c2i +move $t0, $sp +# Arg result_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 192($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 116($sp) +#GetAttr left_18 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 + right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +add $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#AssignNode int_3 = result_16 +lw $t1, 68($sp) +sw $t1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 164($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 168($sp) +#GetAttr left_37 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 152($sp) +#GetAttr right_38 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 156($sp) +#BinaryOperator left_37 + right_38 +lw $a0, 152($sp) +lw $t1, 156($sp) +add $a0, $a0, $t1 +sw $a0, 148($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 172($sp) +#AssignNode i_9 = result_35 +lw $t1, 144($sp) +sw $t1, 40($sp) +#Goto label_60 +b label_60 +#LabelNode label_62 +label_62: +#AssignNode result_44 = result_10 +lw $t1, 44($sp) +sw $t1, 180($sp) +#AssignNode result_45 = result_44 +lw $t1, 180($sp) +sw $t1, 184($sp) +#AssignNode result_46 = int_3 +lw $t1, 16($sp) +sw $t1, 188($sp) +#Return result_46 +lw $a1, 188($sp) +lw $ra, 0($sp) +addi $sp, $sp, 200 +jr $ra +A2I.i2a: +addi $sp, $sp, -156 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_63 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_63 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 64($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 68($sp) +#GetAttr left_12 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 < right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +slt $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_10 -> label_64 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_64 +#LoadStr msg_13 +la $t0, msg_13 +sw $t0, 80($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode String_init +move $t0, $sp +# Arg l_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 128($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#GetAttr l_29 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 120($sp) +#UnaryOperator ~ l_29 +lw $t1, 120($sp) +neg $a0, $t1 +sw $a0, 116($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#GetAttr left_25 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 104($sp) +#GetAttr right_26 = Int.value +lw $t0, 112($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#BinaryOperator left_25 * right_26 +lw $a0, 104($sp) +lw $t1, 108($sp) +mul $a0, $a0, $t1 +sw $a0, 100($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#VCall i2a_aux +move $t0, $sp +# Arg result_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 160($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 92($sp) +#VCall concat +move $t0, $sp +# Arg result_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 84($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 76($sp) +#AssignNode result_9 = result_18 +lw $t1, 76($sp) +sw $t1, 40($sp) +#Goto label_65 +b label_65 +#LabelNode label_64 +label_64: +#VCall i2a_aux +move $t0, $sp +# Arg i +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 160($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 144($sp) +#AssignNode result_9 = result_35 +lw $t1, 144($sp) +sw $t1, 40($sp) +#LabelNode label_65 +label_65: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_66 +b label_66 +#LabelNode label_63 +label_63: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 148($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode String_init +move $t0, $sp +# Arg l_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 156($sp) +#AssignNode result_0 = instance_37 +lw $t1, 152($sp) +sw $t1, 4($sp) +#LabelNode label_66 +label_66: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 168 +jr $ra +A2I.i2a_aux: +addi $sp, $sp, -152 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_67 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_67 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 56($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 60($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 64($sp) +#GetAttr left_11 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#GetAttr right_12 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#BinaryOperator left_11 / right_12 +lw $a0, 48($sp) +lw $t1, 52($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 68($sp) +#AssignNode next_17 = result_9 +lw $t1, 40($sp) +sw $t1, 72($sp) +#VCall i2a_aux +move $t0, $sp +# Arg next_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 156($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 124($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 128($sp) +#GetAttr left_27 = Int.value +lw $t0, 72($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#GetAttr right_28 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#BinaryOperator left_27 * right_28 +lw $a0, 112($sp) +lw $t1, 116($sp) +mul $a0, $a0, $t1 +sw $a0, 108($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#GetAttr left_23 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#GetAttr right_24 = Int.value +lw $t0, 104($sp) +lw $t1, 16($t0) +sw $t1, 100($sp) +#BinaryOperator left_23 - right_24 +lw $a0, 96($sp) +lw $t1, 100($sp) +sub $a0, $a0, $t1 +sw $a0, 92($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#VCall i2c +move $t0, $sp +# Arg result_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 156($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 84($sp) +#VCall concat +move $t0, $sp +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 80($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 76($sp) +#AssignNode result_34 = result_18 +lw $t1, 76($sp) +sw $t1, 140($sp) +#AssignNode result_0 = result_34 +lw $t1, 140($sp) +sw $t1, 4($sp) +#Goto label_68 +b label_68 +#LabelNode label_67 +label_67: +#LoadStr empty_str +la $t0, empty_str +sw $t0, 144($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 148($sp) +#CallNode String_init +move $t0, $sp +# Arg l_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 152($sp) +#AssignNode result_0 = instance_36 +lw $t1, 148($sp) +sw $t1, 4($sp) +#LabelNode label_68 +label_68: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 164 +jr $ra +Main_init: +addi $sp, $sp, -28 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#SetAttr Mainchar = instance_1 +lw $t0, 32($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#SetAttr Mainavar = void +lw $t0, 32($sp) +la $t1, void +sw $t1, 20($t0) +#SetAttr Maina_var = void +lw $t0, 32($sp) +la $t1, void +sw $t1, 24($t0) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 24($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 28($sp) +#SetAttr Mainflag = instance_4 +lw $t0, 32($sp) +lw $t1, 20($sp) +sw $t1, 28($t0) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Main.menu: +addi $sp, $sp, -356 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_15 +la $t0, msg_15 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 20($sp) +#LoadStr msg_16 +la $t0, msg_16 +sw $t0, 32($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode String_init +move $t0, $sp +# Arg l_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 40($sp) +#VCall out_string +move $t0, $sp +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 28($sp) +#LoadStr msg_17 +la $t0, msg_17 +sw $t0, 48($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 52($sp) +#CallNode String_init +move $t0, $sp +# Arg l_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 56($sp) +#VCall out_string +move $t0, $sp +# Arg instance_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 44($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 60($sp) +#LoadStr msg_18 +la $t0, msg_18 +sw $t0, 72($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode String_init +move $t0, $sp +# Arg l_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 80($sp) +#VCall out_string +move $t0, $sp +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 68($sp) +#LoadStr msg_19 +la $t0, msg_19 +sw $t0, 88($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#CallNode String_init +move $t0, $sp +# Arg l_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 96($sp) +#VCall out_string +move $t0, $sp +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 84($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 100($sp) +#LoadStr msg_20 +la $t0, msg_20 +sw $t0, 112($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode String_init +move $t0, $sp +# Arg l_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 120($sp) +#VCall out_string +move $t0, $sp +# Arg instance_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 108($sp) +#LoadStr msg_21 +la $t0, msg_21 +sw $t0, 128($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#CallNode String_init +move $t0, $sp +# Arg l_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 136($sp) +#VCall out_string +move $t0, $sp +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 124($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 140($sp) +#LoadStr msg_22 +la $t0, msg_22 +sw $t0, 152($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 156($sp) +#CallNode String_init +move $t0, $sp +# Arg l_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 160($sp) +#VCall out_string +move $t0, $sp +# Arg instance_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 148($sp) +#LoadStr msg_23 +la $t0, msg_23 +sw $t0, 168($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#CallNode String_init +move $t0, $sp +# Arg l_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 176($sp) +#VCall out_string +move $t0, $sp +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 164($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 180($sp) +#LoadStr msg_24 +la $t0, msg_24 +sw $t0, 192($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 196($sp) +#CallNode String_init +move $t0, $sp +# Arg l_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 200($sp) +#VCall out_string +move $t0, $sp +# Arg instance_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 188($sp) +#LoadStr msg_25 +la $t0, msg_25 +sw $t0, 208($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 212($sp) +#CallNode String_init +move $t0, $sp +# Arg l_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 216($sp) +#VCall out_string +move $t0, $sp +# Arg instance_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 204($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 220($sp) +#LoadStr msg_26 +la $t0, msg_26 +sw $t0, 232($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 236($sp) +#CallNode String_init +move $t0, $sp +# Arg l_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 240($sp) +#VCall out_string +move $t0, $sp +# Arg instance_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 228($sp) +#LoadStr msg_27 +la $t0, msg_27 +sw $t0, 248($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#CallNode String_init +move $t0, $sp +# Arg l_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 256($sp) +#VCall out_string +move $t0, $sp +# Arg instance_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 244($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 260($sp) +#LoadStr msg_28 +la $t0, msg_28 +sw $t0, 272($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 276($sp) +#CallNode String_init +move $t0, $sp +# Arg l_67 +lw $t1, 272($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 280($sp) +#VCall out_string +move $t0, $sp +# Arg instance_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 268($sp) +#LoadStr msg_29 +la $t0, msg_29 +sw $t0, 288($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 292($sp) +#CallNode String_init +move $t0, $sp +# Arg l_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_72 +lw $t1, 292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 296($sp) +#VCall out_string +move $t0, $sp +# Arg instance_72 +lw $t1, 292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 284($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 360($sp) +lw $t1, 20($t0) +sw $t1, 304($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 300($sp) +#LoadStr msg_30 +la $t0, msg_30 +sw $t0, 312($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 316($sp) +#CallNode String_init +move $t0, $sp +# Arg l_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 320($sp) +#VCall out_string +move $t0, $sp +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 308($sp) +#LoadStr msg_31 +la $t0, msg_31 +sw $t0, 328($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#CallNode String_init +move $t0, $sp +# Arg l_81 +lw $t1, 328($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 336($sp) +#VCall out_string +move $t0, $sp +# Arg instance_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 324($sp) +#LoadStr msg_32 +la $t0, msg_32 +sw $t0, 344($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 348($sp) +#CallNode String_init +move $t0, $sp +# Arg l_85 +lw $t1, 344($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 352($sp) +#VCall out_string +move $t0, $sp +# Arg instance_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 340($sp) +#VCall in_string +move $t0, $sp +# Arg self +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 360($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 356($sp) +#Return result_88 +lw $a1, 356($sp) +lw $ra, 0($sp) +addi $sp, $sp, 364 +jr $ra +Main.prompt: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#LoadStr msg_33 +la $t0, msg_33 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#VCall out_string +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#VCall in_string +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 36($sp) +#Return result_8 +lw $a1, 36($sp) +lw $ra, 0($sp) +addi $sp, $sp, 44 +jr $ra +Main.get_int: +addi $sp, $sp, -32 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 6:tag A2I:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, A2I_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, A2I_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode A2I_init +move $t0, $sp +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A2I_init +sw $a1, 8($sp) +#AssignNode z_2 = result_0 +lw $t1, 4($sp) +sw $t1, 12($sp) +#VCall prompt +move $t0, $sp +# Arg self +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 36($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 16($sp) +#AssignNode s_4 = result_3 +lw $t1, 16($sp) +sw $t1, 20($sp) +#VCall a2i +move $t0, $sp +# Arg s_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg z_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 24($sp) +#AssignNode result_6 = result_5 +lw $t1, 24($sp) +sw $t1, 28($sp) +#AssignNode result_7 = result_6 +lw $t1, 28($sp) +sw $t1, 32($sp) +#Return result_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 40 +jr $ra +Main.is_even: +addi $sp, $sp, -196 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#AssignNode x_0 = num +lw $t1, 204($sp) +sw $t1, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_4 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr right_5 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#BinaryOperator left_4 < right_5 +lw $a0, 20($sp) +lw $t1, 24($sp) +slt $a0, $a0, $t1 +sw $a0, 16($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_2 -> label_69 +lw $t0, 12($sp) +lw $a0, 16($t0) +bnez $a0, label_69 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 64($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 72($sp) +#GetAttr left_13 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 76($sp) +# IFGoto result_11 -> label_70 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_70 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#GetAttr left_22 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 = right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +seq $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 112($sp) +# IFGoto result_20 -> label_71 +lw $t0, 84($sp) +lw $a0, 16($t0) +bnez $a0, label_71 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 140($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 144($sp) +#GetAttr left_31 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 128($sp) +#GetAttr right_32 = Int.value +lw $t0, 136($sp) +lw $t1, 16($t0) +sw $t1, 132($sp) +#BinaryOperator left_31 - right_32 +lw $a0, 128($sp) +lw $t1, 132($sp) +sub $a0, $a0, $t1 +sw $a0, 124($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 148($sp) +#VCall is_even +move $t0, $sp +# Arg result_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 200($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 116($sp) +#AssignNode result_19 = result_28 +lw $t1, 116($sp) +sw $t1, 80($sp) +#Goto label_72 +b label_72 +#LabelNode label_71 +label_71: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 156($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 160($sp) +#AssignNode result_19 = instance_37 +lw $t1, 152($sp) +sw $t1, 80($sp) +#LabelNode label_72 +label_72: +#AssignNode result_10 = result_19 +lw $t1, 80($sp) +sw $t1, 44($sp) +#Goto label_73 +b label_73 +#LabelNode label_70 +label_70: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 164($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 168($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 172($sp) +#AssignNode result_10 = instance_40 +lw $t1, 164($sp) +sw $t1, 44($sp) +#LabelNode label_73 +label_73: +#AssignNode result_1 = result_10 +lw $t1, 44($sp) +sw $t1, 8($sp) +#Goto label_74 +b label_74 +#LabelNode label_69 +label_69: +#GetAttr l_46 = Int.value +lw $t0, 4($sp) +lw $t1, 16($t0) +sw $t1, 188($sp) +#UnaryOperator ~ l_46 +lw $t1, 188($sp) +neg $a0, $t1 +sw $a0, 184($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 180($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 192($sp) +#VCall is_even +move $t0, $sp +# Arg result_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 200($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 176($sp) +#AssignNode result_1 = result_43 +lw $t1, 176($sp) +sw $t1, 8($sp) +#LabelNode label_74 +label_74: +#AssignNode result_48 = result_1 +lw $t1, 8($sp) +sw $t1, 196($sp) +#Return result_48 +lw $a1, 196($sp) +lw $ra, 0($sp) +addi $sp, $sp, 208 +jr $ra +Main.class_type: +addi $sp, $sp, -124 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Case var +lw $t0, 132($sp) +lw $t1, 0($t0) +la $a0, void +bne $t1, $a0, label_75 +b case_void_error +#LabelNode label_75 +label_75: +#Action +blt $t1, 9, label_77 +bgt $t1, 9, label_77 +#AssignNode e_1 = var +lw $t1, 132($sp) +sw $t1, 8($sp) +#LoadStr msg_34 +la $t0, msg_34 +sw $t0, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg l_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#VCall out_string +move $t0, $sp +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 12($sp) +#AssignNode result_0 = result_2 +lw $t1, 12($sp) +sw $t1, 4($sp) +#Goto label_76 +b label_76 +#LabelNode label_77 +label_77: +#Action +blt $t1, 8, label_78 +bgt $t1, 9, label_78 +#AssignNode d_6 = var +lw $t1, 132($sp) +sw $t1, 28($sp) +#LoadStr msg_35 +la $t0, msg_35 +sw $t0, 36($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode String_init +move $t0, $sp +# Arg l_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 44($sp) +#VCall out_string +move $t0, $sp +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 32($sp) +#AssignNode result_0 = result_7 +lw $t1, 32($sp) +sw $t1, 4($sp) +#Goto label_76 +b label_76 +#LabelNode label_78 +label_78: +#Action +blt $t1, 7, label_79 +bgt $t1, 7, label_79 +#AssignNode c_11 = var +lw $t1, 132($sp) +sw $t1, 48($sp) +#LoadStr msg_36 +la $t0, msg_36 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#AssignNode result_0 = result_12 +lw $t1, 52($sp) +sw $t1, 4($sp) +#Goto label_76 +b label_76 +#LabelNode label_79 +label_79: +#Action +blt $t1, 6, label_80 +bgt $t1, 9, label_80 +#AssignNode b_16 = var +lw $t1, 132($sp) +sw $t1, 68($sp) +#LoadStr msg_37 +la $t0, msg_37 +sw $t0, 76($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode String_init +move $t0, $sp +# Arg l_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 84($sp) +#VCall out_string +move $t0, $sp +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 72($sp) +#AssignNode result_0 = result_17 +lw $t1, 72($sp) +sw $t1, 4($sp) +#Goto label_76 +b label_76 +#LabelNode label_80 +label_80: +#Action +blt $t1, 5, label_81 +bgt $t1, 9, label_81 +#AssignNode a_21 = var +lw $t1, 132($sp) +sw $t1, 88($sp) +#LoadStr msg_38 +la $t0, msg_38 +sw $t0, 96($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode String_init +move $t0, $sp +# Arg l_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 104($sp) +#VCall out_string +move $t0, $sp +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 92($sp) +#AssignNode result_0 = result_22 +lw $t1, 92($sp) +sw $t1, 4($sp) +#Goto label_76 +b label_76 +#LabelNode label_81 +label_81: +#Action +blt $t1, 0, label_82 +bgt $t1, 9, label_82 +#AssignNode o_26 = var +lw $t1, 132($sp) +sw $t1, 108($sp) +#LoadStr msg_39 +la $t0, msg_39 +sw $t0, 116($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#CallNode String_init +move $t0, $sp +# Arg l_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 124($sp) +#VCall out_string +move $t0, $sp +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 128($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 112($sp) +#AssignNode result_0 = result_27 +lw $t1, 112($sp) +sw $t1, 4($sp) +#Goto label_76 +b label_76 +#LabelNode label_82 +label_82: +#Goto case_no_match_error +b case_no_match_error +#LabelNode label_76 +label_76: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 136 +jr $ra +Main.print: +addi $sp, $sp, -44 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 6:tag A2I:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, A2I_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, A2I_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode A2I_init +move $t0, $sp +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A2I_init +sw $a1, 8($sp) +#AssignNode z_2 = result_0 +lw $t1, 4($sp) +sw $t1, 12($sp) +#VCall value +move $t0, $sp +# Arg var +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 52($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 24($sp) +#VCall i2a +move $t0, $sp +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg z_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 20($sp) +#VCall out_string +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 16($sp) +#LoadStr msg_40 +la $t0, msg_40 +sw $t0, 32($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode String_init +move $t0, $sp +# Arg l_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 40($sp) +#VCall out_string +move $t0, $sp +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 28($sp) +#AssignNode result_10 = result_6 +lw $t1, 28($sp) +sw $t1, 44($sp) +#Return result_10 +lw $a1, 44($sp) +lw $ra, 0($sp) +addi $sp, $sp, 56 +jr $ra +Main.main: +addi $sp, $sp, -1136 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode A_init +move $t0, $sp +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 8($sp) +#SetAttr Mainavar = result_0 +lw $t0, 1140($sp) +lw $t1, 4($sp) +sw $t1, 20($t0) +#LabelNode label_83 +label_83: +#GetAttr Main.flag = Main.flag +lw $t0, 1140($sp) +lw $t1, 28($t0) +sw $t1, 20($sp) +# IFGoto Main.flag -> label_84 +lw $t0, 20($sp) +lw $a0, 16($t0) +bnez $a0, label_84 +#Goto label_85 +b label_85 +#LabelNode label_84 +label_84: +#LoadStr msg_41 +la $t0, msg_41 +sw $t0, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg l_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#VCall out_string +move $t0, $sp +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 24($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 40($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 56($sp) +#VCall is_even +move $t0, $sp +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 52($sp) +# IFGoto result_12 -> label_86 +lw $t0, 52($sp) +lw $a0, 16($t0) +bnez $a0, label_86 +#LoadStr msg_42 +la $t0, msg_42 +sw $t0, 68($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#CallNode String_init +move $t0, $sp +# Arg l_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 76($sp) +#VCall out_string +move $t0, $sp +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 64($sp) +#AssignNode result_11 = result_15 +lw $t1, 64($sp) +sw $t1, 48($sp) +#Goto label_87 +b label_87 +#LabelNode label_86 +label_86: +#LoadStr msg_43 +la $t0, msg_43 +sw $t0, 84($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode String_init +move $t0, $sp +# Arg l_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 92($sp) +#VCall out_string +move $t0, $sp +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 80($sp) +#AssignNode result_11 = result_19 +lw $t1, 80($sp) +sw $t1, 48($sp) +#LabelNode label_87 +label_87: +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall class_type +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 96($sp) +#VCall menu +move $t0, $sp +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 104($sp) +#SetAttr Mainchar = result_25 +lw $t0, 1140($sp) +lw $t1, 104($sp) +sw $t1, 16($t0) +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_44 +la $t0, msg_44 +sw $t0, 136($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 140($sp) +#CallNode String_init +move $t0, $sp +# Arg l_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 144($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 120($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 148($sp) +# IFGoto result_28 -> label_88 +lw $t0, 116($sp) +lw $a0, 16($t0) +bnez $a0, label_88 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_45 +la $t0, msg_45 +sw $t0, 176($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 180($sp) +#CallNode String_init +move $t0, $sp +# Arg l_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 184($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 160($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 156($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 188($sp) +# IFGoto result_38 -> label_89 +lw $t0, 156($sp) +lw $a0, 16($t0) +bnez $a0, label_89 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_46 +la $t0, msg_46 +sw $t0, 216($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 220($sp) +#CallNode String_init +move $t0, $sp +# Arg l_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 224($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 200($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 196($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_49 +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 228($sp) +# IFGoto result_48 -> label_90 +lw $t0, 196($sp) +lw $a0, 16($t0) +bnez $a0, label_90 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_47 +la $t0, msg_47 +sw $t0, 256($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 260($sp) +#CallNode String_init +move $t0, $sp +# Arg l_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 264($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 240($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 236($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 268($sp) +# IFGoto result_58 -> label_91 +lw $t0, 236($sp) +lw $a0, 16($t0) +bnez $a0, label_91 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_48 +la $t0, msg_48 +sw $t0, 296($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 300($sp) +#CallNode String_init +move $t0, $sp +# Arg l_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 304($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 280($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 276($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 308($sp) +# IFGoto result_68 -> label_92 +lw $t0, 276($sp) +lw $a0, 16($t0) +bnez $a0, label_92 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_49 +la $t0, msg_49 +sw $t0, 336($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 340($sp) +#CallNode String_init +move $t0, $sp +# Arg l_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_84 +lw $t1, 340($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 344($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_84 +lw $t1, 340($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 320($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 316($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_79 +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 348($sp) +# IFGoto result_78 -> label_93 +lw $t0, 316($sp) +lw $a0, 16($t0) +bnez $a0, label_93 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_50 +la $t0, msg_50 +sw $t0, 376($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 380($sp) +#CallNode String_init +move $t0, $sp +# Arg l_93 +lw $t1, 376($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 384($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 360($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 356($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_89 +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_88 +lw $t1, 356($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 388($sp) +# IFGoto result_88 -> label_94 +lw $t0, 356($sp) +lw $a0, 16($t0) +bnez $a0, label_94 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_51 +la $t0, msg_51 +sw $t0, 416($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 420($sp) +#CallNode String_init +move $t0, $sp +# Arg l_103 +lw $t1, 416($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 424($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 400($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 396($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_99 +lw $t1, 400($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_98 +lw $t1, 396($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 428($sp) +# IFGoto result_98 -> label_95 +lw $t0, 396($sp) +lw $a0, 16($t0) +bnez $a0, label_95 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_52 +la $t0, msg_52 +sw $t0, 456($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 460($sp) +#CallNode String_init +move $t0, $sp +# Arg l_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_114 +lw $t1, 460($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 464($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_114 +lw $t1, 460($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 440($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 436($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_108 +lw $t1, 436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 468($sp) +# IFGoto result_108 -> label_96 +lw $t0, 436($sp) +lw $a0, 16($t0) +bnez $a0, label_96 +#GetAttr Main.char = Main.char +lw $t0, 1140($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#LoadStr msg_53 +la $t0, msg_53 +sw $t0, 496($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 500($sp) +#CallNode String_init +move $t0, $sp +# Arg l_123 +lw $t1, 496($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_124 +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 504($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_124 +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Main.char +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 480($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 476($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 508($sp) +# IFGoto result_118 -> label_97 +lw $t0, 476($sp) +lw $a0, 16($t0) +bnez $a0, label_97 +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 516($sp) +#CallNode A_init +move $t0, $sp +# Arg result_128 +lw $t1, 516($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 520($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 524($sp) +#VCall method1 +move $t0, $sp +# Arg result_130 +lw $t1, 524($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_128 +lw $t1, 516($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 516($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 512($sp) +#SetAttr Mainavar = result_127 +lw $t0, 1140($sp) +lw $t1, 512($sp) +sw $t1, 20($t0) +#AssignNode result_117 = result_127 +lw $t1, 512($sp) +sw $t1, 472($sp) +#Goto label_98 +b label_98 +#LabelNode label_97 +label_97: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 536($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 540($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_134 +lw $t1, 540($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_133 +lw $t1, 536($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 544($sp) +#SetAttr Mainflag = instance_133 +lw $t0, 1140($sp) +lw $t1, 536($sp) +sw $t1, 28($t0) +#AssignNode result_117 = instance_133 +lw $t1, 536($sp) +sw $t1, 472($sp) +#LabelNode label_98 +label_98: +#AssignNode result_107 = result_117 +lw $t1, 472($sp) +sw $t1, 432($sp) +#Goto label_99 +b label_99 +#LabelNode label_96 +label_96: +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 552($sp) +#CallNode A_init +move $t0, $sp +# Arg result_137 +lw $t1, 552($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 556($sp) +#SetAttr Mainavar = result_137 +lw $t0, 1140($sp) +lw $t1, 552($sp) +sw $t1, 20($t0) +#AssignNode result_107 = result_137 +lw $t1, 552($sp) +sw $t1, 432($sp) +#LabelNode label_99 +label_99: +#AssignNode result_97 = result_107 +lw $t1, 432($sp) +sw $t1, 392($sp) +#Goto label_100 +b label_100 +#LabelNode label_95 +label_95: +#AssignNode x_140 = None +la $t1, void +sw $t1, 564($sp) +#Allocate 9:tag E:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 9 +sw $t1, 0($t0) +la $t1, E_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, E_methods +sw $t1, 12($t0) +sw $t0, 572($sp) +#CallNode E_init +move $t0, $sp +# Arg result_142 +lw $t1, 572($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal E_init +sw $a1, 576($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 580($sp) +#VCall method6 +move $t0, $sp +# Arg result_144 +lw $t1, 580($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_142 +lw $t1, 572($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 572($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 568($sp) +#AssignNode x_140 = result_141 +lw $t1, 568($sp) +sw $t1, 564($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 608($sp) +#VCall value +move $t0, $sp +# Arg x_140 +lw $t1, 564($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 564($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 632($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 636($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 640($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_159 +lw $t1, 640($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_158 +lw $t1, 636($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 644($sp) +#GetAttr left_155 = Int.value +lw $t0, 632($sp) +lw $t1, 16($t0) +sw $t1, 624($sp) +#GetAttr right_156 = Int.value +lw $t0, 636($sp) +lw $t1, 16($t0) +sw $t1, 628($sp) +#BinaryOperator left_155 * right_156 +lw $a0, 624($sp) +lw $t1, 628($sp) +mul $a0, $a0, $t1 +sw $a0, 620($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 616($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_154 +lw $t1, 620($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_153 +lw $t1, 616($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 648($sp) +#GetAttr left_149 = Int.value +lw $t0, 608($sp) +lw $t1, 16($t0) +sw $t1, 600($sp) +#GetAttr right_150 = Int.value +lw $t0, 616($sp) +lw $t1, 16($t0) +sw $t1, 604($sp) +#BinaryOperator left_149 - right_150 +lw $a0, 600($sp) +lw $t1, 604($sp) +sub $a0, $a0, $t1 +sw $a0, 596($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 592($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_148 +lw $t1, 596($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_147 +lw $t1, 592($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 652($sp) +#AssignNode r_163 = result_147 +lw $t1, 592($sp) +sw $t1, 656($sp) +#LoadStr msg_41 +la $t0, msg_41 +sw $t0, 664($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 668($sp) +#CallNode String_init +move $t0, $sp +# Arg l_165 +lw $t1, 664($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_166 +lw $t1, 668($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 672($sp) +#VCall out_string +move $t0, $sp +# Arg instance_166 +lw $t1, 668($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 660($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 676($sp) +#LoadStr msg_54 +la $t0, msg_54 +sw $t0, 688($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 692($sp) +#CallNode String_init +move $t0, $sp +# Arg l_171 +lw $t1, 688($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_172 +lw $t1, 692($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 696($sp) +#VCall out_string +move $t0, $sp +# Arg instance_172 +lw $t1, 692($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 684($sp) +#VCall print +move $t0, $sp +# Arg x_140 +lw $t1, 564($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 700($sp) +#LoadStr msg_55 +la $t0, msg_55 +sw $t0, 708($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 712($sp) +#CallNode String_init +move $t0, $sp +# Arg l_176 +lw $t1, 708($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_177 +lw $t1, 712($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 716($sp) +#VCall out_string +move $t0, $sp +# Arg instance_177 +lw $t1, 712($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 704($sp) +#Allocate 6:tag A2I:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, A2I_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, A2I_methods +sw $t1, 12($t0) +sw $t0, 720($sp) +#CallNode A2I_init +move $t0, $sp +# Arg result_179 +lw $t1, 720($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A2I_init +sw $a1, 724($sp) +#AssignNode a_181 = result_179 +lw $t1, 720($sp) +sw $t1, 728($sp) +#VCall i2a +move $t0, $sp +# Arg r_163 +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg a_181 +lw $t1, 728($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 728($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 736($sp) +#VCall out_string +move $t0, $sp +# Arg result_183 +lw $t1, 736($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 732($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 744($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 748($sp) +#CallNode String_init +move $t0, $sp +# Arg l_185 +lw $t1, 744($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_186 +lw $t1, 748($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 752($sp) +#VCall out_string +move $t0, $sp +# Arg instance_186 +lw $t1, 748($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 740($sp) +#AssignNode result_188 = result_184 +lw $t1, 740($sp) +sw $t1, 756($sp) +#AssignNode result_189 = result_188 +lw $t1, 756($sp) +sw $t1, 760($sp) +#SetAttr Mainavar = x_140 +lw $t0, 1140($sp) +lw $t1, 564($sp) +sw $t1, 20($t0) +#AssignNode result_191 = x_140 +lw $t1, 564($sp) +sw $t1, 768($sp) +#AssignNode result_97 = result_191 +lw $t1, 768($sp) +sw $t1, 392($sp) +#LabelNode label_100 +label_100: +#AssignNode result_87 = result_97 +lw $t1, 392($sp) +sw $t1, 352($sp) +#Goto label_101 +b label_101 +#LabelNode label_94 +label_94: +#Allocate 8:tag D:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 8 +sw $t1, 0($t0) +la $t1, D_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, D_methods +sw $t1, 12($t0) +sw $t0, 780($sp) +#CallNode D_init +move $t0, $sp +# Arg result_194 +lw $t1, 780($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal D_init +sw $a1, 784($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 788($sp) +#VCall method7 +move $t0, $sp +# Arg result_196 +lw $t1, 788($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_194 +lw $t1, 780($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 780($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 776($sp) +# IFGoto result_193 -> label_102 +lw $t0, 776($sp) +lw $a0, 16($t0) +bnez $a0, label_102 +#LoadStr msg_41 +la $t0, msg_41 +sw $t0, 800($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 804($sp) +#CallNode String_init +move $t0, $sp +# Arg l_199 +lw $t1, 800($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_200 +lw $t1, 804($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 808($sp) +#VCall out_string +move $t0, $sp +# Arg instance_200 +lw $t1, 804($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 796($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 812($sp) +#LoadStr msg_56 +la $t0, msg_56 +sw $t0, 824($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 828($sp) +#CallNode String_init +move $t0, $sp +# Arg l_205 +lw $t1, 824($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_206 +lw $t1, 828($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 832($sp) +#VCall out_string +move $t0, $sp +# Arg instance_206 +lw $t1, 828($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 820($sp) +#AssignNode result_192 = result_204 +lw $t1, 820($sp) +sw $t1, 772($sp) +#Goto label_103 +b label_103 +#LabelNode label_102 +label_102: +#LoadStr msg_41 +la $t0, msg_41 +sw $t0, 840($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 844($sp) +#CallNode String_init +move $t0, $sp +# Arg l_209 +lw $t1, 840($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_210 +lw $t1, 844($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 848($sp) +#VCall out_string +move $t0, $sp +# Arg instance_210 +lw $t1, 844($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 836($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall print +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 852($sp) +#LoadStr msg_57 +la $t0, msg_57 +sw $t0, 864($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 868($sp) +#CallNode String_init +move $t0, $sp +# Arg l_215 +lw $t1, 864($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_216 +lw $t1, 868($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 872($sp) +#VCall out_string +move $t0, $sp +# Arg instance_216 +lw $t1, 868($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 860($sp) +#AssignNode result_192 = result_214 +lw $t1, 860($sp) +sw $t1, 772($sp) +#LabelNode label_103 +label_103: +#AssignNode result_87 = result_192 +lw $t1, 772($sp) +sw $t1, 352($sp) +#LabelNode label_101 +label_101: +#AssignNode result_77 = result_87 +lw $t1, 352($sp) +sw $t1, 312($sp) +#Goto label_104 +b label_104 +#LabelNode label_93 +label_93: +#Allocate 7:tag C:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 7 +sw $t1, 0($t0) +la $t1, C_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, C_methods +sw $t1, 12($t0) +sw $t0, 880($sp) +#CallNode C_init +move $t0, $sp +# Arg result_219 +lw $t1, 880($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal C_init +sw $a1, 884($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 888($sp) +#Allocate 7:tag C:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 7 +sw $t1, 0($t0) +la $t1, C_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, C_methods +sw $t1, 12($t0) +sw $t0, 896($sp) +#VCall method5 +move $t0, $sp +# Arg result_221 +lw $t1, 888($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_219 +lw $t1, 880($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 896($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 876($sp) +#SetAttr Mainavar = result_218 +lw $t0, 1140($sp) +lw $t1, 876($sp) +sw $t1, 20($t0) +#AssignNode result_77 = result_218 +lw $t1, 876($sp) +sw $t1, 312($sp) +#LabelNode label_104 +label_104: +#AssignNode result_67 = result_77 +lw $t1, 312($sp) +sw $t1, 272($sp) +#Goto label_105 +b label_105 +#LabelNode label_92 +label_92: +#Allocate 7:tag C:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 7 +sw $t1, 0($t0) +la $t1, C_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, C_methods +sw $t1, 12($t0) +sw $t0, 908($sp) +#CallNode C_init +move $t0, $sp +# Arg result_226 +lw $t1, 908($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal C_init +sw $a1, 912($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 916($sp) +#Allocate 6:tag B:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, B_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, B_methods +sw $t1, 12($t0) +sw $t0, 924($sp) +#VCall method5 +move $t0, $sp +# Arg result_228 +lw $t1, 916($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_226 +lw $t1, 908($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 924($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 904($sp) +#SetAttr Mainavar = result_225 +lw $t0, 1140($sp) +lw $t1, 904($sp) +sw $t1, 20($t0) +#AssignNode result_67 = result_225 +lw $t1, 904($sp) +sw $t1, 272($sp) +#LabelNode label_105 +label_105: +#AssignNode result_57 = result_67 +lw $t1, 272($sp) +sw $t1, 232($sp) +#Goto label_106 +b label_106 +#LabelNode label_91 +label_91: +#Allocate 7:tag C:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 7 +sw $t1, 0($t0) +la $t1, C_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, C_methods +sw $t1, 12($t0) +sw $t0, 936($sp) +#CallNode C_init +move $t0, $sp +# Arg result_233 +lw $t1, 936($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal C_init +sw $a1, 940($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 944($sp) +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 952($sp) +#VCall method5 +move $t0, $sp +# Arg result_235 +lw $t1, 944($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_233 +lw $t1, 936($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 952($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 932($sp) +#SetAttr Mainavar = result_232 +lw $t0, 1140($sp) +lw $t1, 932($sp) +sw $t1, 20($t0) +#AssignNode result_57 = result_232 +lw $t1, 932($sp) +sw $t1, 232($sp) +#LabelNode label_106 +label_106: +#AssignNode result_47 = result_57 +lw $t1, 232($sp) +sw $t1, 192($sp) +#Goto label_107 +b label_107 +#LabelNode label_90 +label_90: +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 964($sp) +#CallNode A_init +move $t0, $sp +# Arg result_240 +lw $t1, 964($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 968($sp) +#VCall get_int +move $t0, $sp +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 972($sp) +#VCall set_var +move $t0, $sp +# Arg result_242 +lw $t1, 972($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_240 +lw $t1, 964($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 964($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 960($sp) +#SetAttr Maina_var = result_239 +lw $t0, 1140($sp) +lw $t1, 960($sp) +sw $t1, 24($t0) +#Allocate 8:tag D:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 8 +sw $t1, 0($t0) +la $t1, D_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, D_methods +sw $t1, 12($t0) +sw $t0, 984($sp) +#CallNode D_init +move $t0, $sp +# Arg result_245 +lw $t1, 984($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal D_init +sw $a1, 988($sp) +#GetAttr Main.a_var = Main.a_var +lw $t0, 1140($sp) +lw $t1, 24($t0) +sw $t1, 1124($sp) +#VCall value +move $t0, $sp +# Arg Main.a_var +lw $t1, 1124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1124($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 992($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 1000($sp) +#VCall method4 +move $t0, $sp +# Arg result_247 +lw $t1, 992($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_249 +lw $t1, 1000($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_245 +lw $t1, 984($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 984($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 980($sp) +#SetAttr Mainavar = result_244 +lw $t0, 1140($sp) +lw $t1, 980($sp) +sw $t1, 20($t0) +#AssignNode result_47 = result_244 +lw $t1, 980($sp) +sw $t1, 192($sp) +#LabelNode label_107 +label_107: +#AssignNode result_37 = result_47 +lw $t1, 192($sp) +sw $t1, 152($sp) +#Goto label_108 +b label_108 +#LabelNode label_89 +label_89: +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#Case Main.avar +lw $t0, 1132($sp) +lw $t1, 0($t0) +la $a0, void +bne $t1, $a0, label_109 +b case_void_error +#LabelNode label_109 +label_109: +#Action +blt $t1, 7, label_111 +bgt $t1, 7, label_111 +#AssignNode c_254 = Main.avar +lw $t1, 1132($sp) +sw $t1, 1020($sp) +#VCall value +move $t0, $sp +# Arg c_254 +lw $t1, 1020($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1020($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 1028($sp) +#VCall method6 +move $t0, $sp +# Arg result_256 +lw $t1, 1028($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg c_254 +lw $t1, 1020($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1020($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 1024($sp) +#SetAttr Mainavar = result_255 +lw $t0, 1140($sp) +lw $t1, 1024($sp) +sw $t1, 20($t0) +#AssignNode result_252 = result_255 +lw $t1, 1024($sp) +sw $t1, 1012($sp) +#Goto label_110 +b label_110 +#LabelNode label_111 +label_111: +#Action +blt $t1, 5, label_112 +bgt $t1, 9, label_112 +#AssignNode a_258 = Main.avar +lw $t1, 1132($sp) +sw $t1, 1036($sp) +#VCall value +move $t0, $sp +# Arg a_258 +lw $t1, 1036($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1036($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 1044($sp) +#VCall method3 +move $t0, $sp +# Arg result_260 +lw $t1, 1044($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg a_258 +lw $t1, 1036($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1036($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 1040($sp) +#SetAttr Mainavar = result_259 +lw $t0, 1140($sp) +lw $t1, 1040($sp) +sw $t1, 20($t0) +#AssignNode result_252 = result_259 +lw $t1, 1040($sp) +sw $t1, 1012($sp) +#Goto label_110 +b label_110 +#LabelNode label_112 +label_112: +#Action +blt $t1, 0, label_113 +bgt $t1, 9, label_113 +#AssignNode o_262 = Main.avar +lw $t1, 1132($sp) +sw $t1, 1052($sp) +#LoadStr msg_39 +la $t0, msg_39 +sw $t0, 1060($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1064($sp) +#CallNode String_init +move $t0, $sp +# Arg l_264 +lw $t1, 1060($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_265 +lw $t1, 1064($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1068($sp) +#VCall out_string +move $t0, $sp +# Arg instance_265 +lw $t1, 1064($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 1056($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 1072($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 1076($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 1080($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_269 +lw $t1, 1080($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_268 +lw $t1, 1076($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 1084($sp) +#AssignNode result_252 = instance_268 +lw $t1, 1076($sp) +sw $t1, 1012($sp) +#Goto label_110 +b label_110 +#LabelNode label_113 +label_113: +#Goto case_no_match_error +b case_no_match_error +#LabelNode label_110 +label_110: +#AssignNode result_37 = result_252 +lw $t1, 1012($sp) +sw $t1, 152($sp) +#LabelNode label_108 +label_108: +#AssignNode result_27 = result_37 +lw $t1, 152($sp) +sw $t1, 112($sp) +#Goto label_114 +b label_114 +#LabelNode label_88 +label_88: +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 1092($sp) +#CallNode A_init +move $t0, $sp +# Arg result_272 +lw $t1, 1092($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 1096($sp) +#VCall get_int +move $t0, $sp +# Arg self +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 1100($sp) +#VCall set_var +move $t0, $sp +# Arg result_274 +lw $t1, 1100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_272 +lw $t1, 1092($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1092($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 1088($sp) +#SetAttr Maina_var = result_271 +lw $t0, 1140($sp) +lw $t1, 1088($sp) +sw $t1, 24($t0) +#Allocate 6:tag B:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, B_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, B_methods +sw $t1, 12($t0) +sw $t0, 1112($sp) +#CallNode B_init +move $t0, $sp +# Arg result_277 +lw $t1, 1112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal B_init +sw $a1, 1116($sp) +#GetAttr Main.a_var = Main.a_var +lw $t0, 1140($sp) +lw $t1, 24($t0) +sw $t1, 1124($sp) +#VCall value +move $t0, $sp +# Arg Main.a_var +lw $t1, 1124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1124($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 1120($sp) +#GetAttr Main.avar = Main.avar +lw $t0, 1140($sp) +lw $t1, 20($t0) +sw $t1, 1132($sp) +#VCall value +move $t0, $sp +# Arg Main.avar +lw $t1, 1132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 1128($sp) +#VCall method2 +move $t0, $sp +# Arg result_279 +lw $t1, 1120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_281 +lw $t1, 1128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_277 +lw $t1, 1112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1112($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 1108($sp) +#SetAttr Mainavar = result_276 +lw $t0, 1140($sp) +lw $t1, 1108($sp) +sw $t1, 20($t0) +#AssignNode result_27 = result_276 +lw $t1, 1108($sp) +sw $t1, 112($sp) +#LabelNode label_114 +label_114: +#Goto label_83 +b label_83 +#LabelNode label_85 +label_85: +#Return result_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 1144 +jr $ra \ No newline at end of file diff --git a/tests/codegen/arith_input.txt b/tests/codegen/arith_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/arith_output.txt b/tests/codegen/arith_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/atoi.cl b/tests/codegen/atoi.cl old mode 100644 new mode 100755 diff --git a/tests/codegen/atoi.mips b/tests/codegen/atoi.mips new file mode 100644 index 000000000..5d71e5ce3 --- /dev/null +++ b/tests/codegen/atoi.mips @@ -0,0 +1,5430 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +A2I_name: .asciiz "A2I" +A2I_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A2I.c2i +.word A2I.i2c +.word A2I.a2i +.word A2I.a2i_aux +.word A2I.i2a +.word A2I.i2a_aux +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "0" +msg_4: .asciiz "1" +msg_5: .asciiz "2" +msg_6: .asciiz "3" +msg_7: .asciiz "4" +msg_8: .asciiz "5" +msg_9: .asciiz "6" +msg_10: .asciiz "7" +msg_11: .asciiz "8" +msg_12: .asciiz "9" +msg_13: .asciiz "-" +msg_14: .asciiz "+" +msg_15: .asciiz "678987" +msg_16: .asciiz " == " +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +A2I_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +A2I.c2i: +addi $sp, $sp, -496 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_1 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 60($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 64($sp) +#CallNode String_init +move $t0, $sp +# Arg l_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 68($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_10 -> label_2 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_2 +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 96($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode String_init +move $t0, $sp +# Arg l_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 104($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 84($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_19 -> label_3 +lw $t0, 80($sp) +lw $a0, 16($t0) +bnez $a0, label_3 +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 132($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#CallNode String_init +move $t0, $sp +# Arg l_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 140($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 120($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 144($sp) +# IFGoto result_28 -> label_4 +lw $t0, 116($sp) +lw $a0, 16($t0) +bnez $a0, label_4 +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 168($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#CallNode String_init +move $t0, $sp +# Arg l_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 176($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 156($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 180($sp) +# IFGoto result_37 -> label_5 +lw $t0, 152($sp) +lw $a0, 16($t0) +bnez $a0, label_5 +#LoadStr msg_8 +la $t0, msg_8 +sw $t0, 204($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 208($sp) +#CallNode String_init +move $t0, $sp +# Arg l_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 212($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 192($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 216($sp) +# IFGoto result_46 -> label_6 +lw $t0, 188($sp) +lw $a0, 16($t0) +bnez $a0, label_6 +#LoadStr msg_9 +la $t0, msg_9 +sw $t0, 240($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 244($sp) +#CallNode String_init +move $t0, $sp +# Arg l_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 248($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 228($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 224($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 252($sp) +# IFGoto result_55 -> label_7 +lw $t0, 224($sp) +lw $a0, 16($t0) +bnez $a0, label_7 +#LoadStr msg_10 +la $t0, msg_10 +sw $t0, 276($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 280($sp) +#CallNode String_init +move $t0, $sp +# Arg l_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 284($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 264($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 260($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_65 +lw $t1, 264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 288($sp) +# IFGoto result_64 -> label_8 +lw $t0, 260($sp) +lw $a0, 16($t0) +bnez $a0, label_8 +#LoadStr msg_11 +la $t0, msg_11 +sw $t0, 312($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 316($sp) +#CallNode String_init +move $t0, $sp +# Arg l_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 320($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 300($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 296($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 324($sp) +# IFGoto result_73 -> label_9 +lw $t0, 296($sp) +lw $a0, 16($t0) +bnez $a0, label_9 +#LoadStr msg_12 +la $t0, msg_12 +sw $t0, 348($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 352($sp) +#CallNode String_init +move $t0, $sp +# Arg l_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 356($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 336($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 360($sp) +# IFGoto result_82 -> label_10 +lw $t0, 332($sp) +lw $a0, 16($t0) +bnez $a0, label_10 +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 500($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 364($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 368($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 372($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 376($sp) +#AssignNode result_81 = instance_91 +lw $t1, 368($sp) +sw $t1, 328($sp) +#Goto label_11 +b label_11 +#LabelNode label_10 +label_10: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 380($sp) +#LoadInt 9 +li $t0, 9 +sw $t0, 384($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_95 +lw $t1, 384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 388($sp) +#AssignNode result_81 = instance_94 +lw $t1, 380($sp) +sw $t1, 328($sp) +#LabelNode label_11 +label_11: +#AssignNode result_72 = result_81 +lw $t1, 328($sp) +sw $t1, 292($sp) +#Goto label_12 +b label_12 +#LabelNode label_9 +label_9: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 392($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 396($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_98 +lw $t1, 396($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 400($sp) +#AssignNode result_72 = instance_97 +lw $t1, 392($sp) +sw $t1, 292($sp) +#LabelNode label_12 +label_12: +#AssignNode result_63 = result_72 +lw $t1, 292($sp) +sw $t1, 256($sp) +#Goto label_13 +b label_13 +#LabelNode label_8 +label_8: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 404($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 408($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 412($sp) +#AssignNode result_63 = instance_100 +lw $t1, 404($sp) +sw $t1, 256($sp) +#LabelNode label_13 +label_13: +#AssignNode result_54 = result_63 +lw $t1, 256($sp) +sw $t1, 220($sp) +#Goto label_14 +b label_14 +#LabelNode label_7 +label_7: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 416($sp) +#LoadInt 6 +li $t0, 6 +sw $t0, 420($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_103 +lw $t1, 416($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 424($sp) +#AssignNode result_54 = instance_103 +lw $t1, 416($sp) +sw $t1, 220($sp) +#LabelNode label_14 +label_14: +#AssignNode result_45 = result_54 +lw $t1, 220($sp) +sw $t1, 184($sp) +#Goto label_15 +b label_15 +#LabelNode label_6 +label_6: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 428($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 432($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_107 +lw $t1, 432($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 436($sp) +#AssignNode result_45 = instance_106 +lw $t1, 428($sp) +sw $t1, 184($sp) +#LabelNode label_15 +label_15: +#AssignNode result_36 = result_45 +lw $t1, 184($sp) +sw $t1, 148($sp) +#Goto label_16 +b label_16 +#LabelNode label_5 +label_5: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 440($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 444($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 448($sp) +#AssignNode result_36 = instance_109 +lw $t1, 440($sp) +sw $t1, 148($sp) +#LabelNode label_16 +label_16: +#AssignNode result_27 = result_36 +lw $t1, 148($sp) +sw $t1, 112($sp) +#Goto label_17 +b label_17 +#LabelNode label_4 +label_4: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 452($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 456($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_112 +lw $t1, 452($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 460($sp) +#AssignNode result_27 = instance_112 +lw $t1, 452($sp) +sw $t1, 112($sp) +#LabelNode label_17 +label_17: +#AssignNode result_18 = result_27 +lw $t1, 112($sp) +sw $t1, 76($sp) +#Goto label_18 +b label_18 +#LabelNode label_3 +label_3: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 464($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 468($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_116 +lw $t1, 468($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_115 +lw $t1, 464($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 472($sp) +#AssignNode result_18 = instance_115 +lw $t1, 464($sp) +sw $t1, 76($sp) +#LabelNode label_18 +label_18: +#AssignNode result_9 = result_18 +lw $t1, 76($sp) +sw $t1, 40($sp) +#Goto label_19 +b label_19 +#LabelNode label_2 +label_2: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 476($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 480($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 484($sp) +#AssignNode result_9 = instance_118 +lw $t1, 476($sp) +sw $t1, 40($sp) +#LabelNode label_19 +label_19: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_20 +b label_20 +#LabelNode label_1 +label_1: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 488($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 492($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 496($sp) +#AssignNode result_0 = instance_121 +lw $t1, 488($sp) +sw $t1, 4($sp) +#LabelNode label_20 +label_20: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 508 +jr $ra +A2I.i2c: +addi $sp, $sp, -496 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_21 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_21 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 64($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 68($sp) +#GetAttr left_12 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 = right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +seq $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_10 -> label_22 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_22 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#GetAttr left_21 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#GetAttr right_22 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#BinaryOperator left_21 = right_22 +lw $a0, 88($sp) +lw $t1, 92($sp) +seq $a0, $a0, $t1 +sw $a0, 84($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_19 -> label_23 +lw $t0, 80($sp) +lw $a0, 16($t0) +bnez $a0, label_23 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 136($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#GetAttr left_30 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 124($sp) +#GetAttr right_31 = Int.value +lw $t0, 132($sp) +lw $t1, 16($t0) +sw $t1, 128($sp) +#BinaryOperator left_30 = right_31 +lw $a0, 124($sp) +lw $t1, 128($sp) +seq $a0, $a0, $t1 +sw $a0, 120($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 144($sp) +# IFGoto result_28 -> label_24 +lw $t0, 116($sp) +lw $a0, 16($t0) +bnez $a0, label_24 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 168($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 172($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 176($sp) +#GetAttr left_39 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 160($sp) +#GetAttr right_40 = Int.value +lw $t0, 168($sp) +lw $t1, 16($t0) +sw $t1, 164($sp) +#BinaryOperator left_39 = right_40 +lw $a0, 160($sp) +lw $t1, 164($sp) +seq $a0, $a0, $t1 +sw $a0, 156($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 180($sp) +# IFGoto result_37 -> label_25 +lw $t0, 152($sp) +lw $a0, 16($t0) +bnez $a0, label_25 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 204($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 208($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 212($sp) +#GetAttr left_48 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 196($sp) +#GetAttr right_49 = Int.value +lw $t0, 204($sp) +lw $t1, 16($t0) +sw $t1, 200($sp) +#BinaryOperator left_48 = right_49 +lw $a0, 196($sp) +lw $t1, 200($sp) +seq $a0, $a0, $t1 +sw $a0, 192($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 216($sp) +# IFGoto result_46 -> label_26 +lw $t0, 188($sp) +lw $a0, 16($t0) +bnez $a0, label_26 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 240($sp) +#LoadInt 6 +li $t0, 6 +sw $t0, 244($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 248($sp) +#GetAttr left_57 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 232($sp) +#GetAttr right_58 = Int.value +lw $t0, 240($sp) +lw $t1, 16($t0) +sw $t1, 236($sp) +#BinaryOperator left_57 = right_58 +lw $a0, 232($sp) +lw $t1, 236($sp) +seq $a0, $a0, $t1 +sw $a0, 228($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 224($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 252($sp) +# IFGoto result_55 -> label_27 +lw $t0, 224($sp) +lw $a0, 16($t0) +bnez $a0, label_27 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 276($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 280($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 284($sp) +#GetAttr left_66 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 268($sp) +#GetAttr right_67 = Int.value +lw $t0, 276($sp) +lw $t1, 16($t0) +sw $t1, 272($sp) +#BinaryOperator left_66 = right_67 +lw $a0, 268($sp) +lw $t1, 272($sp) +seq $a0, $a0, $t1 +sw $a0, 264($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 260($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_65 +lw $t1, 264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 288($sp) +# IFGoto result_64 -> label_28 +lw $t0, 260($sp) +lw $a0, 16($t0) +bnez $a0, label_28 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 312($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 316($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 320($sp) +#GetAttr left_75 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 304($sp) +#GetAttr right_76 = Int.value +lw $t0, 312($sp) +lw $t1, 16($t0) +sw $t1, 308($sp) +#BinaryOperator left_75 = right_76 +lw $a0, 304($sp) +lw $t1, 308($sp) +seq $a0, $a0, $t1 +sw $a0, 300($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 296($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 324($sp) +# IFGoto result_73 -> label_29 +lw $t0, 296($sp) +lw $a0, 16($t0) +bnez $a0, label_29 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 348($sp) +#LoadInt 9 +li $t0, 9 +sw $t0, 352($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 356($sp) +#GetAttr left_84 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 340($sp) +#GetAttr right_85 = Int.value +lw $t0, 348($sp) +lw $t1, 16($t0) +sw $t1, 344($sp) +#BinaryOperator left_84 = right_85 +lw $a0, 340($sp) +lw $t1, 344($sp) +seq $a0, $a0, $t1 +sw $a0, 336($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 360($sp) +# IFGoto result_82 -> label_30 +lw $t0, 332($sp) +lw $a0, 16($t0) +bnez $a0, label_30 +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 500($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 364($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 368($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 372($sp) +#CallNode String_init +move $t0, $sp +# Arg l_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 376($sp) +#AssignNode result_81 = instance_92 +lw $t1, 372($sp) +sw $t1, 328($sp) +#Goto label_31 +b label_31 +#LabelNode label_30 +label_30: +#LoadStr msg_12 +la $t0, msg_12 +sw $t0, 380($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 384($sp) +#CallNode String_init +move $t0, $sp +# Arg l_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_95 +lw $t1, 384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 388($sp) +#AssignNode result_81 = instance_95 +lw $t1, 384($sp) +sw $t1, 328($sp) +#LabelNode label_31 +label_31: +#AssignNode result_72 = result_81 +lw $t1, 328($sp) +sw $t1, 292($sp) +#Goto label_32 +b label_32 +#LabelNode label_29 +label_29: +#LoadStr msg_11 +la $t0, msg_11 +sw $t0, 392($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 396($sp) +#CallNode String_init +move $t0, $sp +# Arg l_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_98 +lw $t1, 396($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 400($sp) +#AssignNode result_72 = instance_98 +lw $t1, 396($sp) +sw $t1, 292($sp) +#LabelNode label_32 +label_32: +#AssignNode result_63 = result_72 +lw $t1, 292($sp) +sw $t1, 256($sp) +#Goto label_33 +b label_33 +#LabelNode label_28 +label_28: +#LoadStr msg_10 +la $t0, msg_10 +sw $t0, 404($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 408($sp) +#CallNode String_init +move $t0, $sp +# Arg l_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 412($sp) +#AssignNode result_63 = instance_101 +lw $t1, 408($sp) +sw $t1, 256($sp) +#LabelNode label_33 +label_33: +#AssignNode result_54 = result_63 +lw $t1, 256($sp) +sw $t1, 220($sp) +#Goto label_34 +b label_34 +#LabelNode label_27 +label_27: +#LoadStr msg_9 +la $t0, msg_9 +sw $t0, 416($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 420($sp) +#CallNode String_init +move $t0, $sp +# Arg l_103 +lw $t1, 416($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 424($sp) +#AssignNode result_54 = instance_104 +lw $t1, 420($sp) +sw $t1, 220($sp) +#LabelNode label_34 +label_34: +#AssignNode result_45 = result_54 +lw $t1, 220($sp) +sw $t1, 184($sp) +#Goto label_35 +b label_35 +#LabelNode label_26 +label_26: +#LoadStr msg_8 +la $t0, msg_8 +sw $t0, 428($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 432($sp) +#CallNode String_init +move $t0, $sp +# Arg l_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_107 +lw $t1, 432($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 436($sp) +#AssignNode result_45 = instance_107 +lw $t1, 432($sp) +sw $t1, 184($sp) +#LabelNode label_35 +label_35: +#AssignNode result_36 = result_45 +lw $t1, 184($sp) +sw $t1, 148($sp) +#Goto label_36 +b label_36 +#LabelNode label_25 +label_25: +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 440($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 444($sp) +#CallNode String_init +move $t0, $sp +# Arg l_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 448($sp) +#AssignNode result_36 = instance_110 +lw $t1, 444($sp) +sw $t1, 148($sp) +#LabelNode label_36 +label_36: +#AssignNode result_27 = result_36 +lw $t1, 148($sp) +sw $t1, 112($sp) +#Goto label_37 +b label_37 +#LabelNode label_24 +label_24: +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 452($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 456($sp) +#CallNode String_init +move $t0, $sp +# Arg l_112 +lw $t1, 452($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 460($sp) +#AssignNode result_27 = instance_113 +lw $t1, 456($sp) +sw $t1, 112($sp) +#LabelNode label_37 +label_37: +#AssignNode result_18 = result_27 +lw $t1, 112($sp) +sw $t1, 76($sp) +#Goto label_38 +b label_38 +#LabelNode label_23 +label_23: +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 464($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 468($sp) +#CallNode String_init +move $t0, $sp +# Arg l_115 +lw $t1, 464($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_116 +lw $t1, 468($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 472($sp) +#AssignNode result_18 = instance_116 +lw $t1, 468($sp) +sw $t1, 76($sp) +#LabelNode label_38 +label_38: +#AssignNode result_9 = result_18 +lw $t1, 76($sp) +sw $t1, 40($sp) +#Goto label_39 +b label_39 +#LabelNode label_22 +label_22: +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 476($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 480($sp) +#CallNode String_init +move $t0, $sp +# Arg l_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 484($sp) +#AssignNode result_9 = instance_119 +lw $t1, 480($sp) +sw $t1, 40($sp) +#LabelNode label_39 +label_39: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_40 +b label_40 +#LabelNode label_21 +label_21: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 488($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 492($sp) +#CallNode String_init +move $t0, $sp +# Arg l_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 496($sp) +#AssignNode result_0 = instance_122 +lw $t1, 492($sp) +sw $t1, 4($sp) +#LabelNode label_40 +label_40: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 508 +jr $ra +A2I.a2i: +addi $sp, $sp, -312 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_1 -> label_41 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_41 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 88($sp) +#VCall substr +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 64($sp) +#LoadStr msg_13 +la $t0, msg_13 +sw $t0, 92($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#CallNode String_init +move $t0, $sp +# Arg l_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 100($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 104($sp) +# IFGoto result_11 -> label_42 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_42 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 136($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 148($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 152($sp) +#VCall substr +move $t0, $sp +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 128($sp) +#LoadStr msg_14 +la $t0, msg_14 +sw $t0, 156($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#CallNode String_init +move $t0, $sp +# Arg l_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 164($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 116($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 168($sp) +# IFGoto result_27 -> label_43 +lw $t0, 112($sp) +lw $a0, 16($t0) +bnez $a0, label_43 +#VCall a2i_aux +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 172($sp) +#AssignNode result_26 = result_42 +lw $t1, 172($sp) +sw $t1, 108($sp) +#Goto label_44 +b label_44 +#LabelNode label_43 +label_43: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 200($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 204($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 208($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 212($sp) +#GetAttr left_47 = Int.value +lw $t0, 200($sp) +lw $t1, 16($t0) +sw $t1, 192($sp) +#GetAttr right_48 = Int.value +lw $t0, 204($sp) +lw $t1, 16($t0) +sw $t1, 196($sp) +#BinaryOperator left_47 - right_48 +lw $a0, 192($sp) +lw $t1, 196($sp) +sub $a0, $a0, $t1 +sw $a0, 188($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 184($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 216($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 220($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 224($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 228($sp) +#VCall substr +move $t0, $sp +# Arg result_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 180($sp) +#VCall a2i_aux +move $t0, $sp +# Arg result_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 176($sp) +#AssignNode result_26 = result_43 +lw $t1, 176($sp) +sw $t1, 108($sp) +#LabelNode label_44 +label_44: +#AssignNode result_10 = result_26 +lw $t1, 108($sp) +sw $t1, 44($sp) +#Goto label_45 +b label_45 +#LabelNode label_42 +label_42: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 268($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 272($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 276($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_67 +lw $t1, 272($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 280($sp) +#GetAttr left_64 = Int.value +lw $t0, 268($sp) +lw $t1, 16($t0) +sw $t1, 260($sp) +#GetAttr right_65 = Int.value +lw $t0, 272($sp) +lw $t1, 16($t0) +sw $t1, 264($sp) +#BinaryOperator left_64 - right_65 +lw $a0, 260($sp) +lw $t1, 264($sp) +sub $a0, $a0, $t1 +sw $a0, 256($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 284($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 288($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 292($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_72 +lw $t1, 292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 296($sp) +#VCall substr +move $t0, $sp +# Arg result_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 248($sp) +#VCall a2i_aux +move $t0, $sp +# Arg result_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 244($sp) +#GetAttr l_59 = Int.value +lw $t0, 244($sp) +lw $t1, 16($t0) +sw $t1, 240($sp) +#UnaryOperator ~ l_59 +lw $t1, 240($sp) +neg $a0, $t1 +sw $a0, 236($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 232($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 300($sp) +#AssignNode result_10 = result_57 +lw $t1, 232($sp) +sw $t1, 44($sp) +#LabelNode label_45 +label_45: +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#Goto label_46 +b label_46 +#LabelNode label_41 +label_41: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 304($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 308($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_76 +lw $t1, 308($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_75 +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 312($sp) +#AssignNode result_0 = instance_75 +lw $t1, 304($sp) +sw $t1, 4($sp) +#LabelNode label_46 +label_46: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 324 +jr $ra +A2I.a2i_aux: +addi $sp, $sp, -188 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode int_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 196($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#AssignNode j_5 = result_4 +lw $t1, 20($sp) +sw $t1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#AssignNode i_9 = instance_6 +lw $t1, 28($sp) +sw $t1, 40($sp) +#LabelNode label_47 +label_47: +#GetAttr left_13 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 < right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +slt $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 64($sp) +# IFGoto result_11 -> label_48 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_48 +#Goto label_49 +b label_49 +#LabelNode label_48 +label_48: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#GetAttr left_22 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 * right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +mul $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 128($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#VCall substr +move $t0, $sp +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 196($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 120($sp) +#VCall c2i +move $t0, $sp +# Arg result_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 192($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 116($sp) +#GetAttr left_18 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 + right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +add $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#AssignNode int_3 = result_16 +lw $t1, 68($sp) +sw $t1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 164($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 168($sp) +#GetAttr left_37 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 152($sp) +#GetAttr right_38 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 156($sp) +#BinaryOperator left_37 + right_38 +lw $a0, 152($sp) +lw $t1, 156($sp) +add $a0, $a0, $t1 +sw $a0, 148($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 172($sp) +#AssignNode i_9 = result_35 +lw $t1, 144($sp) +sw $t1, 40($sp) +#Goto label_47 +b label_47 +#LabelNode label_49 +label_49: +#AssignNode result_44 = result_10 +lw $t1, 44($sp) +sw $t1, 180($sp) +#AssignNode result_45 = result_44 +lw $t1, 180($sp) +sw $t1, 184($sp) +#AssignNode result_46 = int_3 +lw $t1, 16($sp) +sw $t1, 188($sp) +#Return result_46 +lw $a1, 188($sp) +lw $ra, 0($sp) +addi $sp, $sp, 200 +jr $ra +A2I.i2a: +addi $sp, $sp, -156 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_50 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_50 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 64($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 68($sp) +#GetAttr left_12 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 < right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +slt $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_10 -> label_51 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_51 +#LoadStr msg_13 +la $t0, msg_13 +sw $t0, 80($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode String_init +move $t0, $sp +# Arg l_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 128($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#GetAttr l_29 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 120($sp) +#UnaryOperator ~ l_29 +lw $t1, 120($sp) +neg $a0, $t1 +sw $a0, 116($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#GetAttr left_25 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 104($sp) +#GetAttr right_26 = Int.value +lw $t0, 112($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#BinaryOperator left_25 * right_26 +lw $a0, 104($sp) +lw $t1, 108($sp) +mul $a0, $a0, $t1 +sw $a0, 100($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#VCall i2a_aux +move $t0, $sp +# Arg result_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 160($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 92($sp) +#VCall concat +move $t0, $sp +# Arg result_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 84($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 76($sp) +#AssignNode result_9 = result_18 +lw $t1, 76($sp) +sw $t1, 40($sp) +#Goto label_52 +b label_52 +#LabelNode label_51 +label_51: +#VCall i2a_aux +move $t0, $sp +# Arg i +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 160($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 144($sp) +#AssignNode result_9 = result_35 +lw $t1, 144($sp) +sw $t1, 40($sp) +#LabelNode label_52 +label_52: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_53 +b label_53 +#LabelNode label_50 +label_50: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 148($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode String_init +move $t0, $sp +# Arg l_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 156($sp) +#AssignNode result_0 = instance_37 +lw $t1, 152($sp) +sw $t1, 4($sp) +#LabelNode label_53 +label_53: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 168 +jr $ra +A2I.i2a_aux: +addi $sp, $sp, -152 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_54 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_54 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 56($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 60($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 64($sp) +#GetAttr left_11 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#GetAttr right_12 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#BinaryOperator left_11 / right_12 +lw $a0, 48($sp) +lw $t1, 52($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 68($sp) +#AssignNode next_17 = result_9 +lw $t1, 40($sp) +sw $t1, 72($sp) +#VCall i2a_aux +move $t0, $sp +# Arg next_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 156($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 124($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 128($sp) +#GetAttr left_27 = Int.value +lw $t0, 72($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#GetAttr right_28 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#BinaryOperator left_27 * right_28 +lw $a0, 112($sp) +lw $t1, 116($sp) +mul $a0, $a0, $t1 +sw $a0, 108($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#GetAttr left_23 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#GetAttr right_24 = Int.value +lw $t0, 104($sp) +lw $t1, 16($t0) +sw $t1, 100($sp) +#BinaryOperator left_23 - right_24 +lw $a0, 96($sp) +lw $t1, 100($sp) +sub $a0, $a0, $t1 +sw $a0, 92($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#VCall i2c +move $t0, $sp +# Arg result_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 156($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 84($sp) +#VCall concat +move $t0, $sp +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 80($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 76($sp) +#AssignNode result_34 = result_18 +lw $t1, 76($sp) +sw $t1, 140($sp) +#AssignNode result_0 = result_34 +lw $t1, 140($sp) +sw $t1, 4($sp) +#Goto label_55 +b label_55 +#LabelNode label_54 +label_54: +#LoadStr empty_str +la $t0, empty_str +sw $t0, 144($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 148($sp) +#CallNode String_init +move $t0, $sp +# Arg l_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 152($sp) +#AssignNode result_0 = instance_36 +lw $t1, 148($sp) +sw $t1, 4($sp) +#LabelNode label_55 +label_55: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 164 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -100 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag A2I:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A2I_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, A2I_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode A2I_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A2I_init +sw $a1, 12($sp) +#LoadStr msg_15 +la $t0, msg_15 +sw $t0, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg l_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#VCall a2i +move $t0, $sp +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 4($sp) +#AssignNode a_6 = result_0 +lw $t1, 4($sp) +sw $t1, 28($sp) +#Allocate 5:tag A2I:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A2I_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, A2I_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode A2I_init +move $t0, $sp +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A2I_init +sw $a1, 40($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#LoadInt 678987 +li $t0, 678987 +sw $t0, 48($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 52($sp) +#VCall i2a +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 36($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 32($sp) +#AssignNode b_13 = result_7 +lw $t1, 32($sp) +sw $t1, 56($sp) +#VCall out_int +move $t0, $sp +# Arg a_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 60($sp) +#LoadStr msg_16 +la $t0, msg_16 +sw $t0, 68($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#CallNode String_init +move $t0, $sp +# Arg l_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 76($sp) +#VCall out_string +move $t0, $sp +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg b_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 80($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 88($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#CallNode String_init +move $t0, $sp +# Arg l_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 96($sp) +#VCall out_string +move $t0, $sp +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 84($sp) +#AssignNode result_24 = result_20 +lw $t1, 84($sp) +sw $t1, 100($sp) +#Return result_24 +lw $a1, 100($sp) +lw $ra, 0($sp) +addi $sp, $sp, 108 +jr $ra \ No newline at end of file diff --git a/tests/codegen/atoi_input.txt b/tests/codegen/atoi_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/atoi_output.txt b/tests/codegen/atoi_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/book_list.mips b/tests/codegen/book_list.mips new file mode 100644 index 000000000..45936031c --- /dev/null +++ b/tests/codegen/book_list.mips @@ -0,0 +1,2310 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Book_name: .asciiz "Book" +Book_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Book.initBook +.word Book.print +Article_name: .asciiz "Article" +Article_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Book.initBook +.word Article.print +.word Article.initArticle +BookList_name: .asciiz "BookList" +BookList_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word BookList.isNil +.word BookList.cons +.word BookList.car +.word BookList.cdr +.word BookList.print_list +Cons_name: .asciiz "Cons" +Cons_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Cons.isNil +.word BookList.cons +.word Cons.car +.word Cons.cdr +.word Cons.print_list +.word Cons.init +Nil_name: .asciiz "Nil" +Nil_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Nil.isNil +.word BookList.cons +.word BookList.car +.word BookList.cdr +.word Nil.print_list +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "title: " +msg_4: .asciiz "author: " +msg_5: .asciiz "periodical: " +msg_6: .asciiz "- dynamic type was Article - +" +msg_7: .asciiz "- dynamic type was Book - +" +msg_8: .asciiz "Aho, Sethi, and Ullman" +msg_9: .asciiz "Compilers, Principles, Techniques, and Tools" +msg_10: .asciiz "PC Magazine" +msg_11: .asciiz "Ulanoff" +msg_12: .asciiz "The Top 100 CD_ROMs" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag Main:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Book_init: +addi $sp, $sp, -28 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#SetAttr Booktitle = instance_1 +lw $t0, 32($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 24($sp) +#CallNode String_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 28($sp) +#SetAttr Bookauthor = instance_4 +lw $t0, 32($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Book.initBook: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Booktitle = title_p +lw $t0, 12($sp) +lw $t1, 16($sp) +sw $t1, 16($t0) +#SetAttr Bookauthor = author_p +lw $t0, 12($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Book.print: +addi $sp, $sp, -80 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg l_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#VCall out_string +move $t0, $sp +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 84($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 12($sp) +#GetAttr Book.title = Book.title +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#VCall out_string +move $t0, $sp +# Arg Book.title +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 8($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 32($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode String_init +move $t0, $sp +# Arg l_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 40($sp) +#VCall out_string +move $t0, $sp +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 84($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#GetAttr Book.author = Book.author +lw $t0, 84($sp) +lw $t1, 20($t0) +sw $t1, 68($sp) +#VCall out_string +move $t0, $sp +# Arg Book.author +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 52($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 48($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 72($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode String_init +move $t0, $sp +# Arg l_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 80($sp) +#VCall out_string +move $t0, $sp +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 44($sp) +#Return self +lw $a1, 84($sp) +lw $ra, 0($sp) +addi $sp, $sp, 88 +jr $ra +Article_init: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Book_init +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Book_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#SetAttr Articleper_title = instance_1 +lw $t0, 20($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Article.initArticle: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall initBook +move $t0, $sp +# Arg author_p +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg title_p +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 4($sp) +#SetAttr Articleper_title = per_title_p +lw $t0, 12($sp) +lw $t1, 24($sp) +sw $t1, 24($t0) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 28 +jr $ra +Article.print: +addi $sp, $sp, -48 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Book:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Book_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Book_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#VCall print +move $t0, $sp +# Arg self +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 4($sp) +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#VCall out_string +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 52($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#GetAttr Article.per_title = Article.per_title +lw $t0, 52($sp) +lw $t1, 24($t0) +sw $t1, 36($sp) +#VCall out_string +move $t0, $sp +# Arg Article.per_title +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 16($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 40($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode String_init +move $t0, $sp +# Arg l_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 48($sp) +#VCall out_string +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 12($sp) +#Return self +lw $a1, 52($sp) +lw $ra, 0($sp) +addi $sp, $sp, 56 +jr $ra +BookList_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +BookList.isNil: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 12($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 16($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +BookList.cons: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 8($sp) +#AssignNode new_cell_2 = result_0 +lw $t1, 4($sp) +sw $t1, 12($sp) +#VCall init +move $t0, $sp +# Arg self +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg hd +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg new_cell_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 16($sp) +#AssignNode result_4 = result_3 +lw $t1, 16($sp) +sw $t1, 20($sp) +#Return result_4 +lw $a1, 20($sp) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +BookList.car: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 2:tag Book:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Book_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Book_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Book_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Book_init +sw $a1, 12($sp) +#Return result_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +BookList.cdr: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 3:tag BookList:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, BookList_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, BookList_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode BookList_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal BookList_init +sw $a1, 12($sp) +#Return result_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +BookList.print_list: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode BookList_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal BookList_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr Consxcar = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 16($t0) +#SetAttr Consxcdr = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Cons.init: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Consxcar = hd +lw $t0, 12($sp) +lw $t1, 16($sp) +sw $t1, 16($t0) +#SetAttr Consxcdr = tl +lw $t0, 12($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Cons.car: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return Cons.xcar +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons.cdr: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 8($sp) +lw $t1, 20($t0) +sw $t1, 4($sp) +#Return Cons.xcdr +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons.print_list: +addi $sp, $sp, -60 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#VCall print +move $t0, $sp +# Arg Cons.xcar +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 8($sp) +#Case result_1 +lw $t0, 8($sp) +lw $t1, 0($t0) +la $a0, void +bne $t1, $a0, label_1 +b case_void_error +#LabelNode label_1 +label_1: +#Action +blt $t1, 3, label_3 +bgt $t1, 3, label_3 +#AssignNode dummy_3 = result_1 +lw $t1, 8($sp) +sw $t1, 16($sp) +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#VCall out_string +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 64($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#AssignNode result_0 = result_4 +lw $t1, 20($sp) +sw $t1, 4($sp) +#Goto label_2 +b label_2 +#LabelNode label_3 +label_3: +#Action +blt $t1, 2, label_4 +bgt $t1, 3, label_4 +#AssignNode dummy_8 = result_1 +lw $t1, 8($sp) +sw $t1, 36($sp) +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 44($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode String_init +move $t0, $sp +# Arg l_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 52($sp) +#VCall out_string +move $t0, $sp +# Arg instance_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 64($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 40($sp) +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_2 +b label_2 +#LabelNode label_4 +label_4: +#Goto case_no_match_error +b case_no_match_error +#LabelNode label_2 +label_2: +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 64($sp) +lw $t1, 20($t0) +sw $t1, 60($sp) +#VCall print_list +move $t0, $sp +# Arg Cons.xcdr +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 56($sp) +#Return result_13 +lw $a1, 56($sp) +lw $ra, 0($sp) +addi $sp, $sp, 68 +jr $ra +Nil_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode BookList_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal BookList_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Nil.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Nil.print_list: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr Mainbooks = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -128 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Book:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Book_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Book_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Book_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Book_init +sw $a1, 12($sp) +#LoadStr msg_8 +la $t0, msg_8 +sw $t0, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg l_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#LoadStr msg_9 +la $t0, msg_9 +sw $t0, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg l_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#VCall initBook +move $t0, $sp +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 4($sp) +#AssignNode a_book_9 = result_0 +lw $t1, 4($sp) +sw $t1, 40($sp) +#Allocate 3:tag Article:Class_name 7:Class_size +li $a0, 28 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Article_name +sw $t1, 4($t0) +li $t1, 7 +sw $t1, 8($t0) +la $t1, Article_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Article_init +move $t0, $sp +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Article_init +sw $a1, 52($sp) +#LoadStr msg_10 +la $t0, msg_10 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#LoadStr msg_11 +la $t0, msg_11 +sw $t0, 68($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#CallNode String_init +move $t0, $sp +# Arg l_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 76($sp) +#LoadStr msg_12 +la $t0, msg_12 +sw $t0, 80($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode String_init +move $t0, $sp +# Arg l_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 88($sp) +#VCall initArticle +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 44($sp) +#AssignNode an_article_22 = result_10 +lw $t1, 44($sp) +sw $t1, 92($sp) +#Allocate 5:tag Nil:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Nil_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Nil_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode Nil_init +move $t0, $sp +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Nil_init +sw $a1, 108($sp) +#VCall cons +move $t0, $sp +# Arg a_book_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 100($sp) +#VCall cons +move $t0, $sp +# Arg an_article_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 96($sp) +#SetAttr Mainbooks = result_23 +lw $t0, 132($sp) +lw $t1, 96($sp) +sw $t1, 16($t0) +#GetAttr Main.books = Main.books +lw $t0, 132($sp) +lw $t1, 16($t0) +sw $t1, 120($sp) +#VCall print_list +move $t0, $sp +# Arg Main.books +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 120($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 116($sp) +#AssignNode result_30 = result_28 +lw $t1, 116($sp) +sw $t1, 124($sp) +#AssignNode result_31 = result_30 +lw $t1, 124($sp) +sw $t1, 128($sp) +#Return result_31 +lw $a1, 128($sp) +lw $ra, 0($sp) +addi $sp, $sp, 136 +jr $ra \ No newline at end of file diff --git a/tests/codegen/book_list_input.txt b/tests/codegen/book_list_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/book_list_output.txt b/tests/codegen/book_list_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/cells.mips b/tests/codegen/cells.mips new file mode 100644 index 000000000..baf7da318 --- /dev/null +++ b/tests/codegen/cells.mips @@ -0,0 +1,2827 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +CellularAutomaton_name: .asciiz "CellularAutomaton" +CellularAutomaton_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word CellularAutomaton.init +.word CellularAutomaton.print +.word CellularAutomaton.num_cells +.word CellularAutomaton.cell +.word CellularAutomaton.cell_left_neighbor +.word CellularAutomaton.cell_right_neighbor +.word CellularAutomaton.cell_at_next_evolution +.word CellularAutomaton.evolve +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "X" +msg_4: .asciiz "." +msg_5: .asciiz " X " +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag Main:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +CellularAutomaton_init: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#SetAttr CellularAutomatonpopulation_map = instance_1 +lw $t0, 20($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +CellularAutomaton.init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr CellularAutomatonpopulation_map = map +lw $t0, 8($sp) +lw $t1, 12($sp) +sw $t1, 16($t0) +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +CellularAutomaton.print: +addi $sp, $sp, -24 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.population_map = CellularAutomaton.population_map +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg l_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#VCall concat +move $t0, $sp +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg CellularAutomaton.population_map +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 8($sp) +#VCall out_string +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 28($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return self +lw $a1, 28($sp) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +CellularAutomaton.num_cells: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.population_map = CellularAutomaton.population_map +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#VCall length +move $t0, $sp +# Arg CellularAutomaton.population_map +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +CellularAutomaton.cell: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.population_map = CellularAutomaton.population_map +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 16($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 20($sp) +#VCall substr +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg position +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg CellularAutomaton.population_map +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +CellularAutomaton.cell_left_neighbor: +addi $sp, $sp, -112 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_1 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 64($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 68($sp) +#GetAttr left_12 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 - right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +sub $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 72($sp) +#VCall cell +move $t0, $sp +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 40($sp) +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_2 +b label_2 +#LabelNode label_1 +label_1: +#VCall num_cells +move $t0, $sp +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 96($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#GetAttr left_21 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#GetAttr right_22 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#BinaryOperator left_21 - right_22 +lw $a0, 88($sp) +lw $t1, 92($sp) +sub $a0, $a0, $t1 +sw $a0, 84($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#VCall cell +move $t0, $sp +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 76($sp) +#AssignNode result_0 = result_18 +lw $t1, 76($sp) +sw $t1, 4($sp) +#LabelNode label_2 +label_2: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 124 +jr $ra +CellularAutomaton.cell_right_neighbor: +addi $sp, $sp, -112 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall num_cells +move $t0, $sp +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 40($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 48($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 52($sp) +#GetAttr left_7 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#GetAttr right_8 = Int.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#BinaryOperator left_7 - right_8 +lw $a0, 32($sp) +lw $t1, 36($sp) +sub $a0, $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 56($sp) +#GetAttr left_3 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 60($sp) +# IFGoto result_1 -> label_3 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_3 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 88($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 92($sp) +#GetAttr left_18 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 + right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +add $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 96($sp) +#VCall cell +move $t0, $sp +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 64($sp) +#AssignNode result_0 = result_15 +lw $t1, 64($sp) +sw $t1, 4($sp) +#Goto label_4 +b label_4 +#LabelNode label_3 +label_3: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 108($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#VCall cell +move $t0, $sp +# Arg instance_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 100($sp) +#AssignNode result_0 = result_24 +lw $t1, 100($sp) +sw $t1, 4($sp) +#LabelNode label_4 +label_4: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 124 +jr $ra +CellularAutomaton.cell_at_next_evolution: +addi $sp, $sp, -292 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall cell +move $t0, $sp +# Arg position +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 296($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 76($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 80($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode String_init +move $t0, $sp +# Arg l_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 88($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 64($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 92($sp) +# IFGoto result_14 -> label_5 +lw $t0, 60($sp) +lw $a0, 16($t0) +bnez $a0, label_5 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#AssignNode result_13 = instance_23 +lw $t1, 96($sp) +sw $t1, 56($sp) +#Goto label_6 +b label_6 +#LabelNode label_5 +label_5: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 108($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 112($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 116($sp) +#AssignNode result_13 = instance_26 +lw $t1, 108($sp) +sw $t1, 56($sp) +#LabelNode label_6 +label_6: +#VCall cell_left_neighbor +move $t0, $sp +# Arg position +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 296($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 140($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 144($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 148($sp) +#CallNode String_init +move $t0, $sp +# Arg l_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 152($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 128($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 156($sp) +# IFGoto result_30 -> label_7 +lw $t0, 124($sp) +lw $a0, 16($t0) +bnez $a0, label_7 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 164($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 168($sp) +#AssignNode result_29 = instance_39 +lw $t1, 160($sp) +sw $t1, 120($sp) +#Goto label_8 +b label_8 +#LabelNode label_7 +label_7: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 176($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 180($sp) +#AssignNode result_29 = instance_42 +lw $t1, 172($sp) +sw $t1, 120($sp) +#LabelNode label_8 +label_8: +#GetAttr left_11 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#GetAttr right_12 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#BinaryOperator left_11 + right_12 +lw $a0, 48($sp) +lw $t1, 52($sp) +add $a0, $a0, $t1 +sw $a0, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 184($sp) +#VCall cell_right_neighbor +move $t0, $sp +# Arg position +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 296($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 208($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 212($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 216($sp) +#CallNode String_init +move $t0, $sp +# Arg l_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 220($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 196($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 192($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 224($sp) +# IFGoto result_47 -> label_9 +lw $t0, 192($sp) +lw $a0, 16($t0) +bnez $a0, label_9 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 228($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 232($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 236($sp) +#AssignNode result_46 = instance_56 +lw $t1, 228($sp) +sw $t1, 188($sp) +#Goto label_10 +b label_10 +#LabelNode label_9 +label_9: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 240($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 244($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 248($sp) +#AssignNode result_46 = instance_59 +lw $t1, 240($sp) +sw $t1, 188($sp) +#LabelNode label_10 +label_10: +#GetAttr left_7 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#GetAttr right_8 = Int.value +lw $t0, 188($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#BinaryOperator left_7 + right_8 +lw $a0, 32($sp) +lw $t1, 36($sp) +add $a0, $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 252($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 256($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 260($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 264($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 256($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 268($sp) +# IFGoto result_1 -> label_11 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_11 +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 272($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 276($sp) +#CallNode String_init +move $t0, $sp +# Arg l_67 +lw $t1, 272($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 280($sp) +#AssignNode result_0 = instance_68 +lw $t1, 276($sp) +sw $t1, 4($sp) +#Goto label_12 +b label_12 +#LabelNode label_11 +label_11: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 284($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 288($sp) +#CallNode String_init +move $t0, $sp +# Arg l_70 +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 292($sp) +#AssignNode result_0 = instance_71 +lw $t1, 288($sp) +sw $t1, 4($sp) +#LabelNode label_12 +label_12: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 304 +jr $ra +CellularAutomaton.evolve: +addi $sp, $sp, -128 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode position_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#VCall num_cells +move $t0, $sp +# Arg self +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 20($sp) +#AssignNode num_5 = result_4 +lw $t1, 20($sp) +sw $t1, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#AssignNode temp_9 = instance_6 +lw $t1, 28($sp) +sw $t1, 40($sp) +#LabelNode label_13 +label_13: +#GetAttr left_13 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 < right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +slt $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 64($sp) +# IFGoto result_11 -> label_14 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_14 +#Goto label_15 +b label_15 +#LabelNode label_14 +label_14: +#VCall cell_at_next_evolution +move $t0, $sp +# Arg position_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 72($sp) +#VCall concat +move $t0, $sp +# Arg result_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg temp_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 68($sp) +#AssignNode temp_9 = result_16 +lw $t1, 68($sp) +sw $t1, 40($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#GetAttr left_21 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#GetAttr right_22 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#BinaryOperator left_21 + right_22 +lw $a0, 88($sp) +lw $t1, 92($sp) +add $a0, $a0, $t1 +sw $a0, 84($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#AssignNode position_3 = result_19 +lw $t1, 80($sp) +sw $t1, 16($sp) +#Goto label_13 +b label_13 +#LabelNode label_15 +label_15: +#SetAttr CellularAutomatonpopulation_map = temp_9 +lw $t0, 132($sp) +lw $t1, 40($sp) +sw $t1, 16($t0) +#AssignNode result_29 = self +lw $t1, 132($sp) +sw $t1, 120($sp) +#AssignNode result_30 = result_29 +lw $t1, 120($sp) +sw $t1, 124($sp) +#AssignNode result_31 = result_30 +lw $t1, 124($sp) +sw $t1, 128($sp) +#Return result_31 +lw $a1, 128($sp) +lw $ra, 0($sp) +addi $sp, $sp, 136 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr Maincells = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -144 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag CellularAutomaton:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, CellularAutomaton_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, CellularAutomaton_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode CellularAutomaton_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal CellularAutomaton_init +sw $a1, 12($sp) +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg l_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#VCall init +move $t0, $sp +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 4($sp) +#SetAttr Maincells = result_0 +lw $t0, 148($sp) +lw $t1, 4($sp) +sw $t1, 16($t0) +#GetAttr Main.cells = Main.cells +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 104($sp) +#VCall print +move $t0, $sp +# Arg Main.cells +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 32($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#LoadInt 20 +li $t0, 20 +sw $t0, 44($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 48($sp) +#AssignNode countdown_12 = instance_9 +lw $t1, 40($sp) +sw $t1, 52($sp) +#LabelNode label_16 +label_16: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 80($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 84($sp) +#GetAttr left_16 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#GetAttr right_17 = Int.value +lw $t0, 52($sp) +lw $t1, 16($t0) +sw $t1, 72($sp) +#BinaryOperator left_16 < right_17 +lw $a0, 68($sp) +lw $t1, 72($sp) +slt $a0, $a0, $t1 +sw $a0, 64($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 88($sp) +# IFGoto result_14 -> label_17 +lw $t0, 60($sp) +lw $a0, 16($t0) +bnez $a0, label_17 +#Goto label_18 +b label_18 +#LabelNode label_17 +label_17: +#GetAttr Main.cells = Main.cells +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 104($sp) +#VCall evolve +move $t0, $sp +# Arg Main.cells +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 92($sp) +#GetAttr Main.cells = Main.cells +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 104($sp) +#VCall print +move $t0, $sp +# Arg Main.cells +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 100($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 128($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#GetAttr left_28 = Int.value +lw $t0, 52($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#GetAttr right_29 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 120($sp) +#BinaryOperator left_28 - right_29 +lw $a0, 116($sp) +lw $t1, 120($sp) +sub $a0, $a0, $t1 +sw $a0, 112($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 108($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#AssignNode countdown_12 = result_26 +lw $t1, 108($sp) +sw $t1, 52($sp) +#Goto label_16 +b label_16 +#LabelNode label_18 +label_18: +#AssignNode result_35 = result_13 +lw $t1, 56($sp) +sw $t1, 144($sp) +#Return self +lw $a1, 148($sp) +lw $ra, 0($sp) +addi $sp, $sp, 152 +jr $ra \ No newline at end of file diff --git a/tests/codegen/cells_input.txt b/tests/codegen/cells_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/cells_output.txt b/tests/codegen/cells_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/complex.mips b/tests/codegen/complex.mips new file mode 100644 index 000000000..97f3eaf0d --- /dev/null +++ b/tests/codegen/complex.mips @@ -0,0 +1,1819 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +Complex_name: .asciiz "Complex" +Complex_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Complex.init +.word Complex.print +.word Complex.reflect_0 +.word Complex.reflect_X +.word Complex.reflect_Y +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "=( +" +msg_4: .asciiz "=) +" +msg_5: .asciiz "+" +msg_6: .asciiz "I" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -112 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Complex:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Complex_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Complex_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Complex_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Complex_init +sw $a1, 12($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#VCall init +move $t0, $sp +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 4($sp) +#AssignNode c_9 = result_0 +lw $t1, 4($sp) +sw $t1, 40($sp) +#VCall reflect_X +move $t0, $sp +# Arg c_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 68($sp) +#VCall reflect_Y +move $t0, $sp +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 68($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 64($sp) +#VCall reflect_0 +move $t0, $sp +# Arg c_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 72($sp) +#AssignNode left_13 = result_15 +lw $t1, 64($sp) +sw $t1, 56($sp) +#AssignNode right_14 = result_17 +lw $t1, 72($sp) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 76($sp) +# IFGoto result_11 -> label_1 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 84($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode String_init +move $t0, $sp +# Arg l_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 92($sp) +#VCall out_string +move $t0, $sp +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 80($sp) +#AssignNode result_10 = result_19 +lw $t1, 80($sp) +sw $t1, 44($sp) +#Goto label_2 +b label_2 +#LabelNode label_1 +label_1: +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 100($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode String_init +move $t0, $sp +# Arg l_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 108($sp) +#VCall out_string +move $t0, $sp +# Arg instance_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 96($sp) +#AssignNode result_10 = result_23 +lw $t1, 96($sp) +sw $t1, 44($sp) +#LabelNode label_2 +label_2: +#AssignNode result_27 = result_10 +lw $t1, 44($sp) +sw $t1, 112($sp) +#Return result_27 +lw $a1, 112($sp) +lw $ra, 0($sp) +addi $sp, $sp, 120 +jr $ra +Complex_init: +addi $sp, $sp, -28 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Complexx = instance_1 +lw $t0, 32($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 28($sp) +#SetAttr Complexy = instance_4 +lw $t0, 32($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Complex.init: +addi $sp, $sp, -48 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 52($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr left_2 = Int.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 24($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 52($sp) +lw $t1, 20($t0) +sw $t1, 44($sp) +#GetAttr left_8 = Int.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr right_9 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 40($sp) +#BinaryOperator left_8 = right_9 +lw $a0, 36($sp) +lw $t1, 40($sp) +seq $a0, $a0, $t1 +sw $a0, 32($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 48($sp) +#Return self +lw $a1, 52($sp) +lw $ra, 0($sp) +addi $sp, $sp, 64 +jr $ra +Complex.print: +addi $sp, $sp, -96 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 100($sp) +lw $t1, 20($t0) +sw $t1, 76($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_3 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_1 -> label_3 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_3 +#GetAttr Complex.x = Complex.x +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#VCall out_int +move $t0, $sp +# Arg Complex.x +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 56($sp) +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 64($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode String_init +move $t0, $sp +# Arg l_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 72($sp) +#VCall out_string +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 56($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 100($sp) +lw $t1, 20($t0) +sw $t1, 76($sp) +#VCall out_int +move $t0, $sp +# Arg Complex.y +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 52($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 48($sp) +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 80($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode String_init +move $t0, $sp +# Arg l_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 88($sp) +#VCall out_string +move $t0, $sp +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 44($sp) +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#Goto label_4 +b label_4 +#LabelNode label_3 +label_3: +#GetAttr Complex.x = Complex.x +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#VCall out_int +move $t0, $sp +# Arg Complex.x +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 92($sp) +#AssignNode result_0 = result_22 +lw $t1, 92($sp) +sw $t1, 4($sp) +#LabelNode label_4 +label_4: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 104 +jr $ra +Complex.reflect_0: +addi $sp, $sp, -88 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr l_7 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#UnaryOperator ~ l_7 +lw $t1, 32($sp) +neg $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_2 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 92($sp) +lw $t1, 20($t0) +sw $t1, 80($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 92($sp) +lw $t1, 20($t0) +sw $t1, 80($sp) +#GetAttr l_18 = Int.value +lw $t0, 80($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#UnaryOperator ~ l_18 +lw $t1, 76($sp) +neg $a0, $t1 +sw $a0, 72($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 84($sp) +#GetAttr left_13 = Int.value +lw $t0, 80($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 88($sp) +#Return self +lw $a1, 92($sp) +lw $ra, 0($sp) +addi $sp, $sp, 96 +jr $ra +Complex.reflect_X: +addi $sp, $sp, -44 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 48($sp) +lw $t1, 20($t0) +sw $t1, 36($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 48($sp) +lw $t1, 20($t0) +sw $t1, 36($sp) +#GetAttr l_7 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#UnaryOperator ~ l_7 +lw $t1, 32($sp) +neg $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_2 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +#Return self +lw $a1, 48($sp) +lw $ra, 0($sp) +addi $sp, $sp, 52 +jr $ra +Complex.reflect_Y: +addi $sp, $sp, -44 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr l_7 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#UnaryOperator ~ l_7 +lw $t1, 32($sp) +neg $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_2 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +#Return self +lw $a1, 48($sp) +lw $ra, 0($sp) +addi $sp, $sp, 52 +jr $ra \ No newline at end of file diff --git a/tests/codegen/complex_input.txt b/tests/codegen/complex_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/complex_output.txt b/tests/codegen/complex_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/fib.cl b/tests/codegen/fib.cl old mode 100644 new mode 100755 diff --git a/tests/codegen/fib.mips b/tests/codegen/fib.mips new file mode 100644 index 000000000..e00721200 --- /dev/null +++ b/tests/codegen/fib.mips @@ -0,0 +1,1201 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +.word Main.fib +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "Enter n to find nth fibonacci number! +" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -44 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#VCall in_int +move $t0, $sp +# Arg self +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 28($sp) +#VCall fib +move $t0, $sp +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 24($sp) +#VCall out_int +move $t0, $sp +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 20($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 36($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode String_init +move $t0, $sp +# Arg l_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 44($sp) +#VCall out_string +move $t0, $sp +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 32($sp) +#Return result_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 52 +jr $ra +Main.fib: +addi $sp, $sp, -172 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode a_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 28($sp) +#AssignNode b_7 = instance_4 +lw $t1, 20($sp) +sw $t1, 32($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 40($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 44($sp) +#AssignNode c_11 = instance_8 +lw $t1, 36($sp) +sw $t1, 48($sp) +#LabelNode label_1 +label_1: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 88($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 92($sp) +#GetAttr left_18 = Int.value +lw $t0, 180($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 = right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +seq $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 96($sp) +#GetAttr l_15 = Bool.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 64($sp) +#UnaryOperator not l_15 +lw $t1, 64($sp) +xor $a0, $t1, 1 +sw $a0, 60($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 56($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 100($sp) +# IFGoto result_13 -> label_2 +lw $t0, 56($sp) +lw $a0, 16($t0) +bnez $a0, label_2 +#Goto label_3 +b label_3 +#LabelNode label_2 +label_2: +#GetAttr left_27 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#GetAttr right_28 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#BinaryOperator left_27 + right_28 +lw $a0, 112($sp) +lw $t1, 116($sp) +add $a0, $a0, $t1 +sw $a0, 108($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 120($sp) +#AssignNode c_11 = result_25 +lw $t1, 104($sp) +sw $t1, 48($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 148($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 152($sp) +#GetAttr left_33 = Int.value +lw $t0, 180($sp) +lw $t1, 16($t0) +sw $t1, 136($sp) +#GetAttr right_34 = Int.value +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 140($sp) +#BinaryOperator left_33 - right_34 +lw $a0, 136($sp) +lw $t1, 140($sp) +sub $a0, $a0, $t1 +sw $a0, 132($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 128($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 156($sp) +#AssignNode i = result_31 +lw $t1, 128($sp) +sw $t1, 180($sp) +#AssignNode b_7 = a_3 +lw $t1, 16($sp) +sw $t1, 32($sp) +#AssignNode a_3 = c_11 +lw $t1, 48($sp) +sw $t1, 16($sp) +#Goto label_1 +b label_1 +#LabelNode label_3 +label_3: +#AssignNode result_42 = c_11 +lw $t1, 48($sp) +sw $t1, 172($sp) +#Return result_42 +lw $a1, 172($sp) +lw $ra, 0($sp) +addi $sp, $sp, 184 +jr $ra \ No newline at end of file diff --git a/tests/codegen/fib_input.txt b/tests/codegen/fib_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/fib_output.txt b/tests/codegen/fib_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/graph.mips b/tests/codegen/graph.mips new file mode 100644 index 000000000..9ae480ff7 --- /dev/null +++ b/tests/codegen/graph.mips @@ -0,0 +1,6582 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Graph_name: .asciiz "Graph" +Graph_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word Graph.add_vertice +.word Graph.print_E +.word Graph.print_V +Vertice_name: .asciiz "Vertice" +Vertice_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Vertice.outgoing +.word Vertice.number +.word Vertice.init +.word Vertice.add_out +.word Vertice.print +Edge_name: .asciiz "Edge" +Edge_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Edge.init +.word Edge.print +EList_name: .asciiz "EList" +EList_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word EList.isNil +.word EList.head +.word EList.tail +.word EList.cons +.word EList.append +.word EList.print +ECons_name: .asciiz "ECons" +ECons_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word ECons.isNil +.word ECons.head +.word ECons.tail +.word EList.cons +.word EList.append +.word ECons.print +.word ECons.init +VList_name: .asciiz "VList" +VList_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word VList.isNil +.word VList.head +.word VList.tail +.word VList.cons +.word VList.print +VCons_name: .asciiz "VCons" +VCons_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word VCons.isNil +.word VCons.head +.word VCons.tail +.word VList.cons +.word VCons.print +.word VCons.init +Parse_name: .asciiz "Parse" +Parse_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Parse.read_input +.word Parse.parse_line +.word Parse.c2i +.word Parse.a2i +.word Parse.a2i_aux +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Parse.read_input +.word Parse.parse_line +.word Parse.c2i +.word Parse.a2i +.word Parse.a2i_aux +.word Main.main +BoolOp_name: .asciiz "BoolOp" +BoolOp_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word BoolOp.and +.word BoolOp.or +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz " (" +msg_4: .asciiz "," +msg_5: .asciiz ")" +msg_6: .asciiz "0" +msg_7: .asciiz "1" +msg_8: .asciiz "2" +msg_9: .asciiz "3" +msg_10: .asciiz "4" +msg_11: .asciiz "5" +msg_12: .asciiz "6" +msg_13: .asciiz "7" +msg_14: .asciiz "8" +msg_15: .asciiz "9" +msg_16: .asciiz "-" +msg_17: .asciiz " " +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 7:tag Main:Class_name 7:Class_size +li $a0, 28 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 7 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 7 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Graph_init: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 5:tag VList:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, VList_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, VList_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode VList_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal VList_init +sw $a1, 12($sp) +#SetAttr Graphvertices = result_1 +lw $t0, 24($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 4:tag EList:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, EList_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, EList_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode EList_init +move $t0, $sp +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal EList_init +sw $a1, 20($sp) +#SetAttr Graphedges = result_3 +lw $t0, 24($sp) +lw $t1, 16($sp) +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 28 +jr $ra +Graph.add_vertice: +addi $sp, $sp, -28 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall outgoing +move $t0, $sp +# Arg v +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 36($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 8($sp) +#GetAttr Graph.edges = Graph.edges +lw $t0, 32($sp) +lw $t1, 20($t0) +sw $t1, 12($sp) +#VCall append +move $t0, $sp +# Arg Graph.edges +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 4($sp) +#SetAttr Graphedges = result_0 +lw $t0, 32($sp) +lw $t1, 4($sp) +sw $t1, 20($t0) +#GetAttr Graph.vertices = Graph.vertices +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#VCall cons +move $t0, $sp +# Arg v +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Graph.vertices +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 24($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 20($sp) +#SetAttr Graphvertices = result_4 +lw $t0, 32($sp) +lw $t1, 20($sp) +sw $t1, 16($t0) +#Return result_4 +lw $a1, 20($sp) +lw $ra, 0($sp) +addi $sp, $sp, 40 +jr $ra +Graph.print_E: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Graph.edges = Graph.edges +lw $t0, 12($sp) +lw $t1, 20($t0) +sw $t1, 8($sp) +#VCall print +move $t0, $sp +# Arg Graph.edges +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +Graph.print_V: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Graph.vertices = Graph.vertices +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#VCall print +move $t0, $sp +# Arg Graph.vertices +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +Vertice_init: +addi $sp, $sp, -24 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Verticenum = instance_1 +lw $t0, 28($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 4:tag EList:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, EList_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, EList_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode EList_init +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal EList_init +sw $a1, 24($sp) +#SetAttr Verticeout = result_4 +lw $t0, 28($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +Vertice.outgoing: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Vertice.out = Vertice.out +lw $t0, 8($sp) +lw $t1, 20($t0) +sw $t1, 4($sp) +#Return Vertice.out +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Vertice.number: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Vertice.num = Vertice.num +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return Vertice.num +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Vertice.init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Verticenum = n +lw $t0, 8($sp) +lw $t1, 12($sp) +sw $t1, 16($t0) +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +Vertice.add_out: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Vertice.out = Vertice.out +lw $t0, 16($sp) +lw $t1, 20($t0) +sw $t1, 8($sp) +#VCall cons +move $t0, $sp +# Arg s +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Vertice.out +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 4($sp) +#SetAttr Verticeout = result_0 +lw $t0, 16($sp) +lw $t1, 4($sp) +sw $t1, 20($t0) +#Return self +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Vertice.print: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Vertice.num = Vertice.num +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#VCall out_int +move $t0, $sp +# Arg Vertice.num +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr Vertice.out = Vertice.out +lw $t0, 20($sp) +lw $t1, 20($t0) +sw $t1, 16($sp) +#VCall print +move $t0, $sp +# Arg Vertice.out +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Edge_init: +addi $sp, $sp, -40 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Edgefrom = instance_1 +lw $t0, 44($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 28($sp) +#SetAttr Edgeto = instance_4 +lw $t0, 44($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#SetAttr Edgeweight = instance_7 +lw $t0, 44($sp) +lw $t1, 32($sp) +sw $t1, 24($t0) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +Edge.init: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Edgefrom = f +lw $t0, 16($sp) +lw $t1, 20($sp) +sw $t1, 16($t0) +#SetAttr Edgeto = t +lw $t0, 16($sp) +lw $t1, 24($sp) +sw $t1, 20($t0) +#SetAttr Edgeweight = w +lw $t0, 16($sp) +lw $t1, 28($sp) +sw $t1, 24($t0) +#Return self +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +Edge.print: +addi $sp, $sp, -72 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 76($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr Edge.from = Edge.from +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#VCall out_int +move $t0, $sp +# Arg Edge.from +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 76($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 20($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 32($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode String_init +move $t0, $sp +# Arg l_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 40($sp) +#VCall out_string +move $t0, $sp +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 76($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 28($sp) +#GetAttr Edge.to = Edge.to +lw $t0, 76($sp) +lw $t1, 20($t0) +sw $t1, 48($sp) +#VCall out_int +move $t0, $sp +# Arg Edge.to +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 76($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 44($sp) +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 76($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#GetAttr Edge.weight = Edge.weight +lw $t0, 76($sp) +lw $t1, 24($t0) +sw $t1, 72($sp) +#VCall out_int +move $t0, $sp +# Arg Edge.weight +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 76($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 68($sp) +#Return result_16 +lw $a1, 68($sp) +lw $ra, 0($sp) +addi $sp, $sp, 80 +jr $ra +EList_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr EListcar = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +EList.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +EList.head: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr EList.car = EList.car +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Return EList.car +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +EList.tail: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +EList.cons: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag ECons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, ECons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, ECons_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode ECons_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal ECons_init +sw $a1, 12($sp) +#VCall init +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg e +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +EList.append: +addi $sp, $sp, -24 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall isNil +move $t0, $sp +# Arg self +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 28($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 8($sp) +# IFGoto result_1 -> label_1 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#VCall tail +move $t0, $sp +# Arg self +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 28($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 20($sp) +#VCall append +move $t0, $sp +# Arg l +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 16($sp) +#VCall head +move $t0, $sp +# Arg self +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 28($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 24($sp) +#VCall cons +move $t0, $sp +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 12($sp) +#AssignNode result_0 = result_2 +lw $t1, 12($sp) +sw $t1, 4($sp) +#Goto label_2 +b label_2 +#LabelNode label_1 +label_1: +#AssignNode result_0 = l +lw $t1, 32($sp) +sw $t1, 4($sp) +#LabelNode label_2 +label_2: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +EList.print: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +ECons_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode EList_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal EList_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr EConscdr = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +ECons.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +ECons.head: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr ECons.car = ECons.car +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return ECons.car +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +ECons.tail: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr ECons.cdr = ECons.cdr +lw $t0, 8($sp) +lw $t1, 20($t0) +sw $t1, 4($sp) +#Return ECons.cdr +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +ECons.init: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr EConscar = e +lw $t0, 12($sp) +lw $t1, 16($sp) +sw $t1, 16($t0) +#SetAttr EConscdr = rest +lw $t0, 12($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +ECons.print: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr ECons.car = ECons.car +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#VCall print +move $t0, $sp +# Arg ECons.car +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr ECons.cdr = ECons.cdr +lw $t0, 20($sp) +lw $t1, 20($t0) +sw $t1, 16($sp) +#VCall print +move $t0, $sp +# Arg ECons.cdr +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +VList_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr VListcar = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +VList.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +VList.head: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr VList.car = VList.car +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Return VList.car +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +VList.tail: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +VList.cons: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 6:tag VCons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, VCons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, VCons_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode VCons_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal VCons_init +sw $a1, 12($sp) +#VCall init +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg v +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +VList.print: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +VCons_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode VList_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal VList_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr VConscdr = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +VCons.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +VCons.head: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr VCons.car = VCons.car +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return VCons.car +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +VCons.tail: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr VCons.cdr = VCons.cdr +lw $t0, 8($sp) +lw $t1, 20($t0) +sw $t1, 4($sp) +#Return VCons.cdr +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +VCons.init: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr VConscar = v +lw $t0, 12($sp) +lw $t1, 16($sp) +sw $t1, 16($t0) +#SetAttr VConscdr = rest +lw $t0, 12($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +VCons.print: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr VCons.car = VCons.car +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#VCall print +move $t0, $sp +# Arg VCons.car +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr VCons.cdr = VCons.cdr +lw $t0, 20($sp) +lw $t1, 20($t0) +sw $t1, 16($sp) +#VCall print +move $t0, $sp +# Arg VCons.cdr +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Parse_init: +addi $sp, $sp, -24 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 6:tag BoolOp:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, BoolOp_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, BoolOp_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode BoolOp_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal BoolOp_init +sw $a1, 12($sp) +#SetAttr Parseboolop = result_1 +lw $t0, 28($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg value_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#SetAttr Parserest = instance_3 +lw $t0, 28($sp) +lw $t1, 16($sp) +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +Parse.read_input: +addi $sp, $sp, -152 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag Graph:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Graph_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Graph_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Graph_init +move $t0, $sp +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Graph_init +sw $a1, 8($sp) +#AssignNode g_2 = result_0 +lw $t1, 4($sp) +sw $t1, 12($sp) +#VCall in_string +move $t0, $sp +# Arg self +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 156($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 16($sp) +#AssignNode line_4 = result_3 +lw $t1, 16($sp) +sw $t1, 20($sp) +#LabelNode label_3 +label_3: +#GetAttr Parse.boolop = Parse.boolop +lw $t0, 156($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 64($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode String_init +move $t0, $sp +# Arg l_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 72($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg line_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 76($sp) +#GetAttr l_10 = Bool.value +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 44($sp) +#UnaryOperator not l_10 +lw $t1, 44($sp) +xor $a0, $t1, 1 +sw $a0, 40($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 80($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 112($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode String_init +move $t0, $sp +# Arg l_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 120($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg line_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 100($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 124($sp) +#GetAttr l_22 = Bool.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#UnaryOperator not l_22 +lw $t1, 92($sp) +xor $a0, $t1, 1 +sw $a0, 88($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 128($sp) +#VCall and +move $t0, $sp +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Parse.boolop +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 32($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 28($sp) +# IFGoto result_6 -> label_4 +lw $t0, 28($sp) +lw $a0, 16($t0) +bnez $a0, label_4 +#Goto label_5 +b label_5 +#LabelNode label_4 +label_4: +#VCall parse_line +move $t0, $sp +# Arg line_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 156($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 136($sp) +#VCall add_vertice +move $t0, $sp +# Arg result_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg g_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 132($sp) +#VCall in_string +move $t0, $sp +# Arg self +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 156($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 140($sp) +#AssignNode line_4 = result_34 +lw $t1, 140($sp) +sw $t1, 20($sp) +#Goto label_3 +b label_3 +#LabelNode label_5 +label_5: +#AssignNode result_36 = result_5 +lw $t1, 24($sp) +sw $t1, 148($sp) +#AssignNode result_37 = g_2 +lw $t1, 12($sp) +sw $t1, 152($sp) +#Return result_37 +lw $a1, 152($sp) +lw $ra, 0($sp) +addi $sp, $sp, 160 +jr $ra +Parse.parse_line: +addi $sp, $sp, -136 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Vertice:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Vertice_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Vertice_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Vertice_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Vertice_init +sw $a1, 12($sp) +#VCall a2i +move $t0, $sp +# Arg s +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 16($sp) +#VCall init +move $t0, $sp +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 4($sp) +#AssignNode v_4 = result_0 +lw $t1, 4($sp) +sw $t1, 20($sp) +#LabelNode label_6 +label_6: +#GetAttr Parse.rest = Parse.rest +lw $t0, 140($sp) +lw $t1, 20($t0) +sw $t1, 100($sp) +#VCall length +move $t0, $sp +# Arg Parse.rest +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 56($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 64($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 72($sp) +#GetAttr left_11 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#GetAttr right_12 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#BinaryOperator left_11 = right_12 +lw $a0, 48($sp) +lw $t1, 52($sp) +seq $a0, $a0, $t1 +sw $a0, 44($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 76($sp) +#GetAttr l_8 = Bool.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#UnaryOperator not l_8 +lw $t1, 36($sp) +xor $a0, $t1, 1 +sw $a0, 32($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 80($sp) +# IFGoto result_6 -> label_7 +lw $t0, 28($sp) +lw $a0, 16($t0) +bnez $a0, label_7 +#Goto label_8 +b label_8 +#LabelNode label_7 +label_7: +#GetAttr Parse.rest = Parse.rest +lw $t0, 140($sp) +lw $t1, 20($t0) +sw $t1, 100($sp) +#VCall a2i +move $t0, $sp +# Arg Parse.rest +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 84($sp) +#AssignNode succ_22 = result_20 +lw $t1, 84($sp) +sw $t1, 92($sp) +#GetAttr Parse.rest = Parse.rest +lw $t0, 140($sp) +lw $t1, 20($t0) +sw $t1, 100($sp) +#VCall a2i +move $t0, $sp +# Arg Parse.rest +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 96($sp) +#AssignNode weight_25 = result_23 +lw $t1, 96($sp) +sw $t1, 104($sp) +#Allocate 3:tag Edge:Class_name 7:Class_size +li $a0, 28 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Edge_name +sw $t1, 4($t0) +li $t1, 7 +sw $t1, 8($t0) +la $t1, Edge_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Edge_init +move $t0, $sp +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Edge_init +sw $a1, 120($sp) +#VCall number +move $t0, $sp +# Arg v_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 124($sp) +#VCall init +move $t0, $sp +# Arg weight_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg succ_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 112($sp) +#VCall add_out +move $t0, $sp +# Arg result_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg v_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 108($sp) +#AssignNode result_31 = result_26 +lw $t1, 108($sp) +sw $t1, 128($sp) +#AssignNode result_32 = result_31 +lw $t1, 128($sp) +sw $t1, 132($sp) +#Goto label_6 +b label_6 +#LabelNode label_8 +label_8: +#AssignNode result_33 = v_4 +lw $t1, 20($sp) +sw $t1, 136($sp) +#Return result_33 +lw $a1, 136($sp) +lw $ra, 0($sp) +addi $sp, $sp, 148 +jr $ra +Parse.c2i: +addi $sp, $sp, -496 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_9 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_9 +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 60($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 64($sp) +#CallNode String_init +move $t0, $sp +# Arg l_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 68($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_10 -> label_10 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_10 +#LoadStr msg_8 +la $t0, msg_8 +sw $t0, 96($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode String_init +move $t0, $sp +# Arg l_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 104($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 84($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_19 -> label_11 +lw $t0, 80($sp) +lw $a0, 16($t0) +bnez $a0, label_11 +#LoadStr msg_9 +la $t0, msg_9 +sw $t0, 132($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#CallNode String_init +move $t0, $sp +# Arg l_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 140($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 120($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 144($sp) +# IFGoto result_28 -> label_12 +lw $t0, 116($sp) +lw $a0, 16($t0) +bnez $a0, label_12 +#LoadStr msg_10 +la $t0, msg_10 +sw $t0, 168($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#CallNode String_init +move $t0, $sp +# Arg l_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 176($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 156($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 180($sp) +# IFGoto result_37 -> label_13 +lw $t0, 152($sp) +lw $a0, 16($t0) +bnez $a0, label_13 +#LoadStr msg_11 +la $t0, msg_11 +sw $t0, 204($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 208($sp) +#CallNode String_init +move $t0, $sp +# Arg l_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 212($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 192($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 216($sp) +# IFGoto result_46 -> label_14 +lw $t0, 188($sp) +lw $a0, 16($t0) +bnez $a0, label_14 +#LoadStr msg_12 +la $t0, msg_12 +sw $t0, 240($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 244($sp) +#CallNode String_init +move $t0, $sp +# Arg l_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 248($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 228($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 224($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 252($sp) +# IFGoto result_55 -> label_15 +lw $t0, 224($sp) +lw $a0, 16($t0) +bnez $a0, label_15 +#LoadStr msg_13 +la $t0, msg_13 +sw $t0, 276($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 280($sp) +#CallNode String_init +move $t0, $sp +# Arg l_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 284($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 264($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 260($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_65 +lw $t1, 264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 288($sp) +# IFGoto result_64 -> label_16 +lw $t0, 260($sp) +lw $a0, 16($t0) +bnez $a0, label_16 +#LoadStr msg_14 +la $t0, msg_14 +sw $t0, 312($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 316($sp) +#CallNode String_init +move $t0, $sp +# Arg l_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 320($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 300($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 296($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 324($sp) +# IFGoto result_73 -> label_17 +lw $t0, 296($sp) +lw $a0, 16($t0) +bnez $a0, label_17 +#LoadStr msg_15 +la $t0, msg_15 +sw $t0, 348($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 352($sp) +#CallNode String_init +move $t0, $sp +# Arg l_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 356($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg char +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 336($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 360($sp) +# IFGoto result_82 -> label_18 +lw $t0, 332($sp) +lw $a0, 16($t0) +bnez $a0, label_18 +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 500($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 364($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 368($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 372($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 376($sp) +#AssignNode result_81 = instance_91 +lw $t1, 368($sp) +sw $t1, 328($sp) +#Goto label_19 +b label_19 +#LabelNode label_18 +label_18: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 380($sp) +#LoadInt 9 +li $t0, 9 +sw $t0, 384($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_95 +lw $t1, 384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 388($sp) +#AssignNode result_81 = instance_94 +lw $t1, 380($sp) +sw $t1, 328($sp) +#LabelNode label_19 +label_19: +#AssignNode result_72 = result_81 +lw $t1, 328($sp) +sw $t1, 292($sp) +#Goto label_20 +b label_20 +#LabelNode label_17 +label_17: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 392($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 396($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_98 +lw $t1, 396($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 400($sp) +#AssignNode result_72 = instance_97 +lw $t1, 392($sp) +sw $t1, 292($sp) +#LabelNode label_20 +label_20: +#AssignNode result_63 = result_72 +lw $t1, 292($sp) +sw $t1, 256($sp) +#Goto label_21 +b label_21 +#LabelNode label_16 +label_16: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 404($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 408($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 412($sp) +#AssignNode result_63 = instance_100 +lw $t1, 404($sp) +sw $t1, 256($sp) +#LabelNode label_21 +label_21: +#AssignNode result_54 = result_63 +lw $t1, 256($sp) +sw $t1, 220($sp) +#Goto label_22 +b label_22 +#LabelNode label_15 +label_15: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 416($sp) +#LoadInt 6 +li $t0, 6 +sw $t0, 420($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_103 +lw $t1, 416($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 424($sp) +#AssignNode result_54 = instance_103 +lw $t1, 416($sp) +sw $t1, 220($sp) +#LabelNode label_22 +label_22: +#AssignNode result_45 = result_54 +lw $t1, 220($sp) +sw $t1, 184($sp) +#Goto label_23 +b label_23 +#LabelNode label_14 +label_14: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 428($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 432($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_107 +lw $t1, 432($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 436($sp) +#AssignNode result_45 = instance_106 +lw $t1, 428($sp) +sw $t1, 184($sp) +#LabelNode label_23 +label_23: +#AssignNode result_36 = result_45 +lw $t1, 184($sp) +sw $t1, 148($sp) +#Goto label_24 +b label_24 +#LabelNode label_13 +label_13: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 440($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 444($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 448($sp) +#AssignNode result_36 = instance_109 +lw $t1, 440($sp) +sw $t1, 148($sp) +#LabelNode label_24 +label_24: +#AssignNode result_27 = result_36 +lw $t1, 148($sp) +sw $t1, 112($sp) +#Goto label_25 +b label_25 +#LabelNode label_12 +label_12: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 452($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 456($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_112 +lw $t1, 452($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 460($sp) +#AssignNode result_27 = instance_112 +lw $t1, 452($sp) +sw $t1, 112($sp) +#LabelNode label_25 +label_25: +#AssignNode result_18 = result_27 +lw $t1, 112($sp) +sw $t1, 76($sp) +#Goto label_26 +b label_26 +#LabelNode label_11 +label_11: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 464($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 468($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_116 +lw $t1, 468($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_115 +lw $t1, 464($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 472($sp) +#AssignNode result_18 = instance_115 +lw $t1, 464($sp) +sw $t1, 76($sp) +#LabelNode label_26 +label_26: +#AssignNode result_9 = result_18 +lw $t1, 76($sp) +sw $t1, 40($sp) +#Goto label_27 +b label_27 +#LabelNode label_10 +label_10: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 476($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 480($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 484($sp) +#AssignNode result_9 = instance_118 +lw $t1, 476($sp) +sw $t1, 40($sp) +#LabelNode label_27 +label_27: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_28 +b label_28 +#LabelNode label_9 +label_9: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 488($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 492($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 496($sp) +#AssignNode result_0 = instance_121 +lw $t1, 488($sp) +sw $t1, 4($sp) +#LabelNode label_28 +label_28: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 508 +jr $ra +Parse.a2i: +addi $sp, $sp, -312 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_1 -> label_29 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_29 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 88($sp) +#VCall substr +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 64($sp) +#LoadStr msg_16 +la $t0, msg_16 +sw $t0, 92($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#CallNode String_init +move $t0, $sp +# Arg l_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 100($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 104($sp) +# IFGoto result_11 -> label_30 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_30 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 136($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 148($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 152($sp) +#VCall substr +move $t0, $sp +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 128($sp) +#LoadStr msg_17 +la $t0, msg_17 +sw $t0, 156($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#CallNode String_init +move $t0, $sp +# Arg l_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 164($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 116($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 168($sp) +# IFGoto result_27 -> label_31 +lw $t0, 112($sp) +lw $a0, 16($t0) +bnez $a0, label_31 +#VCall a2i_aux +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 172($sp) +#AssignNode result_26 = result_42 +lw $t1, 172($sp) +sw $t1, 108($sp) +#Goto label_32 +b label_32 +#LabelNode label_31 +label_31: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 200($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 204($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 208($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 212($sp) +#GetAttr left_47 = Int.value +lw $t0, 200($sp) +lw $t1, 16($t0) +sw $t1, 192($sp) +#GetAttr right_48 = Int.value +lw $t0, 204($sp) +lw $t1, 16($t0) +sw $t1, 196($sp) +#BinaryOperator left_47 - right_48 +lw $a0, 192($sp) +lw $t1, 196($sp) +sub $a0, $a0, $t1 +sw $a0, 188($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 184($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 216($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 220($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 224($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 228($sp) +#VCall substr +move $t0, $sp +# Arg result_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 180($sp) +#VCall a2i +move $t0, $sp +# Arg result_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 176($sp) +#AssignNode result_26 = result_43 +lw $t1, 176($sp) +sw $t1, 108($sp) +#LabelNode label_32 +label_32: +#AssignNode result_10 = result_26 +lw $t1, 108($sp) +sw $t1, 44($sp) +#Goto label_33 +b label_33 +#LabelNode label_30 +label_30: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 268($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 272($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 276($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_67 +lw $t1, 272($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 280($sp) +#GetAttr left_64 = Int.value +lw $t0, 268($sp) +lw $t1, 16($t0) +sw $t1, 260($sp) +#GetAttr right_65 = Int.value +lw $t0, 272($sp) +lw $t1, 16($t0) +sw $t1, 264($sp) +#BinaryOperator left_64 - right_65 +lw $a0, 260($sp) +lw $t1, 264($sp) +sub $a0, $a0, $t1 +sw $a0, 256($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 284($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 288($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 292($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_72 +lw $t1, 292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 296($sp) +#VCall substr +move $t0, $sp +# Arg result_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 320($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 248($sp) +#VCall a2i_aux +move $t0, $sp +# Arg result_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 316($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 244($sp) +#GetAttr l_59 = Int.value +lw $t0, 244($sp) +lw $t1, 16($t0) +sw $t1, 240($sp) +#UnaryOperator ~ l_59 +lw $t1, 240($sp) +neg $a0, $t1 +sw $a0, 236($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 232($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 300($sp) +#AssignNode result_10 = result_57 +lw $t1, 232($sp) +sw $t1, 44($sp) +#LabelNode label_33 +label_33: +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#Goto label_34 +b label_34 +#LabelNode label_29 +label_29: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 304($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 308($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_76 +lw $t1, 308($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_75 +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 312($sp) +#AssignNode result_0 = instance_75 +lw $t1, 304($sp) +sw $t1, 4($sp) +#LabelNode label_34 +label_34: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 324 +jr $ra +Parse.a2i_aux: +addi $sp, $sp, -536 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode int_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#AssignNode j_5 = result_4 +lw $t1, 20($sp) +sw $t1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#AssignNode i_9 = instance_6 +lw $t1, 28($sp) +sw $t1, 40($sp) +#LabelNode label_35 +label_35: +#GetAttr left_13 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 < right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +slt $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 64($sp) +# IFGoto result_11 -> label_36 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_36 +#Goto label_37 +b label_37 +#LabelNode label_36 +label_36: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 80($sp) +#VCall substr +move $t0, $sp +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 68($sp) +#AssignNode c_20 = result_16 +lw $t1, 68($sp) +sw $t1, 84($sp) +#LoadStr msg_17 +la $t0, msg_17 +sw $t0, 108($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#CallNode String_init +move $t0, $sp +# Arg l_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 116($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg c_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 96($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 120($sp) +# IFGoto result_22 -> label_38 +lw $t0, 92($sp) +lw $a0, 16($t0) +bnez $a0, label_38 +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 144($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 148($sp) +#CallNode String_init +move $t0, $sp +# Arg l_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 152($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg c_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 132($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 128($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 156($sp) +# IFGoto result_31 -> label_39 +lw $t0, 128($sp) +lw $a0, 16($t0) +bnez $a0, label_39 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 192($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 196($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 200($sp) +#GetAttr left_45 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 184($sp) +#GetAttr right_46 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 188($sp) +#BinaryOperator left_45 * right_46 +lw $a0, 184($sp) +lw $t1, 188($sp) +mul $a0, $a0, $t1 +sw $a0, 180($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 176($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 204($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 216($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 220($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 224($sp) +#VCall substr +move $t0, $sp +# Arg instance_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 212($sp) +#VCall c2i +move $t0, $sp +# Arg result_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 540($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 540($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 208($sp) +#GetAttr left_41 = Int.value +lw $t0, 176($sp) +lw $t1, 16($t0) +sw $t1, 168($sp) +#GetAttr right_42 = Int.value +lw $t0, 208($sp) +lw $t1, 16($t0) +sw $t1, 172($sp) +#BinaryOperator left_41 + right_42 +lw $a0, 168($sp) +lw $t1, 172($sp) +add $a0, $a0, $t1 +sw $a0, 164($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 228($sp) +#AssignNode int_3 = result_39 +lw $t1, 160($sp) +sw $t1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 256($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 260($sp) +#GetAttr left_60 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 244($sp) +#GetAttr right_61 = Int.value +lw $t0, 252($sp) +lw $t1, 16($t0) +sw $t1, 248($sp) +#BinaryOperator left_60 + right_61 +lw $a0, 244($sp) +lw $t1, 248($sp) +add $a0, $a0, $t1 +sw $a0, 240($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 236($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 264($sp) +#AssignNode i_9 = result_58 +lw $t1, 236($sp) +sw $t1, 40($sp) +#GetAttr left_70 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 284($sp) +#GetAttr right_71 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 288($sp) +#BinaryOperator left_70 = right_71 +lw $a0, 284($sp) +lw $t1, 288($sp) +seq $a0, $a0, $t1 +sw $a0, 280($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 276($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 292($sp) +# IFGoto result_68 -> label_40 +lw $t0, 276($sp) +lw $a0, 16($t0) +bnez $a0, label_40 +#LoadStr empty_str +la $t0, empty_str +sw $t0, 296($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 300($sp) +#CallNode String_init +move $t0, $sp +# Arg l_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 304($sp) +#AssignNode result_67 = instance_74 +lw $t1, 300($sp) +sw $t1, 272($sp) +#Goto label_41 +b label_41 +#LabelNode label_40 +label_40: +#LoadStr empty_str +la $t0, empty_str +sw $t0, 308($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 312($sp) +#CallNode String_init +move $t0, $sp +# Arg l_76 +lw $t1, 308($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 316($sp) +#SetAttr Parserest = instance_77 +lw $t0, 540($sp) +lw $t1, 312($sp) +sw $t1, 20($t0) +#AssignNode result_67 = instance_77 +lw $t1, 312($sp) +sw $t1, 272($sp) +#LabelNode label_41 +label_41: +#AssignNode result_30 = result_67 +lw $t1, 272($sp) +sw $t1, 124($sp) +#Goto label_42 +b label_42 +#LabelNode label_39 +label_39: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 360($sp) +#GetAttr left_87 = Int.value +lw $t0, 360($sp) +lw $t1, 16($t0) +sw $t1, 352($sp) +#GetAttr right_88 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 356($sp) +#BinaryOperator left_87 - right_88 +lw $a0, 352($sp) +lw $t1, 356($sp) +sub $a0, $a0, $t1 +sw $a0, 348($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 344($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_85 +lw $t1, 344($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 364($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 368($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 372($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 376($sp) +#GetAttr left_83 = Int.value +lw $t0, 344($sp) +lw $t1, 16($t0) +sw $t1, 336($sp) +#GetAttr right_84 = Int.value +lw $t0, 368($sp) +lw $t1, 16($t0) +sw $t1, 340($sp) +#BinaryOperator left_83 - right_84 +lw $a0, 336($sp) +lw $t1, 340($sp) +sub $a0, $a0, $t1 +sw $a0, 332($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 328($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_81 +lw $t1, 328($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 380($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 400($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 404($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_99 +lw $t1, 400($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 408($sp) +#GetAttr left_97 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 392($sp) +#GetAttr right_98 = Int.value +lw $t0, 400($sp) +lw $t1, 16($t0) +sw $t1, 396($sp) +#BinaryOperator left_97 + right_98 +lw $a0, 392($sp) +lw $t1, 396($sp) +add $a0, $a0, $t1 +sw $a0, 388($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 384($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_96 +lw $t1, 388($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_95 +lw $t1, 384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 412($sp) +#VCall substr +move $t0, $sp +# Arg result_81 +lw $t1, 328($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_95 +lw $t1, 384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 324($sp) +#SetAttr Parserest = result_80 +lw $t0, 540($sp) +lw $t1, 324($sp) +sw $t1, 20($t0) +#AssignNode i_9 = j_5 +lw $t1, 24($sp) +sw $t1, 40($sp) +#AssignNode result_30 = j_5 +lw $t1, 24($sp) +sw $t1, 124($sp) +#LabelNode label_42 +label_42: +#AssignNode result_21 = result_30 +lw $t1, 124($sp) +sw $t1, 88($sp) +#Goto label_43 +b label_43 +#LabelNode label_38 +label_38: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 460($sp) +#GetAttr left_112 = Int.value +lw $t0, 460($sp) +lw $t1, 16($t0) +sw $t1, 452($sp) +#GetAttr right_113 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 456($sp) +#BinaryOperator left_112 - right_113 +lw $a0, 452($sp) +lw $t1, 456($sp) +sub $a0, $a0, $t1 +sw $a0, 448($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 444($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_111 +lw $t1, 448($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 464($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 468($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 472($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_117 +lw $t1, 472($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_116 +lw $t1, 468($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 476($sp) +#GetAttr left_108 = Int.value +lw $t0, 444($sp) +lw $t1, 16($t0) +sw $t1, 436($sp) +#GetAttr right_109 = Int.value +lw $t0, 468($sp) +lw $t1, 16($t0) +sw $t1, 440($sp) +#BinaryOperator left_108 - right_109 +lw $a0, 436($sp) +lw $t1, 440($sp) +sub $a0, $a0, $t1 +sw $a0, 432($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 428($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_107 +lw $t1, 432($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 480($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 500($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 504($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_125 +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_124 +lw $t1, 500($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 508($sp) +#GetAttr left_122 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 492($sp) +#GetAttr right_123 = Int.value +lw $t0, 500($sp) +lw $t1, 16($t0) +sw $t1, 496($sp) +#BinaryOperator left_122 + right_123 +lw $a0, 492($sp) +lw $t1, 496($sp) +add $a0, $a0, $t1 +sw $a0, 488($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 484($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_120 +lw $t1, 484($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 512($sp) +#VCall substr +move $t0, $sp +# Arg result_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_120 +lw $t1, 484($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 424($sp) +#SetAttr Parserest = result_105 +lw $t0, 540($sp) +lw $t1, 424($sp) +sw $t1, 20($t0) +#AssignNode i_9 = j_5 +lw $t1, 24($sp) +sw $t1, 40($sp) +#AssignNode result_21 = j_5 +lw $t1, 24($sp) +sw $t1, 88($sp) +#LabelNode label_43 +label_43: +#AssignNode result_130 = result_21 +lw $t1, 88($sp) +sw $t1, 524($sp) +#Goto label_35 +b label_35 +#LabelNode label_37 +label_37: +#AssignNode result_131 = result_10 +lw $t1, 44($sp) +sw $t1, 528($sp) +#AssignNode result_132 = result_131 +lw $t1, 528($sp) +sw $t1, 532($sp) +#AssignNode result_133 = int_3 +lw $t1, 16($sp) +sw $t1, 536($sp) +#Return result_133 +lw $a1, 536($sp) +lw $ra, 0($sp) +addi $sp, $sp, 548 +jr $ra +Main_init: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Parse_init +move $t0, $sp +# Arg self +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Parse_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#VCall read_input +move $t0, $sp +# Arg self +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 8($sp) +#SetAttr Maing = result_1 +lw $t0, 12($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +Main.main: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Main.g = Main.g +lw $t0, 20($sp) +lw $t1, 24($t0) +sw $t1, 16($sp) +#VCall print_V +move $t0, $sp +# Arg Main.g +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 4($sp) +#GetAttr Main.g = Main.g +lw $t0, 20($sp) +lw $t1, 24($t0) +sw $t1, 16($sp) +#VCall print_E +move $t0, $sp +# Arg Main.g +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +BoolOp_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +BoolOp.and: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +# IFGoto b1 -> label_44 +lw $t0, 24($sp) +lw $a0, 16($t0) +bnez $a0, label_44 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 16($sp) +#AssignNode result_0 = instance_1 +lw $t1, 8($sp) +sw $t1, 4($sp) +#Goto label_45 +b label_45 +#LabelNode label_44 +label_44: +#AssignNode result_0 = b2 +lw $t1, 28($sp) +sw $t1, 4($sp) +#LabelNode label_45 +label_45: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +BoolOp.or: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +# IFGoto b1 -> label_46 +lw $t0, 24($sp) +lw $a0, 16($t0) +bnez $a0, label_46 +#AssignNode result_0 = b2 +lw $t1, 28($sp) +sw $t1, 4($sp) +#Goto label_47 +b label_47 +#LabelNode label_46 +label_46: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 12($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 16($sp) +#AssignNode result_0 = instance_1 +lw $t1, 8($sp) +sw $t1, 4($sp) +#LabelNode label_47 +label_47: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra \ No newline at end of file diff --git a/tests/codegen/graph_input.txt b/tests/codegen/graph_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/graph_output.txt b/tests/codegen/graph_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/hairyscary.mips b/tests/codegen/hairyscary.mips new file mode 100644 index 000000000..ce4e92114 --- /dev/null +++ b/tests/codegen/hairyscary.mips @@ -0,0 +1,2042 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Foo_name: .asciiz "Foo" +Foo_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Bazz.printh +.word Foo.doh +Bar_name: .asciiz "Bar" +Bar_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Bazz.printh +.word Foo.doh +Razz_name: .asciiz "Razz" +Razz_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Bazz.printh +.word Foo.doh +Bazz_name: .asciiz "Bazz" +Bazz_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Bazz.printh +.word Bazz.doh +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "do nothing" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag Main:Class_name 8:Class_size +li $a0, 32 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 8 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Foo_init: +addi $sp, $sp, -120 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Bazz_init +move $t0, $sp +# Arg self +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bazz_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Case self +lw $t0, 124($sp) +lw $t1, 0($t0) +la $a0, void +bne $t1, $a0, label_1 +b case_void_error +#LabelNode label_1 +label_1: +#Action +blt $t1, 5, label_3 +bgt $t1, 5, label_3 +#AssignNode n_2 = self +lw $t1, 124($sp) +sw $t1, 12($sp) +#AssignNode result_1 = n_2 +lw $t1, 12($sp) +sw $t1, 8($sp) +#Goto label_2 +b label_2 +#LabelNode label_3 +label_3: +#Action +blt $t1, 4, label_4 +bgt $t1, 5, label_4 +#AssignNode n_3 = self +lw $t1, 124($sp) +sw $t1, 16($sp) +#Allocate 5:tag Bar:Class_name 13:Class_size +li $a0, 52 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Bar_name +sw $t1, 4($t0) +li $t1, 13 +sw $t1, 8($t0) +la $t1, Bar_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Bar_init +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bar_init +sw $a1, 24($sp) +#AssignNode result_1 = result_4 +lw $t1, 20($sp) +sw $t1, 8($sp) +#Goto label_2 +b label_2 +#LabelNode label_4 +label_4: +#Action +blt $t1, 3, label_5 +bgt $t1, 5, label_5 +#AssignNode n_6 = self +lw $t1, 124($sp) +sw $t1, 28($sp) +#Allocate 4:tag Razz:Class_name 11:Class_size +li $a0, 44 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Razz_name +sw $t1, 4($t0) +li $t1, 11 +sw $t1, 8($t0) +la $t1, Razz_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode Razz_init +move $t0, $sp +# Arg result_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Razz_init +sw $a1, 36($sp) +#AssignNode result_1 = result_7 +lw $t1, 32($sp) +sw $t1, 8($sp) +#Goto label_2 +b label_2 +#LabelNode label_5 +label_5: +#Goto case_no_match_error +b case_no_match_error +#LabelNode label_2 +label_2: +#SetAttr Fooa = result_1 +lw $t0, 124($sp) +lw $t1, 8($sp) +sw $t1, 28($t0) +#GetAttr Foo.a = Foo.a +lw $t0, 124($sp) +lw $t1, 28($t0) +sw $t1, 92($sp) +#VCall doh +move $t0, $sp +# Arg Foo.a +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 92($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 88($sp) +#GetAttr Foo.g = Foo.g +lw $t0, 124($sp) +lw $t1, 20($t0) +sw $t1, 100($sp) +#VCall doh +move $t0, $sp +# Arg Foo.g +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 96($sp) +#GetAttr left_19 = Int.value +lw $t0, 88($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#GetAttr right_20 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 84($sp) +#BinaryOperator left_19 + right_20 +lw $a0, 80($sp) +lw $t1, 84($sp) +add $a0, $a0, $t1 +sw $a0, 76($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#VCall doh +move $t0, $sp +# Arg self +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 124($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 108($sp) +#GetAttr left_15 = Int.value +lw $t0, 72($sp) +lw $t1, 16($t0) +sw $t1, 64($sp) +#GetAttr right_16 = Int.value +lw $t0, 108($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#BinaryOperator left_15 + right_16 +lw $a0, 64($sp) +lw $t1, 68($sp) +add $a0, $a0, $t1 +sw $a0, 60($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 56($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#VCall printh +move $t0, $sp +# Arg self +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 124($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 116($sp) +#GetAttr left_11 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#GetAttr right_12 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#BinaryOperator left_11 + right_12 +lw $a0, 48($sp) +lw $t1, 52($sp) +add $a0, $a0, $t1 +sw $a0, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 120($sp) +#SetAttr Foob = result_9 +lw $t0, 124($sp) +lw $t1, 40($sp) +sw $t1, 32($t0) +lw $ra, 0($sp) +addi $sp, $sp, 128 +jr $ra +Foo.doh: +addi $sp, $sp, -56 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Foo.h = Foo.h +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#AssignNode i_1 = Foo.h +lw $t1, 28($sp) +sw $t1, 8($sp) +#GetAttr Foo.h = Foo.h +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr right_5 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#BinaryOperator left_4 + right_5 +lw $a0, 20($sp) +lw $t1, 24($sp) +add $a0, $a0, $t1 +sw $a0, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 44($sp) +#SetAttr Fooh = result_2 +lw $t0, 60($sp) +lw $t1, 12($sp) +sw $t1, 16($t0) +#GetAttr Foo.i = Foo.i +lw $t0, 60($sp) +lw $t1, 24($t0) +sw $t1, 52($sp) +#AssignNode result_13 = Foo.i +lw $t1, 52($sp) +sw $t1, 56($sp) +#Return result_13 +lw $a1, 56($sp) +lw $ra, 0($sp) +addi $sp, $sp, 64 +jr $ra +Bar_init: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Razz_init +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Razz_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#VCall doh +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 8($sp) +#SetAttr Barc = result_1 +lw $t0, 16($sp) +lw $t1, 8($sp) +sw $t1, 44($t0) +#VCall printh +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 12($sp) +#SetAttr Bard = result_2 +lw $t0, 16($sp) +lw $t1, 12($sp) +sw $t1, 48($t0) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Razz_init: +addi $sp, $sp, -140 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Foo_init +move $t0, $sp +# Arg self +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Foo_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Case self +lw $t0, 144($sp) +lw $t1, 0($t0) +la $a0, void +bne $t1, $a0, label_6 +b case_void_error +#LabelNode label_6 +label_6: +#Action +blt $t1, 5, label_8 +bgt $t1, 5, label_8 +#AssignNode n_2 = self +lw $t1, 144($sp) +sw $t1, 12($sp) +#AssignNode result_1 = n_2 +lw $t1, 12($sp) +sw $t1, 8($sp) +#Goto label_7 +b label_7 +#LabelNode label_8 +label_8: +#Action +blt $t1, 4, label_9 +bgt $t1, 5, label_9 +#AssignNode n_3 = self +lw $t1, 144($sp) +sw $t1, 16($sp) +#Allocate 5:tag Bar:Class_name 13:Class_size +li $a0, 52 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Bar_name +sw $t1, 4($t0) +li $t1, 13 +sw $t1, 8($t0) +la $t1, Bar_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Bar_init +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bar_init +sw $a1, 24($sp) +#AssignNode result_1 = result_4 +lw $t1, 20($sp) +sw $t1, 8($sp) +#Goto label_7 +b label_7 +#LabelNode label_9 +label_9: +#Goto case_no_match_error +b case_no_match_error +#LabelNode label_7 +label_7: +#SetAttr Razze = result_1 +lw $t0, 144($sp) +lw $t1, 8($sp) +sw $t1, 36($t0) +#GetAttr Razz.a = Razz.a +lw $t0, 144($sp) +lw $t1, 28($t0) +sw $t1, 96($sp) +#Allocate 2:tag Bazz:Class_name 7:Class_size +li $a0, 28 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Bazz_name +sw $t1, 4($t0) +li $t1, 7 +sw $t1, 8($t0) +la $t1, Bazz_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#VCall doh +move $t0, $sp +# Arg Razz.a +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 92($sp) +#GetAttr Razz.g = Razz.g +lw $t0, 144($sp) +lw $t1, 20($t0) +sw $t1, 108($sp) +#VCall doh +move $t0, $sp +# Arg Razz.g +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 108($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 104($sp) +#GetAttr left_20 = Int.value +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 84($sp) +#GetAttr right_21 = Int.value +lw $t0, 104($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#BinaryOperator left_20 + right_21 +lw $a0, 84($sp) +lw $t1, 88($sp) +add $a0, $a0, $t1 +sw $a0, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#GetAttr Razz.e = Razz.e +lw $t0, 144($sp) +lw $t1, 36($t0) +sw $t1, 120($sp) +#VCall doh +move $t0, $sp +# Arg Razz.e +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 120($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 116($sp) +#GetAttr left_16 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#GetAttr right_17 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 72($sp) +#BinaryOperator left_16 + right_17 +lw $a0, 68($sp) +lw $t1, 72($sp) +add $a0, $a0, $t1 +sw $a0, 64($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 124($sp) +#VCall doh +move $t0, $sp +# Arg self +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 144($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 128($sp) +#GetAttr left_12 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 128($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 + right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +add $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#VCall printh +move $t0, $sp +# Arg self +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 144($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 136($sp) +#GetAttr left_8 = Int.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr right_9 = Int.value +lw $t0, 136($sp) +lw $t1, 16($t0) +sw $t1, 40($sp) +#BinaryOperator left_8 + right_9 +lw $a0, 36($sp) +lw $t1, 40($sp) +add $a0, $a0, $t1 +sw $a0, 32($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#SetAttr Razzf = result_6 +lw $t0, 144($sp) +lw $t1, 28($sp) +sw $t1, 40($t0) +lw $ra, 0($sp) +addi $sp, $sp, 148 +jr $ra +Bazz_init: +addi $sp, $sp, -64 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Bazzh = instance_1 +lw $t0, 68($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Case self +lw $t0, 68($sp) +lw $t1, 0($t0) +la $a0, void +bne $t1, $a0, label_10 +b case_void_error +#LabelNode label_10 +label_10: +#Action +blt $t1, 5, label_12 +bgt $t1, 5, label_12 +#AssignNode n_5 = self +lw $t1, 68($sp) +sw $t1, 24($sp) +#AssignNode result_4 = n_5 +lw $t1, 24($sp) +sw $t1, 20($sp) +#Goto label_11 +b label_11 +#LabelNode label_12 +label_12: +#Action +blt $t1, 4, label_13 +bgt $t1, 5, label_13 +#AssignNode n_6 = self +lw $t1, 68($sp) +sw $t1, 28($sp) +#Allocate 5:tag Bar:Class_name 13:Class_size +li $a0, 52 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Bar_name +sw $t1, 4($t0) +li $t1, 13 +sw $t1, 8($t0) +la $t1, Bar_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode Bar_init +move $t0, $sp +# Arg result_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bar_init +sw $a1, 36($sp) +#AssignNode result_4 = result_7 +lw $t1, 32($sp) +sw $t1, 20($sp) +#Goto label_11 +b label_11 +#LabelNode label_13 +label_13: +#Action +blt $t1, 3, label_14 +bgt $t1, 5, label_14 +#AssignNode n_9 = self +lw $t1, 68($sp) +sw $t1, 40($sp) +#Allocate 4:tag Razz:Class_name 11:Class_size +li $a0, 44 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Razz_name +sw $t1, 4($t0) +li $t1, 11 +sw $t1, 8($t0) +la $t1, Razz_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Razz_init +move $t0, $sp +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Razz_init +sw $a1, 48($sp) +#AssignNode result_4 = result_10 +lw $t1, 44($sp) +sw $t1, 20($sp) +#Goto label_11 +b label_11 +#LabelNode label_14 +label_14: +#Action +blt $t1, 2, label_15 +bgt $t1, 5, label_15 +#AssignNode n_12 = self +lw $t1, 68($sp) +sw $t1, 52($sp) +#Allocate 3:tag Foo:Class_name 9:Class_size +li $a0, 36 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Foo_name +sw $t1, 4($t0) +li $t1, 9 +sw $t1, 8($t0) +la $t1, Foo_methods +sw $t1, 12($t0) +sw $t0, 56($sp) +#CallNode Foo_init +move $t0, $sp +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Foo_init +sw $a1, 60($sp) +#AssignNode result_4 = result_13 +lw $t1, 56($sp) +sw $t1, 20($sp) +#Goto label_11 +b label_11 +#LabelNode label_15 +label_15: +#Goto case_no_match_error +b case_no_match_error +#LabelNode label_11 +label_11: +#SetAttr Bazzg = result_4 +lw $t0, 68($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#VCall printh +move $t0, $sp +# Arg self +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 68($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 64($sp) +#SetAttr Bazzi = result_15 +lw $t0, 68($sp) +lw $t1, 64($sp) +sw $t1, 24($t0) +lw $ra, 0($sp) +addi $sp, $sp, 72 +jr $ra +Bazz.printh: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Bazz.h = Bazz.h +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#VCall out_int +move $t0, $sp +# Arg Bazz.h +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 24($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 16($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 20($sp) +#Return instance_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 28 +jr $ra +Bazz.doh: +addi $sp, $sp, -56 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Bazz.h = Bazz.h +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#AssignNode i_1 = Bazz.h +lw $t1, 28($sp) +sw $t1, 8($sp) +#GetAttr Bazz.h = Bazz.h +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr right_5 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#BinaryOperator left_4 + right_5 +lw $a0, 20($sp) +lw $t1, 24($sp) +add $a0, $a0, $t1 +sw $a0, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 44($sp) +#SetAttr Bazzh = result_2 +lw $t0, 60($sp) +lw $t1, 12($sp) +sw $t1, 16($t0) +#GetAttr Bazz.i = Bazz.i +lw $t0, 60($sp) +lw $t1, 24($t0) +sw $t1, 52($sp) +#AssignNode result_13 = Bazz.i +lw $t1, 52($sp) +sw $t1, 56($sp) +#Return result_13 +lw $a1, 56($sp) +lw $ra, 0($sp) +addi $sp, $sp, 64 +jr $ra +Main_init: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 2:tag Bazz:Class_name 7:Class_size +li $a0, 28 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Bazz_name +sw $t1, 4($t0) +li $t1, 7 +sw $t1, 8($t0) +la $t1, Bazz_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bazz_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bazz_init +sw $a1, 12($sp) +#SetAttr Maina = result_1 +lw $t0, 40($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 3:tag Foo:Class_name 9:Class_size +li $a0, 36 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Foo_name +sw $t1, 4($t0) +li $t1, 9 +sw $t1, 8($t0) +la $t1, Foo_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode Foo_init +move $t0, $sp +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Foo_init +sw $a1, 20($sp) +#SetAttr Mainb = result_3 +lw $t0, 40($sp) +lw $t1, 16($sp) +sw $t1, 20($t0) +#Allocate 4:tag Razz:Class_name 11:Class_size +li $a0, 44 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Razz_name +sw $t1, 4($t0) +li $t1, 11 +sw $t1, 8($t0) +la $t1, Razz_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Razz_init +move $t0, $sp +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Razz_init +sw $a1, 28($sp) +#SetAttr Mainc = result_5 +lw $t0, 40($sp) +lw $t1, 24($sp) +sw $t1, 24($t0) +#Allocate 5:tag Bar:Class_name 13:Class_size +li $a0, 52 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, Bar_name +sw $t1, 4($t0) +li $t1, 13 +sw $t1, 8($t0) +la $t1, Bar_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode Bar_init +move $t0, $sp +# Arg result_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bar_init +sw $a1, 36($sp) +#SetAttr Maind = result_7 +lw $t0, 40($sp) +lw $t1, 32($sp) +sw $t1, 28($t0) +lw $ra, 0($sp) +addi $sp, $sp, 44 +jr $ra +Main.main: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg l_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra \ No newline at end of file diff --git a/tests/codegen/hairyscary_input.txt b/tests/codegen/hairyscary_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/hairyscary_output.txt b/tests/codegen/hairyscary_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/hello_world.mips b/tests/codegen/hello_world.mips new file mode 100644 index 000000000..53b2b8d54 --- /dev/null +++ b/tests/codegen/hello_world.mips @@ -0,0 +1,754 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "Hello, World. +" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra \ No newline at end of file diff --git a/tests/codegen/hello_world_input.txt b/tests/codegen/hello_world_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/hello_world_output.txt b/tests/codegen/hello_world_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/io.mips b/tests/codegen/io.mips new file mode 100644 index 000000000..fc82c9bf8 --- /dev/null +++ b/tests/codegen/io.mips @@ -0,0 +1,1267 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +A_name: .asciiz "A" +A_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A.out_a +B_name: .asciiz "B" +B_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word A.out_a +.word B.out_b +C_name: .asciiz "C" +C_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word C.out_c +D_name: .asciiz "D" +D_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word C.out_c +.word D.out_d +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "A: Hello world +" +msg_4: .asciiz "B: Hello world +" +msg_5: .asciiz "C: Hello world +" +msg_6: .asciiz "D: Hello world +" +msg_7: .asciiz "Done. +" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Main:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +A_init: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 1:tag IO:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 1 +sw $t1, 0($t0) +la $t1, IO_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, IO_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode IO_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 12($sp) +#SetAttr Aio = result_1 +lw $t0, 16($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +A.out_a: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr A.io = A.io +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg l_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#VCall out_string +move $t0, $sp +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg A.io +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 28 +jr $ra +B_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode A_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +B.out_b: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr B.io = B.io +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg l_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#VCall out_string +move $t0, $sp +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg B.io +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 28 +jr $ra +C_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +C.out_c: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +D_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode C_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal C_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +D.out_d: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -64 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag A:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, A_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, A_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode A_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal A_init +sw $a1, 12($sp) +#VCall out_a +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 6:tag B:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, B_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, B_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode B_init +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal B_init +sw $a1, 24($sp) +#VCall out_b +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 16($sp) +#Allocate 2:tag C:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, C_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, C_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode C_init +move $t0, $sp +# Arg result_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal C_init +sw $a1, 36($sp) +#VCall out_c +move $t0, $sp +# Arg result_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 32($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 28($sp) +#Allocate 3:tag D:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, D_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, D_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode D_init +move $t0, $sp +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal D_init +sw $a1, 48($sp) +#VCall out_d +move $t0, $sp +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 44($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 40($sp) +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 68($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#Return result_12 +lw $a1, 52($sp) +lw $ra, 0($sp) +addi $sp, $sp, 72 +jr $ra \ No newline at end of file diff --git a/tests/codegen/io_input.txt b/tests/codegen/io_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/io_output.txt b/tests/codegen/io_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/life.mips b/tests/codegen/life.mips new file mode 100644 index 000000000..d5b51b896 --- /dev/null +++ b/tests/codegen/life.mips @@ -0,0 +1,12958 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Board_name: .asciiz "Board" +Board_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Board.size_of_board +.word Board.board_init +CellularAutomaton_name: .asciiz "CellularAutomaton" +CellularAutomaton_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Board.size_of_board +.word Board.board_init +.word CellularAutomaton.init +.word CellularAutomaton.print +.word CellularAutomaton.num_cells +.word CellularAutomaton.cell +.word CellularAutomaton.north +.word CellularAutomaton.south +.word CellularAutomaton.east +.word CellularAutomaton.west +.word CellularAutomaton.northwest +.word CellularAutomaton.northeast +.word CellularAutomaton.southeast +.word CellularAutomaton.southwest +.word CellularAutomaton.neighbors +.word CellularAutomaton.cell_at_next_evolution +.word CellularAutomaton.evolve +.word CellularAutomaton.option +.word CellularAutomaton.prompt +.word CellularAutomaton.prompt2 +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Board.size_of_board +.word Board.board_init +.word CellularAutomaton.init +.word CellularAutomaton.print +.word CellularAutomaton.num_cells +.word CellularAutomaton.cell +.word CellularAutomaton.north +.word CellularAutomaton.south +.word CellularAutomaton.east +.word CellularAutomaton.west +.word CellularAutomaton.northwest +.word CellularAutomaton.northeast +.word CellularAutomaton.southeast +.word CellularAutomaton.southwest +.word CellularAutomaton.neighbors +.word CellularAutomaton.cell_at_next_evolution +.word CellularAutomaton.evolve +.word CellularAutomaton.option +.word CellularAutomaton.prompt +.word CellularAutomaton.prompt2 +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz " " +msg_4: .asciiz "X" +msg_5: .asciiz "-" +msg_6: .asciiz " +Please chose a number: +" +msg_7: .asciiz " 1: A cross +" +msg_8: .asciiz " 2: A slash from the upper left to lower right +" +msg_9: .asciiz " 3: A slash from the upper right to lower left +" +msg_10: .asciiz " 4: An X +" +msg_11: .asciiz " 5: A greater than sign +" +msg_12: .asciiz " 6: A less than sign +" +msg_13: .asciiz " 7: Two greater than signs +" +msg_14: .asciiz " 8: Two less than signs +" +msg_15: .asciiz " 9: A 'V' +" +msg_16: .asciiz " 10: An inverse 'V' +" +msg_17: .asciiz " 11: Numbers 9 and 10 combined +" +msg_18: .asciiz " 12: A full grid +" +msg_19: .asciiz " 13: A 'T' +" +msg_20: .asciiz " 14: A plus '+' +" +msg_21: .asciiz " 15: A 'W' +" +msg_22: .asciiz " 16: An 'M' +" +msg_23: .asciiz " 17: An 'E' +" +msg_24: .asciiz " 18: A '3' +" +msg_25: .asciiz " 19: An 'O' +" +msg_26: .asciiz " 20: An '8' +" +msg_27: .asciiz " 21: An 'S' +" +msg_28: .asciiz "Your choice => " +msg_29: .asciiz " " +msg_30: .asciiz " XXXX X XX X XXXX " +msg_31: .asciiz " XX X XX X XX X XX X XX " +msg_32: .asciiz " XX X XX X XX " +msg_33: .asciiz "XXX X X X X XXXX " +msg_34: .asciiz "XXXXX X XXXXX X XXXX" +msg_35: .asciiz " X X X X X X X" +msg_36: .asciiz "X X X X X X X " +msg_37: .asciiz " X X XXXXX X X " +msg_38: .asciiz "XXXXX X X X X " +msg_39: .asciiz "XXXXXXXXXXXXXXXXXXXXXXXXX" +msg_40: .asciiz "X X X X X X X X" +msg_41: .asciiz " X X X X X" +msg_42: .asciiz "X X X X X " +msg_43: .asciiz " X XX X X X " +msg_44: .asciiz "X X X XX X " +msg_45: .asciiz " X X X X X" +msg_46: .asciiz "X X X X X " +msg_47: .asciiz "X X X X X X X X X" +msg_48: .asciiz "X X X X X" +msg_49: .asciiz " X X X X X " +msg_50: .asciiz " XX XXXX XXXX XX " +msg_51: .asciiz "Would you like to continue with the next generation? +" +msg_52: .asciiz "Please use lowercase y or n for your answer [y]: " +msg_53: .asciiz "n" +msg_54: .asciiz " + +" +msg_55: .asciiz "Would you like to choose a background pattern? +" +msg_56: .asciiz "Please use lowercase y or n for your answer [n]: " +msg_57: .asciiz "y" +msg_58: .asciiz "Welcome to the Game of Life. +" +msg_59: .asciiz "There are many initial states to choose from. +" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Main:Class_name 9:Class_size +li $a0, 36 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 9 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Board_init: +addi $sp, $sp, -40 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Boardrows = instance_1 +lw $t0, 44($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 28($sp) +#SetAttr Boardcolumns = instance_4 +lw $t0, 44($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#SetAttr Boardboard_size = instance_7 +lw $t0, 44($sp) +lw $t1, 32($sp) +sw $t1, 24($t0) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +Board.size_of_board: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall length +move $t0, $sp +# Arg initial +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +Board.board_init: +addi $sp, $sp, -480 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall size_of_board +move $t0, $sp +# Arg start +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 484($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 484($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 4($sp) +#AssignNode size_1 = result_0 +lw $t1, 4($sp) +sw $t1, 8($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#LoadInt 15 +li $t0, 15 +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_5 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#GetAttr right_6 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#BinaryOperator left_5 = right_6 +lw $a0, 24($sp) +lw $t1, 28($sp) +seq $a0, $a0, $t1 +sw $a0, 20($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +# IFGoto result_3 -> label_1 +lw $t0, 16($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 16 +li $t0, 16 +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#GetAttr left_14 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#GetAttr right_15 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 64($sp) +#BinaryOperator left_14 = right_15 +lw $a0, 60($sp) +lw $t1, 64($sp) +seq $a0, $a0, $t1 +sw $a0, 56($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 52($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 80($sp) +# IFGoto result_12 -> label_2 +lw $t0, 52($sp) +lw $a0, 16($t0) +bnez $a0, label_2 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#LoadInt 20 +li $t0, 20 +sw $t0, 108($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#GetAttr left_23 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#GetAttr right_24 = Int.value +lw $t0, 104($sp) +lw $t1, 16($t0) +sw $t1, 100($sp) +#BinaryOperator left_23 = right_24 +lw $a0, 96($sp) +lw $t1, 100($sp) +seq $a0, $a0, $t1 +sw $a0, 92($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 116($sp) +# IFGoto result_21 -> label_3 +lw $t0, 88($sp) +lw $a0, 16($t0) +bnez $a0, label_3 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 140($sp) +#LoadInt 21 +li $t0, 21 +sw $t0, 144($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 148($sp) +#GetAttr left_32 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 132($sp) +#GetAttr right_33 = Int.value +lw $t0, 140($sp) +lw $t1, 16($t0) +sw $t1, 136($sp) +#BinaryOperator left_32 = right_33 +lw $a0, 132($sp) +lw $t1, 136($sp) +seq $a0, $a0, $t1 +sw $a0, 128($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 152($sp) +# IFGoto result_30 -> label_4 +lw $t0, 124($sp) +lw $a0, 16($t0) +bnez $a0, label_4 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 176($sp) +#LoadInt 25 +li $t0, 25 +sw $t0, 180($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 184($sp) +#GetAttr left_41 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 168($sp) +#GetAttr right_42 = Int.value +lw $t0, 176($sp) +lw $t1, 16($t0) +sw $t1, 172($sp) +#BinaryOperator left_41 = right_42 +lw $a0, 168($sp) +lw $t1, 172($sp) +seq $a0, $a0, $t1 +sw $a0, 164($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 188($sp) +# IFGoto result_39 -> label_5 +lw $t0, 160($sp) +lw $a0, 16($t0) +bnez $a0, label_5 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 212($sp) +#LoadInt 28 +li $t0, 28 +sw $t0, 216($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 220($sp) +#GetAttr left_50 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 204($sp) +#GetAttr right_51 = Int.value +lw $t0, 212($sp) +lw $t1, 16($t0) +sw $t1, 208($sp) +#BinaryOperator left_50 = right_51 +lw $a0, 204($sp) +lw $t1, 208($sp) +seq $a0, $a0, $t1 +sw $a0, 200($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 196($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_49 +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 224($sp) +# IFGoto result_48 -> label_6 +lw $t0, 196($sp) +lw $a0, 16($t0) +bnez $a0, label_6 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 228($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 232($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 236($sp) +#SetAttr Boardrows = instance_56 +lw $t0, 484($sp) +lw $t1, 228($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 244($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 248($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 252($sp) +#SetAttr Boardcolumns = instance_60 +lw $t0, 484($sp) +lw $t1, 244($sp) +sw $t1, 20($t0) +#SetAttr Boardboard_size = size_1 +lw $t0, 484($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +#AssignNode result_47 = size_1 +lw $t1, 8($sp) +sw $t1, 192($sp) +#Goto label_7 +b label_7 +#LabelNode label_6 +label_6: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 264($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 268($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_66 +lw $t1, 268($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_65 +lw $t1, 264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 272($sp) +#SetAttr Boardrows = instance_65 +lw $t0, 484($sp) +lw $t1, 264($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 280($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 284($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_70 +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 288($sp) +#SetAttr Boardcolumns = instance_69 +lw $t0, 484($sp) +lw $t1, 280($sp) +sw $t1, 20($t0) +#SetAttr Boardboard_size = size_1 +lw $t0, 484($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +#AssignNode result_47 = size_1 +lw $t1, 8($sp) +sw $t1, 192($sp) +#LabelNode label_7 +label_7: +#AssignNode result_38 = result_47 +lw $t1, 192($sp) +sw $t1, 156($sp) +#Goto label_8 +b label_8 +#LabelNode label_5 +label_5: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 300($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 304($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_75 +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 308($sp) +#SetAttr Boardrows = instance_74 +lw $t0, 484($sp) +lw $t1, 300($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 316($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 320($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_79 +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 324($sp) +#SetAttr Boardcolumns = instance_78 +lw $t0, 484($sp) +lw $t1, 316($sp) +sw $t1, 20($t0) +#SetAttr Boardboard_size = size_1 +lw $t0, 484($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +#AssignNode result_38 = size_1 +lw $t1, 8($sp) +sw $t1, 156($sp) +#LabelNode label_8 +label_8: +#AssignNode result_29 = result_38 +lw $t1, 156($sp) +sw $t1, 120($sp) +#Goto label_9 +b label_9 +#LabelNode label_4 +label_4: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 336($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 340($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_84 +lw $t1, 340($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 344($sp) +#SetAttr Boardrows = instance_83 +lw $t0, 484($sp) +lw $t1, 336($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 352($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 356($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_88 +lw $t1, 356($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_87 +lw $t1, 352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 360($sp) +#SetAttr Boardcolumns = instance_87 +lw $t0, 484($sp) +lw $t1, 352($sp) +sw $t1, 20($t0) +#SetAttr Boardboard_size = size_1 +lw $t0, 484($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +#AssignNode result_29 = size_1 +lw $t1, 8($sp) +sw $t1, 120($sp) +#LabelNode label_9 +label_9: +#AssignNode result_20 = result_29 +lw $t1, 120($sp) +sw $t1, 84($sp) +#Goto label_10 +b label_10 +#LabelNode label_3 +label_3: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 372($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 376($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_93 +lw $t1, 376($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 380($sp) +#SetAttr Boardrows = instance_92 +lw $t0, 484($sp) +lw $t1, 372($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 388($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 392($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_96 +lw $t1, 388($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 396($sp) +#SetAttr Boardcolumns = instance_96 +lw $t0, 484($sp) +lw $t1, 388($sp) +sw $t1, 20($t0) +#SetAttr Boardboard_size = size_1 +lw $t0, 484($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +#AssignNode result_20 = size_1 +lw $t1, 8($sp) +sw $t1, 84($sp) +#LabelNode label_10 +label_10: +#AssignNode result_11 = result_20 +lw $t1, 84($sp) +sw $t1, 48($sp) +#Goto label_11 +b label_11 +#LabelNode label_2 +label_2: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 408($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 412($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_102 +lw $t1, 412($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 416($sp) +#SetAttr Boardrows = instance_101 +lw $t0, 484($sp) +lw $t1, 408($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 424($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 428($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_105 +lw $t1, 424($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 432($sp) +#SetAttr Boardcolumns = instance_105 +lw $t0, 484($sp) +lw $t1, 424($sp) +sw $t1, 20($t0) +#SetAttr Boardboard_size = size_1 +lw $t0, 484($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +#AssignNode result_11 = size_1 +lw $t1, 8($sp) +sw $t1, 48($sp) +#LabelNode label_11 +label_11: +#AssignNode result_2 = result_11 +lw $t1, 48($sp) +sw $t1, 12($sp) +#Goto label_12 +b label_12 +#LabelNode label_1 +label_1: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 444($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 448($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_111 +lw $t1, 448($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 452($sp) +#SetAttr Boardrows = instance_110 +lw $t0, 484($sp) +lw $t1, 444($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 460($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 464($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_115 +lw $t1, 464($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_114 +lw $t1, 460($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 468($sp) +#SetAttr Boardcolumns = instance_114 +lw $t0, 484($sp) +lw $t1, 460($sp) +sw $t1, 20($t0) +#SetAttr Boardboard_size = size_1 +lw $t0, 484($sp) +lw $t1, 8($sp) +sw $t1, 24($t0) +#AssignNode result_2 = size_1 +lw $t1, 8($sp) +sw $t1, 12($sp) +#LabelNode label_12 +label_12: +#AssignNode result_119 = self +lw $t1, 484($sp) +sw $t1, 480($sp) +#Return result_119 +lw $a1, 480($sp) +lw $ra, 0($sp) +addi $sp, $sp, 492 +jr $ra +CellularAutomaton_init: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Board_init +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Board_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#SetAttr CellularAutomatonpopulation_map = instance_1 +lw $t0, 20($sp) +lw $t1, 8($sp) +sw $t1, 28($t0) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +CellularAutomaton.init: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr CellularAutomatonpopulation_map = map +lw $t0, 12($sp) +lw $t1, 16($sp) +sw $t1, 28($t0) +#VCall board_init +move $t0, $sp +# Arg map +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 32($t2) +jal $t3 +sw $a1, 8($sp) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +CellularAutomaton.print: +addi $sp, $sp, -148 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode i_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#GetAttr CellularAutomaton.board_size = CellularAutomaton.board_size +lw $t0, 152($sp) +lw $t1, 24($t0) +sw $t1, 20($sp) +#AssignNode num_5 = CellularAutomaton.board_size +lw $t1, 20($sp) +sw $t1, 24($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 32($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode String_init +move $t0, $sp +# Arg l_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 40($sp) +#VCall out_string +move $t0, $sp +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 152($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 28($sp) +#LabelNode label_13 +label_13: +#GetAttr left_13 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 < right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +slt $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 64($sp) +# IFGoto result_11 -> label_14 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_14 +#Goto label_15 +b label_15 +#LabelNode label_14 +label_14: +#GetAttr CellularAutomaton.population_map = CellularAutomaton.population_map +lw $t0, 152($sp) +lw $t1, 28($t0) +sw $t1, 76($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 152($sp) +lw $t1, 20($t0) +sw $t1, 116($sp) +#VCall substr +move $t0, $sp +# Arg CellularAutomaton.columns +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg CellularAutomaton.population_map +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 76($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 72($sp) +#VCall out_string +move $t0, $sp +# Arg result_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 152($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 68($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 88($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#CallNode String_init +move $t0, $sp +# Arg l_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 96($sp) +#VCall out_string +move $t0, $sp +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 152($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 84($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 152($sp) +lw $t1, 20($t0) +sw $t1, 116($sp) +#GetAttr left_26 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#GetAttr right_27 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#BinaryOperator left_26 + right_27 +lw $a0, 108($sp) +lw $t1, 112($sp) +add $a0, $a0, $t1 +sw $a0, 104($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 120($sp) +#AssignNode i_3 = result_24 +lw $t1, 100($sp) +sw $t1, 16($sp) +#Goto label_13 +b label_13 +#LabelNode label_15 +label_15: +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 132($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#CallNode String_init +move $t0, $sp +# Arg l_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 140($sp) +#VCall out_string +move $t0, $sp +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 152($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 128($sp) +#AssignNode result_35 = self +lw $t1, 152($sp) +sw $t1, 144($sp) +#AssignNode result_36 = result_35 +lw $t1, 144($sp) +sw $t1, 148($sp) +#Return result_36 +lw $a1, 148($sp) +lw $ra, 0($sp) +addi $sp, $sp, 156 +jr $ra +CellularAutomaton.num_cells: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.population_map = CellularAutomaton.population_map +lw $t0, 12($sp) +lw $t1, 28($t0) +sw $t1, 8($sp) +#VCall length +move $t0, $sp +# Arg CellularAutomaton.population_map +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +CellularAutomaton.cell: +addi $sp, $sp, -92 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.board_size = CellularAutomaton.board_size +lw $t0, 96($sp) +lw $t1, 24($t0) +sw $t1, 40($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 48($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 52($sp) +#GetAttr left_7 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#GetAttr right_8 = Int.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#BinaryOperator left_7 - right_8 +lw $a0, 32($sp) +lw $t1, 36($sp) +sub $a0, $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 56($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 60($sp) +# IFGoto result_1 -> label_16 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_16 +#GetAttr CellularAutomaton.population_map = CellularAutomaton.population_map +lw $t0, 96($sp) +lw $t1, 28($t0) +sw $t1, 68($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 80($sp) +#VCall substr +move $t0, $sp +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg position +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg CellularAutomaton.population_map +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 68($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 64($sp) +#AssignNode result_0 = result_15 +lw $t1, 64($sp) +sw $t1, 4($sp) +#Goto label_17 +b label_17 +#LabelNode label_16 +label_16: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 84($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode String_init +move $t0, $sp +# Arg l_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 92($sp) +#AssignNode result_0 = instance_21 +lw $t1, 88($sp) +sw $t1, 4($sp) +#LabelNode label_17 +label_17: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 104 +jr $ra +CellularAutomaton.north: +addi $sp, $sp, -100 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 104($sp) +lw $t1, 20($t0) +sw $t1, 84($sp) +#GetAttr left_7 = Int.value +lw $t0, 108($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#GetAttr right_8 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#BinaryOperator left_7 - right_8 +lw $a0, 32($sp) +lw $t1, 36($sp) +sub $a0, $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 52($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 56($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 60($sp) +# IFGoto result_1 -> label_18 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_18 +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 104($sp) +lw $t1, 20($t0) +sw $t1, 84($sp) +#GetAttr left_18 = Int.value +lw $t0, 108($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 - right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +sub $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 88($sp) +#VCall cell +move $t0, $sp +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 64($sp) +#AssignNode result_0 = result_15 +lw $t1, 64($sp) +sw $t1, 4($sp) +#Goto label_19 +b label_19 +#LabelNode label_18 +label_18: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 92($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#CallNode String_init +move $t0, $sp +# Arg l_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 100($sp) +#AssignNode result_0 = instance_23 +lw $t1, 96($sp) +sw $t1, 4($sp) +#LabelNode label_19 +label_19: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 112 +jr $ra +CellularAutomaton.south: +addi $sp, $sp, -92 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.board_size = CellularAutomaton.board_size +lw $t0, 96($sp) +lw $t1, 24($t0) +sw $t1, 24($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 96($sp) +lw $t1, 20($t0) +sw $t1, 76($sp) +#GetAttr left_8 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr right_9 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 40($sp) +#BinaryOperator left_8 + right_9 +lw $a0, 36($sp) +lw $t1, 40($sp) +add $a0, $a0, $t1 +sw $a0, 32($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 48($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 52($sp) +# IFGoto result_1 -> label_20 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_20 +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 96($sp) +lw $t1, 20($t0) +sw $t1, 76($sp) +#GetAttr left_16 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#GetAttr right_17 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 72($sp) +#BinaryOperator left_16 + right_17 +lw $a0, 68($sp) +lw $t1, 72($sp) +add $a0, $a0, $t1 +sw $a0, 64($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 80($sp) +#VCall cell +move $t0, $sp +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 96($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 56($sp) +#AssignNode result_0 = result_13 +lw $t1, 56($sp) +sw $t1, 4($sp) +#Goto label_21 +b label_21 +#LabelNode label_20 +label_20: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 84($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode String_init +move $t0, $sp +# Arg l_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 92($sp) +#AssignNode result_0 = instance_21 +lw $t1, 88($sp) +sw $t1, 4($sp) +#LabelNode label_21 +label_21: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 104 +jr $ra +CellularAutomaton.east: +addi $sp, $sp, -184 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 80($sp) +#GetAttr left_15 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 64($sp) +#GetAttr right_16 = Int.value +lw $t0, 72($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#BinaryOperator left_15 + right_16 +lw $a0, 64($sp) +lw $t1, 68($sp) +add $a0, $a0, $t1 +sw $a0, 60($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 56($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 84($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 188($sp) +lw $t1, 20($t0) +sw $t1, 96($sp) +#GetAttr left_11 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#GetAttr right_12 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#BinaryOperator left_11 / right_12 +lw $a0, 48($sp) +lw $t1, 52($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 92($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 188($sp) +lw $t1, 20($t0) +sw $t1, 96($sp) +#GetAttr left_7 = Int.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#GetAttr right_8 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#BinaryOperator left_7 * right_8 +lw $a0, 32($sp) +lw $t1, 36($sp) +mul $a0, $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 100($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 124($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 128($sp) +#GetAttr left_27 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#GetAttr right_28 = Int.value +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#BinaryOperator left_27 + right_28 +lw $a0, 112($sp) +lw $t1, 116($sp) +add $a0, $a0, $t1 +sw $a0, 108($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 104($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 136($sp) +# IFGoto result_1 -> label_22 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_22 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 160($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 164($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 168($sp) +#GetAttr left_37 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 152($sp) +#GetAttr right_38 = Int.value +lw $t0, 160($sp) +lw $t1, 16($t0) +sw $t1, 156($sp) +#BinaryOperator left_37 + right_38 +lw $a0, 152($sp) +lw $t1, 156($sp) +add $a0, $a0, $t1 +sw $a0, 148($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 172($sp) +#VCall cell +move $t0, $sp +# Arg result_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 188($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 140($sp) +#AssignNode result_0 = result_34 +lw $t1, 140($sp) +sw $t1, 4($sp) +#Goto label_23 +b label_23 +#LabelNode label_22 +label_22: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 176($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 180($sp) +#CallNode String_init +move $t0, $sp +# Arg l_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 184($sp) +#AssignNode result_0 = instance_44 +lw $t1, 180($sp) +sw $t1, 4($sp) +#LabelNode label_23 +label_23: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 196 +jr $ra +CellularAutomaton.west: +addi $sp, $sp, -168 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#GetAttr left_3 = Int.value +lw $t0, 176($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 36($sp) +# IFGoto result_1 -> label_24 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_24 +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 172($sp) +lw $t1, 20($t0) +sw $t1, 100($sp) +#GetAttr left_20 = Int.value +lw $t0, 176($sp) +lw $t1, 16($t0) +sw $t1, 84($sp) +#GetAttr right_21 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#BinaryOperator left_20 / right_21 +lw $a0, 84($sp) +lw $t1, 88($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 96($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 172($sp) +lw $t1, 20($t0) +sw $t1, 100($sp) +#GetAttr left_16 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#GetAttr right_17 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 72($sp) +#BinaryOperator left_16 * right_17 +lw $a0, 68($sp) +lw $t1, 72($sp) +mul $a0, $a0, $t1 +sw $a0, 64($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#GetAttr left_12 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr right_13 = Int.value +lw $t0, 176($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#BinaryOperator left_12 = right_13 +lw $a0, 52($sp) +lw $t1, 56($sp) +seq $a0, $a0, $t1 +sw $a0, 48($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_10 -> label_25 +lw $t0, 44($sp) +lw $a0, 16($t0) +bnez $a0, label_25 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 136($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#GetAttr left_30 = Int.value +lw $t0, 176($sp) +lw $t1, 16($t0) +sw $t1, 124($sp) +#GetAttr right_31 = Int.value +lw $t0, 132($sp) +lw $t1, 16($t0) +sw $t1, 128($sp) +#BinaryOperator left_30 - right_31 +lw $a0, 124($sp) +lw $t1, 128($sp) +sub $a0, $a0, $t1 +sw $a0, 120($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 144($sp) +#VCall cell +move $t0, $sp +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 172($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 112($sp) +#AssignNode result_9 = result_27 +lw $t1, 112($sp) +sw $t1, 40($sp) +#Goto label_26 +b label_26 +#LabelNode label_25 +label_25: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 148($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode String_init +move $t0, $sp +# Arg l_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 156($sp) +#AssignNode result_9 = instance_37 +lw $t1, 152($sp) +sw $t1, 40($sp) +#LabelNode label_26 +label_26: +#AssignNode result_0 = result_9 +lw $t1, 40($sp) +sw $t1, 4($sp) +#Goto label_27 +b label_27 +#LabelNode label_24 +label_24: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 160($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 164($sp) +#CallNode String_init +move $t0, $sp +# Arg l_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 168($sp) +#AssignNode result_0 = instance_40 +lw $t1, 164($sp) +sw $t1, 4($sp) +#LabelNode label_27 +label_27: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 180 +jr $ra +CellularAutomaton.northwest: +addi $sp, $sp, -192 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 196($sp) +lw $t1, 20($t0) +sw $t1, 124($sp) +#GetAttr left_7 = Int.value +lw $t0, 200($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#GetAttr right_8 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#BinaryOperator left_7 - right_8 +lw $a0, 32($sp) +lw $t1, 36($sp) +sub $a0, $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 52($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 56($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 60($sp) +# IFGoto result_1 -> label_28 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_28 +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 196($sp) +lw $t1, 20($t0) +sw $t1, 124($sp) +#GetAttr left_26 = Int.value +lw $t0, 200($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#GetAttr right_27 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#BinaryOperator left_26 / right_27 +lw $a0, 108($sp) +lw $t1, 112($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 104($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 120($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 196($sp) +lw $t1, 20($t0) +sw $t1, 124($sp) +#GetAttr left_22 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 * right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +mul $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 128($sp) +#GetAttr left_18 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 200($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 = right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +seq $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 132($sp) +# IFGoto result_16 -> label_29 +lw $t0, 68($sp) +lw $a0, 16($t0) +bnez $a0, label_29 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 156($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 160($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 164($sp) +#GetAttr left_36 = Int.value +lw $t0, 200($sp) +lw $t1, 16($t0) +sw $t1, 148($sp) +#GetAttr right_37 = Int.value +lw $t0, 156($sp) +lw $t1, 16($t0) +sw $t1, 152($sp) +#BinaryOperator left_36 - right_37 +lw $a0, 148($sp) +lw $t1, 152($sp) +sub $a0, $a0, $t1 +sw $a0, 144($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 140($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 168($sp) +#VCall north +move $t0, $sp +# Arg result_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 196($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 136($sp) +#AssignNode result_15 = result_33 +lw $t1, 136($sp) +sw $t1, 64($sp) +#Goto label_30 +b label_30 +#LabelNode label_29 +label_29: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 172($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 176($sp) +#CallNode String_init +move $t0, $sp +# Arg l_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 180($sp) +#AssignNode result_15 = instance_43 +lw $t1, 176($sp) +sw $t1, 64($sp) +#LabelNode label_30 +label_30: +#AssignNode result_0 = result_15 +lw $t1, 64($sp) +sw $t1, 4($sp) +#Goto label_31 +b label_31 +#LabelNode label_28 +label_28: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 184($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#CallNode String_init +move $t0, $sp +# Arg l_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 192($sp) +#AssignNode result_0 = instance_46 +lw $t1, 188($sp) +sw $t1, 4($sp) +#LabelNode label_31 +label_31: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 204 +jr $ra +CellularAutomaton.northeast: +addi $sp, $sp, -256 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 260($sp) +lw $t1, 20($t0) +sw $t1, 156($sp) +#GetAttr left_7 = Int.value +lw $t0, 264($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#GetAttr right_8 = Int.value +lw $t0, 156($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#BinaryOperator left_7 - right_8 +lw $a0, 32($sp) +lw $t1, 36($sp) +sub $a0, $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 44($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 52($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 56($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 60($sp) +# IFGoto result_1 -> label_32 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_32 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 136($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 140($sp) +#GetAttr left_30 = Int.value +lw $t0, 264($sp) +lw $t1, 16($t0) +sw $t1, 124($sp) +#GetAttr right_31 = Int.value +lw $t0, 132($sp) +lw $t1, 16($t0) +sw $t1, 128($sp) +#BinaryOperator left_30 + right_31 +lw $a0, 124($sp) +lw $t1, 128($sp) +add $a0, $a0, $t1 +sw $a0, 120($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 116($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 144($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 260($sp) +lw $t1, 20($t0) +sw $t1, 156($sp) +#GetAttr left_26 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#GetAttr right_27 = Int.value +lw $t0, 156($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#BinaryOperator left_26 / right_27 +lw $a0, 108($sp) +lw $t1, 112($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 104($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 152($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 260($sp) +lw $t1, 20($t0) +sw $t1, 156($sp) +#GetAttr left_22 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 156($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 * right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +mul $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 160($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 180($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 184($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 188($sp) +#GetAttr left_42 = Int.value +lw $t0, 264($sp) +lw $t1, 16($t0) +sw $t1, 172($sp) +#GetAttr right_43 = Int.value +lw $t0, 180($sp) +lw $t1, 16($t0) +sw $t1, 176($sp) +#BinaryOperator left_42 + right_43 +lw $a0, 172($sp) +lw $t1, 176($sp) +add $a0, $a0, $t1 +sw $a0, 168($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 164($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 192($sp) +#GetAttr left_18 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 = right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +seq $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 196($sp) +# IFGoto result_16 -> label_33 +lw $t0, 68($sp) +lw $a0, 16($t0) +bnez $a0, label_33 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 220($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 224($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 228($sp) +#GetAttr left_52 = Int.value +lw $t0, 264($sp) +lw $t1, 16($t0) +sw $t1, 212($sp) +#GetAttr right_53 = Int.value +lw $t0, 220($sp) +lw $t1, 16($t0) +sw $t1, 216($sp) +#BinaryOperator left_52 + right_53 +lw $a0, 212($sp) +lw $t1, 216($sp) +add $a0, $a0, $t1 +sw $a0, 208($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 204($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 232($sp) +#VCall north +move $t0, $sp +# Arg result_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 260($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 200($sp) +#AssignNode result_15 = result_49 +lw $t1, 200($sp) +sw $t1, 64($sp) +#Goto label_34 +b label_34 +#LabelNode label_33 +label_33: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 236($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 240($sp) +#CallNode String_init +move $t0, $sp +# Arg l_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 244($sp) +#AssignNode result_15 = instance_59 +lw $t1, 240($sp) +sw $t1, 64($sp) +#LabelNode label_34 +label_34: +#AssignNode result_0 = result_15 +lw $t1, 64($sp) +sw $t1, 4($sp) +#Goto label_35 +b label_35 +#LabelNode label_32 +label_32: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 248($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#CallNode String_init +move $t0, $sp +# Arg l_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 256($sp) +#AssignNode result_0 = instance_62 +lw $t1, 252($sp) +sw $t1, 4($sp) +#LabelNode label_35 +label_35: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 268 +jr $ra +CellularAutomaton.southeast: +addi $sp, $sp, -248 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.board_size = CellularAutomaton.board_size +lw $t0, 252($sp) +lw $t1, 24($t0) +sw $t1, 24($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 252($sp) +lw $t1, 20($t0) +sw $t1, 148($sp) +#GetAttr left_8 = Int.value +lw $t0, 256($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr right_9 = Int.value +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 40($sp) +#BinaryOperator left_8 + right_9 +lw $a0, 36($sp) +lw $t1, 40($sp) +add $a0, $a0, $t1 +sw $a0, 32($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 48($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 52($sp) +# IFGoto result_1 -> label_36 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_36 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 128($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 132($sp) +#GetAttr left_28 = Int.value +lw $t0, 256($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#GetAttr right_29 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 120($sp) +#BinaryOperator left_28 + right_29 +lw $a0, 116($sp) +lw $t1, 120($sp) +add $a0, $a0, $t1 +sw $a0, 112($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 108($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 136($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 252($sp) +lw $t1, 20($t0) +sw $t1, 148($sp) +#GetAttr left_24 = Int.value +lw $t0, 108($sp) +lw $t1, 16($t0) +sw $t1, 100($sp) +#GetAttr right_25 = Int.value +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 104($sp) +#BinaryOperator left_24 / right_25 +lw $a0, 100($sp) +lw $t1, 104($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 96($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 144($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 252($sp) +lw $t1, 20($t0) +sw $t1, 148($sp) +#GetAttr left_20 = Int.value +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 84($sp) +#GetAttr right_21 = Int.value +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#BinaryOperator left_20 * right_21 +lw $a0, 84($sp) +lw $t1, 88($sp) +mul $a0, $a0, $t1 +sw $a0, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 152($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 176($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 180($sp) +#GetAttr left_40 = Int.value +lw $t0, 256($sp) +lw $t1, 16($t0) +sw $t1, 164($sp) +#GetAttr right_41 = Int.value +lw $t0, 172($sp) +lw $t1, 16($t0) +sw $t1, 168($sp) +#BinaryOperator left_40 + right_41 +lw $a0, 164($sp) +lw $t1, 168($sp) +add $a0, $a0, $t1 +sw $a0, 160($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 156($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 184($sp) +#GetAttr left_16 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#GetAttr right_17 = Int.value +lw $t0, 156($sp) +lw $t1, 16($t0) +sw $t1, 72($sp) +#BinaryOperator left_16 = right_17 +lw $a0, 68($sp) +lw $t1, 72($sp) +seq $a0, $a0, $t1 +sw $a0, 64($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 188($sp) +# IFGoto result_14 -> label_37 +lw $t0, 60($sp) +lw $a0, 16($t0) +bnez $a0, label_37 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 212($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 216($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 220($sp) +#GetAttr left_50 = Int.value +lw $t0, 256($sp) +lw $t1, 16($t0) +sw $t1, 204($sp) +#GetAttr right_51 = Int.value +lw $t0, 212($sp) +lw $t1, 16($t0) +sw $t1, 208($sp) +#BinaryOperator left_50 + right_51 +lw $a0, 204($sp) +lw $t1, 208($sp) +add $a0, $a0, $t1 +sw $a0, 200($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 196($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_49 +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 224($sp) +#VCall south +move $t0, $sp +# Arg result_48 +lw $t1, 196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 252($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 192($sp) +#AssignNode result_13 = result_47 +lw $t1, 192($sp) +sw $t1, 56($sp) +#Goto label_38 +b label_38 +#LabelNode label_37 +label_37: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 228($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 232($sp) +#CallNode String_init +move $t0, $sp +# Arg l_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 236($sp) +#AssignNode result_13 = instance_57 +lw $t1, 232($sp) +sw $t1, 56($sp) +#LabelNode label_38 +label_38: +#AssignNode result_0 = result_13 +lw $t1, 56($sp) +sw $t1, 4($sp) +#Goto label_39 +b label_39 +#LabelNode label_36 +label_36: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 240($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 244($sp) +#CallNode String_init +move $t0, $sp +# Arg l_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 248($sp) +#AssignNode result_0 = instance_60 +lw $t1, 244($sp) +sw $t1, 4($sp) +#LabelNode label_39 +label_39: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 260 +jr $ra +CellularAutomaton.southwest: +addi $sp, $sp, -184 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr CellularAutomaton.board_size = CellularAutomaton.board_size +lw $t0, 188($sp) +lw $t1, 24($t0) +sw $t1, 24($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 188($sp) +lw $t1, 20($t0) +sw $t1, 116($sp) +#GetAttr left_8 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr right_9 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 40($sp) +#BinaryOperator left_8 + right_9 +lw $a0, 36($sp) +lw $t1, 40($sp) +add $a0, $a0, $t1 +sw $a0, 32($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 48($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 52($sp) +# IFGoto result_1 -> label_40 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_40 +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 188($sp) +lw $t1, 20($t0) +sw $t1, 116($sp) +#GetAttr left_24 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 100($sp) +#GetAttr right_25 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 104($sp) +#BinaryOperator left_24 / right_25 +lw $a0, 100($sp) +lw $t1, 104($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 96($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#GetAttr CellularAutomaton.columns = CellularAutomaton.columns +lw $t0, 188($sp) +lw $t1, 20($t0) +sw $t1, 116($sp) +#GetAttr left_20 = Int.value +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 84($sp) +#GetAttr right_21 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#BinaryOperator left_20 * right_21 +lw $a0, 84($sp) +lw $t1, 88($sp) +mul $a0, $a0, $t1 +sw $a0, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 120($sp) +#GetAttr left_16 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 68($sp) +#GetAttr right_17 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 72($sp) +#BinaryOperator left_16 = right_17 +lw $a0, 68($sp) +lw $t1, 72($sp) +seq $a0, $a0, $t1 +sw $a0, 64($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 124($sp) +# IFGoto result_14 -> label_41 +lw $t0, 60($sp) +lw $a0, 16($t0) +bnez $a0, label_41 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 148($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 152($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 156($sp) +#GetAttr left_34 = Int.value +lw $t0, 192($sp) +lw $t1, 16($t0) +sw $t1, 140($sp) +#GetAttr right_35 = Int.value +lw $t0, 148($sp) +lw $t1, 16($t0) +sw $t1, 144($sp) +#BinaryOperator left_34 - right_35 +lw $a0, 140($sp) +lw $t1, 144($sp) +sub $a0, $a0, $t1 +sw $a0, 136($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 132($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 160($sp) +#VCall south +move $t0, $sp +# Arg result_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 188($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 128($sp) +#AssignNode result_13 = result_31 +lw $t1, 128($sp) +sw $t1, 56($sp) +#Goto label_42 +b label_42 +#LabelNode label_41 +label_41: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 164($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 168($sp) +#CallNode String_init +move $t0, $sp +# Arg l_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 172($sp) +#AssignNode result_13 = instance_41 +lw $t1, 168($sp) +sw $t1, 56($sp) +#LabelNode label_42 +label_42: +#AssignNode result_0 = result_13 +lw $t1, 56($sp) +sw $t1, 4($sp) +#Goto label_43 +b label_43 +#LabelNode label_40 +label_40: +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 176($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 180($sp) +#CallNode String_init +move $t0, $sp +# Arg l_43 +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_44 +lw $t1, 180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 184($sp) +#AssignNode result_0 = instance_44 +lw $t1, 180($sp) +sw $t1, 4($sp) +#LabelNode label_43 +label_43: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 196 +jr $ra +CellularAutomaton.neighbors: +addi $sp, $sp, -652 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall north +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 136($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 140($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#CallNode String_init +move $t0, $sp +# Arg l_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 148($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 124($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 152($sp) +# IFGoto result_29 -> label_44 +lw $t0, 120($sp) +lw $a0, 16($t0) +bnez $a0, label_44 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 156($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 160($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 164($sp) +#AssignNode result_28 = instance_38 +lw $t1, 156($sp) +sw $t1, 116($sp) +#Goto label_45 +b label_45 +#LabelNode label_44 +label_44: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 168($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 172($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 176($sp) +#AssignNode result_28 = instance_41 +lw $t1, 168($sp) +sw $t1, 116($sp) +#LabelNode label_45 +label_45: +#VCall south +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 200($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 204($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 208($sp) +#CallNode String_init +move $t0, $sp +# Arg l_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 212($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_49 +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 188($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 184($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 216($sp) +# IFGoto result_45 -> label_46 +lw $t0, 184($sp) +lw $a0, 16($t0) +bnez $a0, label_46 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 220($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 224($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_55 +lw $t1, 224($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 228($sp) +#AssignNode result_44 = instance_54 +lw $t1, 220($sp) +sw $t1, 180($sp) +#Goto label_47 +b label_47 +#LabelNode label_46 +label_46: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 232($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 236($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 240($sp) +#AssignNode result_44 = instance_57 +lw $t1, 232($sp) +sw $t1, 180($sp) +#LabelNode label_47 +label_47: +#GetAttr left_26 = Int.value +lw $t0, 116($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#GetAttr right_27 = Int.value +lw $t0, 180($sp) +lw $t1, 16($t0) +sw $t1, 112($sp) +#BinaryOperator left_26 + right_27 +lw $a0, 108($sp) +lw $t1, 112($sp) +add $a0, $a0, $t1 +sw $a0, 104($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 244($sp) +#VCall east +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 60($t2) +jal $t3 +sw $a1, 268($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 272($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 276($sp) +#CallNode String_init +move $t0, $sp +# Arg l_67 +lw $t1, 272($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 280($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_68 +lw $t1, 276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_66 +lw $t1, 268($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 256($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 284($sp) +# IFGoto result_62 -> label_48 +lw $t0, 252($sp) +lw $a0, 16($t0) +bnez $a0, label_48 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 288($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 292($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_72 +lw $t1, 292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_71 +lw $t1, 288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 296($sp) +#AssignNode result_61 = instance_71 +lw $t1, 288($sp) +sw $t1, 248($sp) +#Goto label_49 +b label_49 +#LabelNode label_48 +label_48: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 300($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 304($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_75 +lw $t1, 304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 308($sp) +#AssignNode result_61 = instance_74 +lw $t1, 300($sp) +sw $t1, 248($sp) +#LabelNode label_49 +label_49: +#GetAttr left_22 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#GetAttr right_23 = Int.value +lw $t0, 248($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#BinaryOperator left_22 + right_23 +lw $a0, 92($sp) +lw $t1, 96($sp) +add $a0, $a0, $t1 +sw $a0, 88($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 312($sp) +#VCall west +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 64($t2) +jal $t3 +sw $a1, 336($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 340($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 344($sp) +#CallNode String_init +move $t0, $sp +# Arg l_84 +lw $t1, 340($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_85 +lw $t1, 344($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 348($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_85 +lw $t1, 344($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 324($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 320($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_80 +lw $t1, 324($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_79 +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 352($sp) +# IFGoto result_79 -> label_50 +lw $t0, 320($sp) +lw $a0, 16($t0) +bnez $a0, label_50 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 356($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 360($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_89 +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_88 +lw $t1, 356($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 364($sp) +#AssignNode result_78 = instance_88 +lw $t1, 356($sp) +sw $t1, 316($sp) +#Goto label_51 +b label_51 +#LabelNode label_50 +label_50: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 368($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 372($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_92 +lw $t1, 372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 376($sp) +#AssignNode result_78 = instance_91 +lw $t1, 368($sp) +sw $t1, 316($sp) +#LabelNode label_51 +label_51: +#GetAttr left_18 = Int.value +lw $t0, 84($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#GetAttr right_19 = Int.value +lw $t0, 316($sp) +lw $t1, 16($t0) +sw $t1, 80($sp) +#BinaryOperator left_18 + right_19 +lw $a0, 76($sp) +lw $t1, 80($sp) +add $a0, $a0, $t1 +sw $a0, 72($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 380($sp) +#VCall northeast +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 72($t2) +jal $t3 +sw $a1, 404($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 408($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 412($sp) +#CallNode String_init +move $t0, $sp +# Arg l_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_102 +lw $t1, 412($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 416($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_102 +lw $t1, 412($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 392($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 388($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_96 +lw $t1, 388($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 420($sp) +# IFGoto result_96 -> label_52 +lw $t0, 388($sp) +lw $a0, 16($t0) +bnez $a0, label_52 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 424($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 428($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_106 +lw $t1, 428($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_105 +lw $t1, 424($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 432($sp) +#AssignNode result_95 = instance_105 +lw $t1, 424($sp) +sw $t1, 384($sp) +#Goto label_53 +b label_53 +#LabelNode label_52 +label_52: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 436($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 440($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_108 +lw $t1, 436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 444($sp) +#AssignNode result_95 = instance_108 +lw $t1, 436($sp) +sw $t1, 384($sp) +#LabelNode label_53 +label_53: +#GetAttr left_14 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#GetAttr right_15 = Int.value +lw $t0, 384($sp) +lw $t1, 16($t0) +sw $t1, 64($sp) +#BinaryOperator left_14 + right_15 +lw $a0, 60($sp) +lw $t1, 64($sp) +add $a0, $a0, $t1 +sw $a0, 56($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 52($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 448($sp) +#VCall northwest +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 68($t2) +jal $t3 +sw $a1, 472($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 476($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 480($sp) +#CallNode String_init +move $t0, $sp +# Arg l_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 484($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_119 +lw $t1, 480($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_117 +lw $t1, 472($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 460($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 456($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_114 +lw $t1, 460($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 488($sp) +# IFGoto result_113 -> label_54 +lw $t0, 456($sp) +lw $a0, 16($t0) +bnez $a0, label_54 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 492($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 496($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_123 +lw $t1, 496($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 500($sp) +#AssignNode result_112 = instance_122 +lw $t1, 492($sp) +sw $t1, 452($sp) +#Goto label_55 +b label_55 +#LabelNode label_54 +label_54: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 504($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 508($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_126 +lw $t1, 508($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_125 +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 512($sp) +#AssignNode result_112 = instance_125 +lw $t1, 504($sp) +sw $t1, 452($sp) +#LabelNode label_55 +label_55: +#GetAttr left_10 = Int.value +lw $t0, 52($sp) +lw $t1, 16($t0) +sw $t1, 44($sp) +#GetAttr right_11 = Int.value +lw $t0, 452($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#BinaryOperator left_10 + right_11 +lw $a0, 44($sp) +lw $t1, 48($sp) +add $a0, $a0, $t1 +sw $a0, 40($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 516($sp) +#VCall southeast +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 76($t2) +jal $t3 +sw $a1, 540($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 544($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 548($sp) +#CallNode String_init +move $t0, $sp +# Arg l_135 +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_136 +lw $t1, 548($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 552($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_136 +lw $t1, 548($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_134 +lw $t1, 540($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 528($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 524($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_131 +lw $t1, 528($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_130 +lw $t1, 524($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 556($sp) +# IFGoto result_130 -> label_56 +lw $t0, 524($sp) +lw $a0, 16($t0) +bnez $a0, label_56 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 560($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 564($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_140 +lw $t1, 564($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_139 +lw $t1, 560($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 568($sp) +#AssignNode result_129 = instance_139 +lw $t1, 560($sp) +sw $t1, 520($sp) +#Goto label_57 +b label_57 +#LabelNode label_56 +label_56: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 572($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 576($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_143 +lw $t1, 576($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_142 +lw $t1, 572($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 580($sp) +#AssignNode result_129 = instance_142 +lw $t1, 572($sp) +sw $t1, 520($sp) +#LabelNode label_57 +label_57: +#GetAttr left_6 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 28($sp) +#GetAttr right_7 = Int.value +lw $t0, 520($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#BinaryOperator left_6 + right_7 +lw $a0, 28($sp) +lw $t1, 32($sp) +add $a0, $a0, $t1 +sw $a0, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 584($sp) +#VCall southwest +move $t0, $sp +# Arg position +lw $t1, 660($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 656($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 656($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 80($t2) +jal $t3 +sw $a1, 608($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 612($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 616($sp) +#CallNode String_init +move $t0, $sp +# Arg l_152 +lw $t1, 612($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_153 +lw $t1, 616($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 620($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_153 +lw $t1, 616($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_151 +lw $t1, 608($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 596($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 592($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_148 +lw $t1, 596($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_147 +lw $t1, 592($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 624($sp) +# IFGoto result_147 -> label_58 +lw $t0, 592($sp) +lw $a0, 16($t0) +bnez $a0, label_58 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 628($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 632($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_157 +lw $t1, 632($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_156 +lw $t1, 628($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 636($sp) +#AssignNode result_146 = instance_156 +lw $t1, 628($sp) +sw $t1, 588($sp) +#Goto label_59 +b label_59 +#LabelNode label_58 +label_58: +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 640($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 644($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_160 +lw $t1, 644($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_159 +lw $t1, 640($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 648($sp) +#AssignNode result_146 = instance_159 +lw $t1, 640($sp) +sw $t1, 588($sp) +#LabelNode label_59 +label_59: +#GetAttr left_2 = Int.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 588($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 + right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +add $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 652($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 664 +jr $ra +CellularAutomaton.cell_at_next_evolution: +addi $sp, $sp, -168 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall neighbors +move $t0, $sp +# Arg position +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 172($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 84($t2) +jal $t3 +sw $a1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_1 -> label_60 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_60 +#VCall neighbors +move $t0, $sp +# Arg position +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 172($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 84($t2) +jal $t3 +sw $a1, 64($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#GetAttr left_13 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 80($sp) +# IFGoto result_11 -> label_61 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_61 +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 84($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode String_init +move $t0, $sp +# Arg l_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 92($sp) +#AssignNode result_10 = instance_21 +lw $t1, 88($sp) +sw $t1, 44($sp) +#Goto label_62 +b label_62 +#LabelNode label_61 +label_61: +#VCall cell +move $t0, $sp +# Arg position +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 172($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 116($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 120($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#CallNode String_init +move $t0, $sp +# Arg l_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 128($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 104($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 132($sp) +# IFGoto result_24 -> label_63 +lw $t0, 100($sp) +lw $a0, 16($t0) +bnez $a0, label_63 +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 136($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 140($sp) +#CallNode String_init +move $t0, $sp +# Arg l_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 144($sp) +#AssignNode result_23 = instance_34 +lw $t1, 140($sp) +sw $t1, 96($sp) +#Goto label_64 +b label_64 +#LabelNode label_63 +label_63: +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 148($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode String_init +move $t0, $sp +# Arg l_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 156($sp) +#AssignNode result_23 = instance_37 +lw $t1, 152($sp) +sw $t1, 96($sp) +#LabelNode label_64 +label_64: +#AssignNode result_10 = result_23 +lw $t1, 96($sp) +sw $t1, 44($sp) +#LabelNode label_62 +label_62: +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#Goto label_65 +b label_65 +#LabelNode label_60 +label_60: +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 160($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 164($sp) +#CallNode String_init +move $t0, $sp +# Arg l_39 +lw $t1, 160($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 168($sp) +#AssignNode result_0 = instance_40 +lw $t1, 164($sp) +sw $t1, 4($sp) +#LabelNode label_65 +label_65: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 180 +jr $ra +CellularAutomaton.evolve: +addi $sp, $sp, -128 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode position_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#VCall num_cells +move $t0, $sp +# Arg self +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 20($sp) +#AssignNode num_5 = result_4 +lw $t1, 20($sp) +sw $t1, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#AssignNode temp_9 = instance_6 +lw $t1, 28($sp) +sw $t1, 40($sp) +#LabelNode label_66 +label_66: +#GetAttr left_13 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 < right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +slt $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 64($sp) +# IFGoto result_11 -> label_67 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_67 +#Goto label_68 +b label_68 +#LabelNode label_67 +label_67: +#VCall cell_at_next_evolution +move $t0, $sp +# Arg position_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 132($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 88($t2) +jal $t3 +sw $a1, 72($sp) +#VCall concat +move $t0, $sp +# Arg result_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg temp_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 68($sp) +#AssignNode temp_9 = result_16 +lw $t1, 68($sp) +sw $t1, 40($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 96($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 100($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#GetAttr left_21 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#GetAttr right_22 = Int.value +lw $t0, 96($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#BinaryOperator left_21 + right_22 +lw $a0, 88($sp) +lw $t1, 92($sp) +add $a0, $a0, $t1 +sw $a0, 84($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#AssignNode position_3 = result_19 +lw $t1, 80($sp) +sw $t1, 16($sp) +#Goto label_66 +b label_66 +#LabelNode label_68 +label_68: +#SetAttr CellularAutomatonpopulation_map = temp_9 +lw $t0, 132($sp) +lw $t1, 40($sp) +sw $t1, 28($t0) +#AssignNode result_29 = self +lw $t1, 132($sp) +sw $t1, 120($sp) +#AssignNode result_30 = result_29 +lw $t1, 120($sp) +sw $t1, 124($sp) +#AssignNode result_31 = result_30 +lw $t1, 124($sp) +sw $t1, 128($sp) +#Return result_31 +lw $a1, 128($sp) +lw $ra, 0($sp) +addi $sp, $sp, 136 +jr $ra +CellularAutomaton.option: +addi $sp, $sp, -1432 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#AssignNode num_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#VCall out_string +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#LoadStr msg_7 +la $t0, msg_7 +sw $t0, 40($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode String_init +move $t0, $sp +# Arg l_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 48($sp) +#VCall out_string +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 36($sp) +#LoadStr msg_8 +la $t0, msg_8 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#LoadStr msg_9 +la $t0, msg_9 +sw $t0, 72($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode String_init +move $t0, $sp +# Arg l_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 80($sp) +#VCall out_string +move $t0, $sp +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 68($sp) +#LoadStr msg_10 +la $t0, msg_10 +sw $t0, 88($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#CallNode String_init +move $t0, $sp +# Arg l_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 96($sp) +#VCall out_string +move $t0, $sp +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 84($sp) +#LoadStr msg_11 +la $t0, msg_11 +sw $t0, 104($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 108($sp) +#CallNode String_init +move $t0, $sp +# Arg l_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 112($sp) +#VCall out_string +move $t0, $sp +# Arg instance_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 100($sp) +#LoadStr msg_12 +la $t0, msg_12 +sw $t0, 120($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#CallNode String_init +move $t0, $sp +# Arg l_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 128($sp) +#VCall out_string +move $t0, $sp +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 116($sp) +#LoadStr msg_13 +la $t0, msg_13 +sw $t0, 136($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 140($sp) +#CallNode String_init +move $t0, $sp +# Arg l_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 144($sp) +#VCall out_string +move $t0, $sp +# Arg instance_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 132($sp) +#LoadStr msg_14 +la $t0, msg_14 +sw $t0, 152($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 156($sp) +#CallNode String_init +move $t0, $sp +# Arg l_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 160($sp) +#VCall out_string +move $t0, $sp +# Arg instance_38 +lw $t1, 156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 148($sp) +#LoadStr msg_15 +la $t0, msg_15 +sw $t0, 168($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 172($sp) +#CallNode String_init +move $t0, $sp +# Arg l_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 176($sp) +#VCall out_string +move $t0, $sp +# Arg instance_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 164($sp) +#LoadStr msg_16 +la $t0, msg_16 +sw $t0, 184($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#CallNode String_init +move $t0, $sp +# Arg l_45 +lw $t1, 184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 192($sp) +#VCall out_string +move $t0, $sp +# Arg instance_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 180($sp) +#LoadStr msg_17 +la $t0, msg_17 +sw $t0, 200($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 204($sp) +#CallNode String_init +move $t0, $sp +# Arg l_49 +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 208($sp) +#VCall out_string +move $t0, $sp +# Arg instance_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 196($sp) +#LoadStr msg_18 +la $t0, msg_18 +sw $t0, 216($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 220($sp) +#CallNode String_init +move $t0, $sp +# Arg l_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 224($sp) +#VCall out_string +move $t0, $sp +# Arg instance_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 212($sp) +#LoadStr msg_19 +la $t0, msg_19 +sw $t0, 232($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 236($sp) +#CallNode String_init +move $t0, $sp +# Arg l_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 240($sp) +#VCall out_string +move $t0, $sp +# Arg instance_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 228($sp) +#LoadStr msg_20 +la $t0, msg_20 +sw $t0, 248($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 252($sp) +#CallNode String_init +move $t0, $sp +# Arg l_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 256($sp) +#VCall out_string +move $t0, $sp +# Arg instance_62 +lw $t1, 252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 244($sp) +#LoadStr msg_21 +la $t0, msg_21 +sw $t0, 264($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 268($sp) +#CallNode String_init +move $t0, $sp +# Arg l_65 +lw $t1, 264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_66 +lw $t1, 268($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 272($sp) +#VCall out_string +move $t0, $sp +# Arg instance_66 +lw $t1, 268($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 260($sp) +#LoadStr msg_22 +la $t0, msg_22 +sw $t0, 280($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 284($sp) +#CallNode String_init +move $t0, $sp +# Arg l_69 +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_70 +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 288($sp) +#VCall out_string +move $t0, $sp +# Arg instance_70 +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 276($sp) +#LoadStr msg_23 +la $t0, msg_23 +sw $t0, 296($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 300($sp) +#CallNode String_init +move $t0, $sp +# Arg l_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 304($sp) +#VCall out_string +move $t0, $sp +# Arg instance_74 +lw $t1, 300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 292($sp) +#LoadStr msg_24 +la $t0, msg_24 +sw $t0, 312($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 316($sp) +#CallNode String_init +move $t0, $sp +# Arg l_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 320($sp) +#VCall out_string +move $t0, $sp +# Arg instance_78 +lw $t1, 316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 308($sp) +#LoadStr msg_25 +la $t0, msg_25 +sw $t0, 328($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#CallNode String_init +move $t0, $sp +# Arg l_81 +lw $t1, 328($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 336($sp) +#VCall out_string +move $t0, $sp +# Arg instance_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 324($sp) +#LoadStr msg_26 +la $t0, msg_26 +sw $t0, 344($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 348($sp) +#CallNode String_init +move $t0, $sp +# Arg l_85 +lw $t1, 344($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 352($sp) +#VCall out_string +move $t0, $sp +# Arg instance_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 340($sp) +#LoadStr msg_27 +la $t0, msg_27 +sw $t0, 360($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 364($sp) +#CallNode String_init +move $t0, $sp +# Arg l_89 +lw $t1, 360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_90 +lw $t1, 364($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 368($sp) +#VCall out_string +move $t0, $sp +# Arg instance_90 +lw $t1, 364($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 356($sp) +#LoadStr msg_28 +la $t0, msg_28 +sw $t0, 376($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 380($sp) +#CallNode String_init +move $t0, $sp +# Arg l_93 +lw $t1, 376($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 384($sp) +#VCall out_string +move $t0, $sp +# Arg instance_94 +lw $t1, 380($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 372($sp) +#VCall in_int +move $t0, $sp +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 388($sp) +#AssignNode num_3 = result_96 +lw $t1, 388($sp) +sw $t1, 16($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 400($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 404($sp) +#CallNode String_init +move $t0, $sp +# Arg l_99 +lw $t1, 400($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 408($sp) +#VCall out_string +move $t0, $sp +# Arg instance_100 +lw $t1, 404($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 1436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 1436($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 396($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 432($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 436($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_108 +lw $t1, 436($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_107 +lw $t1, 432($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 440($sp) +#GetAttr left_105 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 424($sp) +#GetAttr right_106 = Int.value +lw $t0, 432($sp) +lw $t1, 16($t0) +sw $t1, 428($sp) +#BinaryOperator left_105 = right_106 +lw $a0, 424($sp) +lw $t1, 428($sp) +seq $a0, $a0, $t1 +sw $a0, 420($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 416($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_104 +lw $t1, 420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_103 +lw $t1, 416($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 444($sp) +# IFGoto result_103 -> label_69 +lw $t0, 416($sp) +lw $a0, 16($t0) +bnez $a0, label_69 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 468($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 472($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_117 +lw $t1, 472($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_116 +lw $t1, 468($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 476($sp) +#GetAttr left_114 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 460($sp) +#GetAttr right_115 = Int.value +lw $t0, 468($sp) +lw $t1, 16($t0) +sw $t1, 464($sp) +#BinaryOperator left_114 = right_115 +lw $a0, 460($sp) +lw $t1, 464($sp) +seq $a0, $a0, $t1 +sw $a0, 456($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 452($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_113 +lw $t1, 456($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_112 +lw $t1, 452($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 480($sp) +# IFGoto result_112 -> label_70 +lw $t0, 452($sp) +lw $a0, 16($t0) +bnez $a0, label_70 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 504($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 508($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_126 +lw $t1, 508($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_125 +lw $t1, 504($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 512($sp) +#GetAttr left_123 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 496($sp) +#GetAttr right_124 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 500($sp) +#BinaryOperator left_123 = right_124 +lw $a0, 496($sp) +lw $t1, 500($sp) +seq $a0, $a0, $t1 +sw $a0, 492($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 488($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 516($sp) +# IFGoto result_121 -> label_71 +lw $t0, 488($sp) +lw $a0, 16($t0) +bnez $a0, label_71 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 540($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 544($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_135 +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_134 +lw $t1, 540($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 548($sp) +#GetAttr left_132 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 532($sp) +#GetAttr right_133 = Int.value +lw $t0, 540($sp) +lw $t1, 16($t0) +sw $t1, 536($sp) +#BinaryOperator left_132 = right_133 +lw $a0, 532($sp) +lw $t1, 536($sp) +seq $a0, $a0, $t1 +sw $a0, 528($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 524($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_131 +lw $t1, 528($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_130 +lw $t1, 524($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 552($sp) +# IFGoto result_130 -> label_72 +lw $t0, 524($sp) +lw $a0, 16($t0) +bnez $a0, label_72 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 576($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 580($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_144 +lw $t1, 580($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_143 +lw $t1, 576($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 584($sp) +#GetAttr left_141 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 568($sp) +#GetAttr right_142 = Int.value +lw $t0, 576($sp) +lw $t1, 16($t0) +sw $t1, 572($sp) +#BinaryOperator left_141 = right_142 +lw $a0, 568($sp) +lw $t1, 572($sp) +seq $a0, $a0, $t1 +sw $a0, 564($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 560($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_140 +lw $t1, 564($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_139 +lw $t1, 560($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 588($sp) +# IFGoto result_139 -> label_73 +lw $t0, 560($sp) +lw $a0, 16($t0) +bnez $a0, label_73 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 612($sp) +#LoadInt 6 +li $t0, 6 +sw $t0, 616($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_153 +lw $t1, 616($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_152 +lw $t1, 612($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 620($sp) +#GetAttr left_150 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 604($sp) +#GetAttr right_151 = Int.value +lw $t0, 612($sp) +lw $t1, 16($t0) +sw $t1, 608($sp) +#BinaryOperator left_150 = right_151 +lw $a0, 604($sp) +lw $t1, 608($sp) +seq $a0, $a0, $t1 +sw $a0, 600($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 596($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_149 +lw $t1, 600($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_148 +lw $t1, 596($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 624($sp) +# IFGoto result_148 -> label_74 +lw $t0, 596($sp) +lw $a0, 16($t0) +bnez $a0, label_74 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 648($sp) +#LoadInt 7 +li $t0, 7 +sw $t0, 652($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_162 +lw $t1, 652($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_161 +lw $t1, 648($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 656($sp) +#GetAttr left_159 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 640($sp) +#GetAttr right_160 = Int.value +lw $t0, 648($sp) +lw $t1, 16($t0) +sw $t1, 644($sp) +#BinaryOperator left_159 = right_160 +lw $a0, 640($sp) +lw $t1, 644($sp) +seq $a0, $a0, $t1 +sw $a0, 636($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 632($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_158 +lw $t1, 636($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_157 +lw $t1, 632($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 660($sp) +# IFGoto result_157 -> label_75 +lw $t0, 632($sp) +lw $a0, 16($t0) +bnez $a0, label_75 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 684($sp) +#LoadInt 8 +li $t0, 8 +sw $t0, 688($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_171 +lw $t1, 688($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_170 +lw $t1, 684($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 692($sp) +#GetAttr left_168 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 676($sp) +#GetAttr right_169 = Int.value +lw $t0, 684($sp) +lw $t1, 16($t0) +sw $t1, 680($sp) +#BinaryOperator left_168 = right_169 +lw $a0, 676($sp) +lw $t1, 680($sp) +seq $a0, $a0, $t1 +sw $a0, 672($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 668($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_167 +lw $t1, 672($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_166 +lw $t1, 668($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 696($sp) +# IFGoto result_166 -> label_76 +lw $t0, 668($sp) +lw $a0, 16($t0) +bnez $a0, label_76 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 720($sp) +#LoadInt 9 +li $t0, 9 +sw $t0, 724($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_180 +lw $t1, 724($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_179 +lw $t1, 720($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 728($sp) +#GetAttr left_177 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 712($sp) +#GetAttr right_178 = Int.value +lw $t0, 720($sp) +lw $t1, 16($t0) +sw $t1, 716($sp) +#BinaryOperator left_177 = right_178 +lw $a0, 712($sp) +lw $t1, 716($sp) +seq $a0, $a0, $t1 +sw $a0, 708($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 704($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_176 +lw $t1, 708($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_175 +lw $t1, 704($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 732($sp) +# IFGoto result_175 -> label_77 +lw $t0, 704($sp) +lw $a0, 16($t0) +bnez $a0, label_77 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 756($sp) +#LoadInt 10 +li $t0, 10 +sw $t0, 760($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_189 +lw $t1, 760($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_188 +lw $t1, 756($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 764($sp) +#GetAttr left_186 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 748($sp) +#GetAttr right_187 = Int.value +lw $t0, 756($sp) +lw $t1, 16($t0) +sw $t1, 752($sp) +#BinaryOperator left_186 = right_187 +lw $a0, 748($sp) +lw $t1, 752($sp) +seq $a0, $a0, $t1 +sw $a0, 744($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 740($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_185 +lw $t1, 744($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_184 +lw $t1, 740($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 768($sp) +# IFGoto result_184 -> label_78 +lw $t0, 740($sp) +lw $a0, 16($t0) +bnez $a0, label_78 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 792($sp) +#LoadInt 11 +li $t0, 11 +sw $t0, 796($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_198 +lw $t1, 796($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_197 +lw $t1, 792($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 800($sp) +#GetAttr left_195 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 784($sp) +#GetAttr right_196 = Int.value +lw $t0, 792($sp) +lw $t1, 16($t0) +sw $t1, 788($sp) +#BinaryOperator left_195 = right_196 +lw $a0, 784($sp) +lw $t1, 788($sp) +seq $a0, $a0, $t1 +sw $a0, 780($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 776($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_194 +lw $t1, 780($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_193 +lw $t1, 776($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 804($sp) +# IFGoto result_193 -> label_79 +lw $t0, 776($sp) +lw $a0, 16($t0) +bnez $a0, label_79 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 828($sp) +#LoadInt 12 +li $t0, 12 +sw $t0, 832($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_207 +lw $t1, 832($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_206 +lw $t1, 828($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 836($sp) +#GetAttr left_204 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 820($sp) +#GetAttr right_205 = Int.value +lw $t0, 828($sp) +lw $t1, 16($t0) +sw $t1, 824($sp) +#BinaryOperator left_204 = right_205 +lw $a0, 820($sp) +lw $t1, 824($sp) +seq $a0, $a0, $t1 +sw $a0, 816($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 812($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_203 +lw $t1, 816($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_202 +lw $t1, 812($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 840($sp) +# IFGoto result_202 -> label_80 +lw $t0, 812($sp) +lw $a0, 16($t0) +bnez $a0, label_80 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 864($sp) +#LoadInt 13 +li $t0, 13 +sw $t0, 868($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_216 +lw $t1, 868($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_215 +lw $t1, 864($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 872($sp) +#GetAttr left_213 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 856($sp) +#GetAttr right_214 = Int.value +lw $t0, 864($sp) +lw $t1, 16($t0) +sw $t1, 860($sp) +#BinaryOperator left_213 = right_214 +lw $a0, 856($sp) +lw $t1, 860($sp) +seq $a0, $a0, $t1 +sw $a0, 852($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 848($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_212 +lw $t1, 852($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_211 +lw $t1, 848($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 876($sp) +# IFGoto result_211 -> label_81 +lw $t0, 848($sp) +lw $a0, 16($t0) +bnez $a0, label_81 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 900($sp) +#LoadInt 14 +li $t0, 14 +sw $t0, 904($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_225 +lw $t1, 904($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_224 +lw $t1, 900($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 908($sp) +#GetAttr left_222 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 892($sp) +#GetAttr right_223 = Int.value +lw $t0, 900($sp) +lw $t1, 16($t0) +sw $t1, 896($sp) +#BinaryOperator left_222 = right_223 +lw $a0, 892($sp) +lw $t1, 896($sp) +seq $a0, $a0, $t1 +sw $a0, 888($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 884($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_221 +lw $t1, 888($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_220 +lw $t1, 884($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 912($sp) +# IFGoto result_220 -> label_82 +lw $t0, 884($sp) +lw $a0, 16($t0) +bnez $a0, label_82 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 936($sp) +#LoadInt 15 +li $t0, 15 +sw $t0, 940($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_234 +lw $t1, 940($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_233 +lw $t1, 936($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 944($sp) +#GetAttr left_231 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 928($sp) +#GetAttr right_232 = Int.value +lw $t0, 936($sp) +lw $t1, 16($t0) +sw $t1, 932($sp) +#BinaryOperator left_231 = right_232 +lw $a0, 928($sp) +lw $t1, 932($sp) +seq $a0, $a0, $t1 +sw $a0, 924($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 920($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_230 +lw $t1, 924($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_229 +lw $t1, 920($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 948($sp) +# IFGoto result_229 -> label_83 +lw $t0, 920($sp) +lw $a0, 16($t0) +bnez $a0, label_83 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 972($sp) +#LoadInt 16 +li $t0, 16 +sw $t0, 976($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_243 +lw $t1, 976($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_242 +lw $t1, 972($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 980($sp) +#GetAttr left_240 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 964($sp) +#GetAttr right_241 = Int.value +lw $t0, 972($sp) +lw $t1, 16($t0) +sw $t1, 968($sp) +#BinaryOperator left_240 = right_241 +lw $a0, 964($sp) +lw $t1, 968($sp) +seq $a0, $a0, $t1 +sw $a0, 960($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 956($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_239 +lw $t1, 960($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_238 +lw $t1, 956($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 984($sp) +# IFGoto result_238 -> label_84 +lw $t0, 956($sp) +lw $a0, 16($t0) +bnez $a0, label_84 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 1008($sp) +#LoadInt 17 +li $t0, 17 +sw $t0, 1012($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_252 +lw $t1, 1012($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_251 +lw $t1, 1008($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 1016($sp) +#GetAttr left_249 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 1000($sp) +#GetAttr right_250 = Int.value +lw $t0, 1008($sp) +lw $t1, 16($t0) +sw $t1, 1004($sp) +#BinaryOperator left_249 = right_250 +lw $a0, 1000($sp) +lw $t1, 1004($sp) +seq $a0, $a0, $t1 +sw $a0, 996($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 992($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_248 +lw $t1, 996($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_247 +lw $t1, 992($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 1020($sp) +# IFGoto result_247 -> label_85 +lw $t0, 992($sp) +lw $a0, 16($t0) +bnez $a0, label_85 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 1044($sp) +#LoadInt 18 +li $t0, 18 +sw $t0, 1048($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_261 +lw $t1, 1048($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_260 +lw $t1, 1044($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 1052($sp) +#GetAttr left_258 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 1036($sp) +#GetAttr right_259 = Int.value +lw $t0, 1044($sp) +lw $t1, 16($t0) +sw $t1, 1040($sp) +#BinaryOperator left_258 = right_259 +lw $a0, 1036($sp) +lw $t1, 1040($sp) +seq $a0, $a0, $t1 +sw $a0, 1032($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 1028($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_257 +lw $t1, 1032($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_256 +lw $t1, 1028($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 1056($sp) +# IFGoto result_256 -> label_86 +lw $t0, 1028($sp) +lw $a0, 16($t0) +bnez $a0, label_86 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 1080($sp) +#LoadInt 19 +li $t0, 19 +sw $t0, 1084($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_270 +lw $t1, 1084($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_269 +lw $t1, 1080($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 1088($sp) +#GetAttr left_267 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 1072($sp) +#GetAttr right_268 = Int.value +lw $t0, 1080($sp) +lw $t1, 16($t0) +sw $t1, 1076($sp) +#BinaryOperator left_267 = right_268 +lw $a0, 1072($sp) +lw $t1, 1076($sp) +seq $a0, $a0, $t1 +sw $a0, 1068($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 1064($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_266 +lw $t1, 1068($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_265 +lw $t1, 1064($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 1092($sp) +# IFGoto result_265 -> label_87 +lw $t0, 1064($sp) +lw $a0, 16($t0) +bnez $a0, label_87 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 1116($sp) +#LoadInt 20 +li $t0, 20 +sw $t0, 1120($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_279 +lw $t1, 1120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_278 +lw $t1, 1116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 1124($sp) +#GetAttr left_276 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 1108($sp) +#GetAttr right_277 = Int.value +lw $t0, 1116($sp) +lw $t1, 16($t0) +sw $t1, 1112($sp) +#BinaryOperator left_276 = right_277 +lw $a0, 1108($sp) +lw $t1, 1112($sp) +seq $a0, $a0, $t1 +sw $a0, 1104($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 1100($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_275 +lw $t1, 1104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_274 +lw $t1, 1100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 1128($sp) +# IFGoto result_274 -> label_88 +lw $t0, 1100($sp) +lw $a0, 16($t0) +bnez $a0, label_88 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 1152($sp) +#LoadInt 21 +li $t0, 21 +sw $t0, 1156($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_288 +lw $t1, 1156($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_287 +lw $t1, 1152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 1160($sp) +#GetAttr left_285 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 1144($sp) +#GetAttr right_286 = Int.value +lw $t0, 1152($sp) +lw $t1, 16($t0) +sw $t1, 1148($sp) +#BinaryOperator left_285 = right_286 +lw $a0, 1144($sp) +lw $t1, 1148($sp) +seq $a0, $a0, $t1 +sw $a0, 1140($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 1136($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_284 +lw $t1, 1140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_283 +lw $t1, 1136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 1164($sp) +# IFGoto result_283 -> label_89 +lw $t0, 1136($sp) +lw $a0, 16($t0) +bnez $a0, label_89 +#LoadStr msg_29 +la $t0, msg_29 +sw $t0, 1168($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1172($sp) +#CallNode String_init +move $t0, $sp +# Arg l_291 +lw $t1, 1168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_292 +lw $t1, 1172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1176($sp) +#AssignNode result_282 = instance_292 +lw $t1, 1172($sp) +sw $t1, 1132($sp) +#Goto label_90 +b label_90 +#LabelNode label_89 +label_89: +#LoadStr msg_30 +la $t0, msg_30 +sw $t0, 1180($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1184($sp) +#CallNode String_init +move $t0, $sp +# Arg l_294 +lw $t1, 1180($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_295 +lw $t1, 1184($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1188($sp) +#AssignNode result_282 = instance_295 +lw $t1, 1184($sp) +sw $t1, 1132($sp) +#LabelNode label_90 +label_90: +#AssignNode result_273 = result_282 +lw $t1, 1132($sp) +sw $t1, 1096($sp) +#Goto label_91 +b label_91 +#LabelNode label_88 +label_88: +#LoadStr msg_31 +la $t0, msg_31 +sw $t0, 1192($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1196($sp) +#CallNode String_init +move $t0, $sp +# Arg l_297 +lw $t1, 1192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_298 +lw $t1, 1196($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1200($sp) +#AssignNode result_273 = instance_298 +lw $t1, 1196($sp) +sw $t1, 1096($sp) +#LabelNode label_91 +label_91: +#AssignNode result_264 = result_273 +lw $t1, 1096($sp) +sw $t1, 1060($sp) +#Goto label_92 +b label_92 +#LabelNode label_87 +label_87: +#LoadStr msg_32 +la $t0, msg_32 +sw $t0, 1204($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1208($sp) +#CallNode String_init +move $t0, $sp +# Arg l_300 +lw $t1, 1204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_301 +lw $t1, 1208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1212($sp) +#AssignNode result_264 = instance_301 +lw $t1, 1208($sp) +sw $t1, 1060($sp) +#LabelNode label_92 +label_92: +#AssignNode result_255 = result_264 +lw $t1, 1060($sp) +sw $t1, 1024($sp) +#Goto label_93 +b label_93 +#LabelNode label_86 +label_86: +#LoadStr msg_33 +la $t0, msg_33 +sw $t0, 1216($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1220($sp) +#CallNode String_init +move $t0, $sp +# Arg l_303 +lw $t1, 1216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_304 +lw $t1, 1220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1224($sp) +#AssignNode result_255 = instance_304 +lw $t1, 1220($sp) +sw $t1, 1024($sp) +#LabelNode label_93 +label_93: +#AssignNode result_246 = result_255 +lw $t1, 1024($sp) +sw $t1, 988($sp) +#Goto label_94 +b label_94 +#LabelNode label_85 +label_85: +#LoadStr msg_34 +la $t0, msg_34 +sw $t0, 1228($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1232($sp) +#CallNode String_init +move $t0, $sp +# Arg l_306 +lw $t1, 1228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_307 +lw $t1, 1232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1236($sp) +#AssignNode result_246 = instance_307 +lw $t1, 1232($sp) +sw $t1, 988($sp) +#LabelNode label_94 +label_94: +#AssignNode result_237 = result_246 +lw $t1, 988($sp) +sw $t1, 952($sp) +#Goto label_95 +b label_95 +#LabelNode label_84 +label_84: +#LoadStr msg_35 +la $t0, msg_35 +sw $t0, 1240($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1244($sp) +#CallNode String_init +move $t0, $sp +# Arg l_309 +lw $t1, 1240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_310 +lw $t1, 1244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1248($sp) +#AssignNode result_237 = instance_310 +lw $t1, 1244($sp) +sw $t1, 952($sp) +#LabelNode label_95 +label_95: +#AssignNode result_228 = result_237 +lw $t1, 952($sp) +sw $t1, 916($sp) +#Goto label_96 +b label_96 +#LabelNode label_83 +label_83: +#LoadStr msg_36 +la $t0, msg_36 +sw $t0, 1252($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1256($sp) +#CallNode String_init +move $t0, $sp +# Arg l_312 +lw $t1, 1252($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_313 +lw $t1, 1256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1260($sp) +#AssignNode result_228 = instance_313 +lw $t1, 1256($sp) +sw $t1, 916($sp) +#LabelNode label_96 +label_96: +#AssignNode result_219 = result_228 +lw $t1, 916($sp) +sw $t1, 880($sp) +#Goto label_97 +b label_97 +#LabelNode label_82 +label_82: +#LoadStr msg_37 +la $t0, msg_37 +sw $t0, 1264($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1268($sp) +#CallNode String_init +move $t0, $sp +# Arg l_315 +lw $t1, 1264($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_316 +lw $t1, 1268($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1272($sp) +#AssignNode result_219 = instance_316 +lw $t1, 1268($sp) +sw $t1, 880($sp) +#LabelNode label_97 +label_97: +#AssignNode result_210 = result_219 +lw $t1, 880($sp) +sw $t1, 844($sp) +#Goto label_98 +b label_98 +#LabelNode label_81 +label_81: +#LoadStr msg_38 +la $t0, msg_38 +sw $t0, 1276($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1280($sp) +#CallNode String_init +move $t0, $sp +# Arg l_318 +lw $t1, 1276($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_319 +lw $t1, 1280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1284($sp) +#AssignNode result_210 = instance_319 +lw $t1, 1280($sp) +sw $t1, 844($sp) +#LabelNode label_98 +label_98: +#AssignNode result_201 = result_210 +lw $t1, 844($sp) +sw $t1, 808($sp) +#Goto label_99 +b label_99 +#LabelNode label_80 +label_80: +#LoadStr msg_39 +la $t0, msg_39 +sw $t0, 1288($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1292($sp) +#CallNode String_init +move $t0, $sp +# Arg l_321 +lw $t1, 1288($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_322 +lw $t1, 1292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1296($sp) +#AssignNode result_201 = instance_322 +lw $t1, 1292($sp) +sw $t1, 808($sp) +#LabelNode label_99 +label_99: +#AssignNode result_192 = result_201 +lw $t1, 808($sp) +sw $t1, 772($sp) +#Goto label_100 +b label_100 +#LabelNode label_79 +label_79: +#LoadStr msg_40 +la $t0, msg_40 +sw $t0, 1300($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1304($sp) +#CallNode String_init +move $t0, $sp +# Arg l_324 +lw $t1, 1300($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_325 +lw $t1, 1304($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1308($sp) +#AssignNode result_192 = instance_325 +lw $t1, 1304($sp) +sw $t1, 772($sp) +#LabelNode label_100 +label_100: +#AssignNode result_183 = result_192 +lw $t1, 772($sp) +sw $t1, 736($sp) +#Goto label_101 +b label_101 +#LabelNode label_78 +label_78: +#LoadStr msg_41 +la $t0, msg_41 +sw $t0, 1312($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1316($sp) +#CallNode String_init +move $t0, $sp +# Arg l_327 +lw $t1, 1312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_328 +lw $t1, 1316($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1320($sp) +#AssignNode result_183 = instance_328 +lw $t1, 1316($sp) +sw $t1, 736($sp) +#LabelNode label_101 +label_101: +#AssignNode result_174 = result_183 +lw $t1, 736($sp) +sw $t1, 700($sp) +#Goto label_102 +b label_102 +#LabelNode label_77 +label_77: +#LoadStr msg_42 +la $t0, msg_42 +sw $t0, 1324($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1328($sp) +#CallNode String_init +move $t0, $sp +# Arg l_330 +lw $t1, 1324($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_331 +lw $t1, 1328($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1332($sp) +#AssignNode result_174 = instance_331 +lw $t1, 1328($sp) +sw $t1, 700($sp) +#LabelNode label_102 +label_102: +#AssignNode result_165 = result_174 +lw $t1, 700($sp) +sw $t1, 664($sp) +#Goto label_103 +b label_103 +#LabelNode label_76 +label_76: +#LoadStr msg_43 +la $t0, msg_43 +sw $t0, 1336($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1340($sp) +#CallNode String_init +move $t0, $sp +# Arg l_333 +lw $t1, 1336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_334 +lw $t1, 1340($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1344($sp) +#AssignNode result_165 = instance_334 +lw $t1, 1340($sp) +sw $t1, 664($sp) +#LabelNode label_103 +label_103: +#AssignNode result_156 = result_165 +lw $t1, 664($sp) +sw $t1, 628($sp) +#Goto label_104 +b label_104 +#LabelNode label_75 +label_75: +#LoadStr msg_44 +la $t0, msg_44 +sw $t0, 1348($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1352($sp) +#CallNode String_init +move $t0, $sp +# Arg l_336 +lw $t1, 1348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_337 +lw $t1, 1352($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1356($sp) +#AssignNode result_156 = instance_337 +lw $t1, 1352($sp) +sw $t1, 628($sp) +#LabelNode label_104 +label_104: +#AssignNode result_147 = result_156 +lw $t1, 628($sp) +sw $t1, 592($sp) +#Goto label_105 +b label_105 +#LabelNode label_74 +label_74: +#LoadStr msg_45 +la $t0, msg_45 +sw $t0, 1360($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1364($sp) +#CallNode String_init +move $t0, $sp +# Arg l_339 +lw $t1, 1360($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_340 +lw $t1, 1364($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1368($sp) +#AssignNode result_147 = instance_340 +lw $t1, 1364($sp) +sw $t1, 592($sp) +#LabelNode label_105 +label_105: +#AssignNode result_138 = result_147 +lw $t1, 592($sp) +sw $t1, 556($sp) +#Goto label_106 +b label_106 +#LabelNode label_73 +label_73: +#LoadStr msg_46 +la $t0, msg_46 +sw $t0, 1372($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1376($sp) +#CallNode String_init +move $t0, $sp +# Arg l_342 +lw $t1, 1372($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_343 +lw $t1, 1376($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1380($sp) +#AssignNode result_138 = instance_343 +lw $t1, 1376($sp) +sw $t1, 556($sp) +#LabelNode label_106 +label_106: +#AssignNode result_129 = result_138 +lw $t1, 556($sp) +sw $t1, 520($sp) +#Goto label_107 +b label_107 +#LabelNode label_72 +label_72: +#LoadStr msg_47 +la $t0, msg_47 +sw $t0, 1384($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1388($sp) +#CallNode String_init +move $t0, $sp +# Arg l_345 +lw $t1, 1384($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_346 +lw $t1, 1388($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1392($sp) +#AssignNode result_129 = instance_346 +lw $t1, 1388($sp) +sw $t1, 520($sp) +#LabelNode label_107 +label_107: +#AssignNode result_120 = result_129 +lw $t1, 520($sp) +sw $t1, 484($sp) +#Goto label_108 +b label_108 +#LabelNode label_71 +label_71: +#LoadStr msg_48 +la $t0, msg_48 +sw $t0, 1396($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1400($sp) +#CallNode String_init +move $t0, $sp +# Arg l_348 +lw $t1, 1396($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_349 +lw $t1, 1400($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1404($sp) +#AssignNode result_120 = instance_349 +lw $t1, 1400($sp) +sw $t1, 484($sp) +#LabelNode label_108 +label_108: +#AssignNode result_111 = result_120 +lw $t1, 484($sp) +sw $t1, 448($sp) +#Goto label_109 +b label_109 +#LabelNode label_70 +label_70: +#LoadStr msg_49 +la $t0, msg_49 +sw $t0, 1408($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1412($sp) +#CallNode String_init +move $t0, $sp +# Arg l_351 +lw $t1, 1408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_352 +lw $t1, 1412($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1416($sp) +#AssignNode result_111 = instance_352 +lw $t1, 1412($sp) +sw $t1, 448($sp) +#LabelNode label_109 +label_109: +#AssignNode result_102 = result_111 +lw $t1, 448($sp) +sw $t1, 412($sp) +#Goto label_110 +b label_110 +#LabelNode label_69 +label_69: +#LoadStr msg_50 +la $t0, msg_50 +sw $t0, 1420($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 1424($sp) +#CallNode String_init +move $t0, $sp +# Arg l_354 +lw $t1, 1420($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_355 +lw $t1, 1424($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 1428($sp) +#AssignNode result_102 = instance_355 +lw $t1, 1424($sp) +sw $t1, 412($sp) +#LabelNode label_110 +label_110: +#AssignNode result_357 = result_102 +lw $t1, 412($sp) +sw $t1, 1432($sp) +#Return result_357 +lw $a1, 1432($sp) +lw $ra, 0($sp) +addi $sp, $sp, 1440 +jr $ra +CellularAutomaton.prompt: +addi $sp, $sp, -136 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#AssignNode ans_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#LoadStr msg_51 +la $t0, msg_51 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#VCall out_string +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#LoadStr msg_52 +la $t0, msg_52 +sw $t0, 40($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode String_init +move $t0, $sp +# Arg l_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 48($sp) +#VCall out_string +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 36($sp) +#VCall in_string +move $t0, $sp +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 52($sp) +#AssignNode ans_3 = result_12 +lw $t1, 52($sp) +sw $t1, 16($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 64($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode String_init +move $t0, $sp +# Arg l_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 72($sp) +#VCall out_string +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 60($sp) +#LoadStr msg_53 +la $t0, msg_53 +sw $t0, 96($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode String_init +move $t0, $sp +# Arg l_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 104($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg ans_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 84($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_19 -> label_111 +lw $t0, 80($sp) +lw $a0, 16($t0) +bnez $a0, label_111 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 120($sp) +#AssignNode result_18 = instance_27 +lw $t1, 112($sp) +sw $t1, 76($sp) +#Goto label_112 +b label_112 +#LabelNode label_111 +label_111: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 128($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 132($sp) +#AssignNode result_18 = instance_30 +lw $t1, 124($sp) +sw $t1, 76($sp) +#LabelNode label_112 +label_112: +#AssignNode result_33 = result_18 +lw $t1, 76($sp) +sw $t1, 136($sp) +#Return result_33 +lw $a1, 136($sp) +lw $ra, 0($sp) +addi $sp, $sp, 144 +jr $ra +CellularAutomaton.prompt2: +addi $sp, $sp, -136 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#AssignNode ans_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#LoadStr msg_54 +la $t0, msg_54 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#VCall out_string +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#LoadStr msg_55 +la $t0, msg_55 +sw $t0, 40($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode String_init +move $t0, $sp +# Arg l_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 48($sp) +#VCall out_string +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 36($sp) +#LoadStr msg_56 +la $t0, msg_56 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#VCall in_string +move $t0, $sp +# Arg self +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 140($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 68($sp) +#AssignNode ans_3 = result_16 +lw $t1, 68($sp) +sw $t1, 16($sp) +#LoadStr msg_57 +la $t0, msg_57 +sw $t0, 96($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode String_init +move $t0, $sp +# Arg l_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 104($sp) +#CallNode String_equals +move $t0, $sp +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg ans_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 84($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 108($sp) +# IFGoto result_19 -> label_113 +lw $t0, 80($sp) +lw $a0, 16($t0) +bnez $a0, label_113 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 112($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 116($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 120($sp) +#AssignNode result_18 = instance_27 +lw $t1, 112($sp) +sw $t1, 76($sp) +#Goto label_114 +b label_114 +#LabelNode label_113 +label_113: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 124($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 128($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_31 +lw $t1, 128($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 132($sp) +#AssignNode result_18 = instance_30 +lw $t1, 124($sp) +sw $t1, 76($sp) +#LabelNode label_114 +label_114: +#AssignNode result_33 = result_18 +lw $t1, 76($sp) +sw $t1, 136($sp) +#Return result_33 +lw $a1, 136($sp) +lw $ra, 0($sp) +addi $sp, $sp, 144 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode CellularAutomaton_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal CellularAutomaton_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr Maincells = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 32($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -172 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#AssignNode continue_3 = instance_0 +lw $t1, 4($sp) +sw $t1, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadStr empty_str +la $t0, empty_str +sw $t0, 24($sp) +#CallNode String_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 28($sp) +#AssignNode choice_7 = instance_4 +lw $t1, 20($sp) +sw $t1, 32($sp) +#LoadStr msg_58 +la $t0, msg_58 +sw $t0, 40($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode String_init +move $t0, $sp +# Arg l_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 48($sp) +#VCall out_string +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 176($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 36($sp) +#LoadStr msg_59 +la $t0, msg_59 +sw $t0, 56($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode String_init +move $t0, $sp +# Arg l_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 64($sp) +#VCall out_string +move $t0, $sp +# Arg instance_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 176($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#LabelNode label_115 +label_115: +#VCall prompt2 +move $t0, $sp +# Arg self +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 176($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 104($t2) +jal $t3 +sw $a1, 72($sp) +# IFGoto result_17 -> label_116 +lw $t0, 72($sp) +lw $a0, 16($t0) +bnez $a0, label_116 +#Goto label_117 +b label_117 +#LabelNode label_116 +label_116: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 80($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 84($sp) +#AssignNode continue_3 = instance_18 +lw $t1, 76($sp) +sw $t1, 16($sp) +#VCall option +move $t0, $sp +# Arg self +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 176($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 96($t2) +jal $t3 +sw $a1, 92($sp) +#AssignNode choice_7 = result_22 +lw $t1, 92($sp) +sw $t1, 32($sp) +#Allocate 3:tag CellularAutomaton:Class_name 8:Class_size +li $a0, 32 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, CellularAutomaton_name +sw $t1, 4($t0) +li $t1, 8 +sw $t1, 8($t0) +la $t1, CellularAutomaton_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode CellularAutomaton_init +move $t0, $sp +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal CellularAutomaton_init +sw $a1, 108($sp) +#VCall init +move $t0, $sp +# Arg choice_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 104($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 100($sp) +#SetAttr Maincells = result_24 +lw $t0, 176($sp) +lw $t1, 100($sp) +sw $t1, 32($t0) +#GetAttr Main.cells = Main.cells +lw $t0, 176($sp) +lw $t1, 32($t0) +sw $t1, 164($sp) +#VCall print +move $t0, $sp +# Arg Main.cells +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 164($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 116($sp) +#LabelNode label_118 +label_118: +# IFGoto continue_3 -> label_119 +lw $t0, 16($sp) +lw $a0, 16($t0) +bnez $a0, label_119 +#Goto label_120 +b label_120 +#LabelNode label_119 +label_119: +#VCall prompt +move $t0, $sp +# Arg self +lw $t1, 176($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 176($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 100($t2) +jal $t3 +sw $a1, 132($sp) +# IFGoto result_32 -> label_121 +lw $t0, 132($sp) +lw $a0, 16($t0) +bnez $a0, label_121 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 140($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 144($sp) +#AssignNode continue_3 = instance_33 +lw $t1, 136($sp) +sw $t1, 16($sp) +#AssignNode result_31 = instance_33 +lw $t1, 136($sp) +sw $t1, 128($sp) +#Goto label_122 +b label_122 +#LabelNode label_121 +label_121: +#GetAttr Main.cells = Main.cells +lw $t0, 176($sp) +lw $t1, 32($t0) +sw $t1, 164($sp) +#VCall evolve +move $t0, $sp +# Arg Main.cells +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 164($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 92($t2) +jal $t3 +sw $a1, 152($sp) +#GetAttr Main.cells = Main.cells +lw $t0, 176($sp) +lw $t1, 32($t0) +sw $t1, 164($sp) +#VCall print +move $t0, $sp +# Arg Main.cells +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 164($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 160($sp) +#AssignNode result_31 = result_39 +lw $t1, 160($sp) +sw $t1, 128($sp) +#LabelNode label_122 +label_122: +#Goto label_118 +b label_118 +#LabelNode label_120 +label_120: +#Goto label_115 +b label_115 +#LabelNode label_117 +label_117: +#AssignNode result_41 = self +lw $t1, 176($sp) +sw $t1, 168($sp) +#AssignNode result_42 = result_41 +lw $t1, 168($sp) +sw $t1, 172($sp) +#Return result_42 +lw $a1, 172($sp) +lw $ra, 0($sp) +addi $sp, $sp, 180 +jr $ra \ No newline at end of file diff --git a/tests/codegen/life_input.txt b/tests/codegen/life_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/life_output.txt b/tests/codegen/life_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/list.cl b/tests/codegen/list.cl old mode 100644 new mode 100755 diff --git a/tests/codegen/list.mips b/tests/codegen/list.mips new file mode 100644 index 000000000..42db39e8e --- /dev/null +++ b/tests/codegen/list.mips @@ -0,0 +1,1612 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +List_name: .asciiz "List" +List_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word List.isNil +.word List.head +.word List.tail +.word List.cons +Cons_name: .asciiz "Cons" +Cons_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word Cons.isNil +.word Cons.head +.word Cons.tail +.word List.cons +.word Cons.init +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.print_list +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz " " +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +List_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode Object_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +List.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +List.head: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +List.tail: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +List.cons: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 6:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 6 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 12($sp) +#VCall init +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Cons_init: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode List_init +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal List_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Conscar = instance_1 +lw $t0, 20($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#SetAttr Conscdr = void +lw $t0, 20($sp) +la $t1, void +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Cons.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Cons.head: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.car = Cons.car +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return Cons.car +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons.tail: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.cdr = Cons.cdr +lw $t0, 8($sp) +lw $t1, 20($t0) +sw $t1, 4($sp) +#Return Cons.cdr +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons.init: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Conscar = i +lw $t0, 12($sp) +lw $t1, 16($sp) +sw $t1, 16($t0) +#SetAttr Conscdr = rest +lw $t0, 12($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr Mainmylist = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.print_list: +addi $sp, $sp, -56 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall isNil +move $t0, $sp +# Arg l +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 64($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 8($sp) +# IFGoto result_1 -> label_1 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#VCall head +move $t0, $sp +# Arg l +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 64($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 16($sp) +#VCall out_int +move $t0, $sp +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 12($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 24($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode String_init +move $t0, $sp +# Arg l_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 32($sp) +#VCall out_string +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 20($sp) +#VCall tail +move $t0, $sp +# Arg l +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 64($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 40($sp) +#VCall print_list +move $t0, $sp +# Arg result_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 36($sp) +#AssignNode result_0 = result_8 +lw $t1, 36($sp) +sw $t1, 4($sp) +#Goto label_2 +b label_2 +#LabelNode label_1 +label_1: +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 48($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 52($sp) +#CallNode String_init +move $t0, $sp +# Arg l_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 56($sp) +#VCall out_string +move $t0, $sp +# Arg instance_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 44($sp) +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#LabelNode label_2 +label_2: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 68 +jr $ra +Main.main: +addi $sp, $sp, -140 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 5:tag List:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 5 +sw $t1, 0($t0) +la $t1, List_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, List_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode List_init +move $t0, $sp +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal List_init +sw $a1, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 36($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#VCall cons +move $t0, $sp +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 24($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 20($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 48($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 52($sp) +#VCall cons +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 56($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 60($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 64($sp) +#VCall cons +move $t0, $sp +# Arg instance_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 12($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#VCall cons +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 8($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#LoadInt 5 +li $t0, 5 +sw $t0, 84($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 88($sp) +#VCall cons +move $t0, $sp +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 4($sp) +#SetAttr Mainmylist = result_0 +lw $t0, 144($sp) +lw $t1, 4($sp) +sw $t1, 16($t0) +#LabelNode label_3 +label_3: +#GetAttr Main.mylist = Main.mylist +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 136($sp) +#VCall isNil +move $t0, $sp +# Arg Main.mylist +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 136($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 112($sp) +#GetAttr l_26 = Bool.value +lw $t0, 112($sp) +lw $t1, 16($t0) +sw $t1, 108($sp) +#UnaryOperator not l_26 +lw $t1, 108($sp) +xor $a0, $t1, 1 +sw $a0, 104($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 120($sp) +# IFGoto result_24 -> label_4 +lw $t0, 100($sp) +lw $a0, 16($t0) +bnez $a0, label_4 +#Goto label_5 +b label_5 +#LabelNode label_4 +label_4: +#GetAttr Main.mylist = Main.mylist +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 136($sp) +#VCall print_list +move $t0, $sp +# Arg Main.mylist +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 144($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 124($sp) +#GetAttr Main.mylist = Main.mylist +lw $t0, 144($sp) +lw $t1, 16($t0) +sw $t1, 136($sp) +#VCall tail +move $t0, $sp +# Arg Main.mylist +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 136($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 132($sp) +#SetAttr Mainmylist = result_32 +lw $t0, 144($sp) +lw $t1, 132($sp) +sw $t1, 16($t0) +#Goto label_3 +b label_3 +#LabelNode label_5 +label_5: +#Return result_23 +lw $a1, 96($sp) +lw $ra, 0($sp) +addi $sp, $sp, 148 +jr $ra \ No newline at end of file diff --git a/tests/codegen/list_input.txt b/tests/codegen/list_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/list_output.txt b/tests/codegen/list_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/new_complex.mips b/tests/codegen/new_complex.mips new file mode 100644 index 000000000..e1c9ce4c4 --- /dev/null +++ b/tests/codegen/new_complex.mips @@ -0,0 +1,2246 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +Complex_name: .asciiz "Complex" +Complex_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Complex.init +.word Complex.print +.word Complex.reflect_0 +.word Complex.reflect_X +.word Complex.reflect_Y +.word Complex.equal +.word Complex.x_value +.word Complex.y_value +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "=( +" +msg_4: .asciiz "=) +" +msg_5: .asciiz "+" +msg_6: .asciiz "I" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -160 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Complex:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Complex_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Complex_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Complex_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Complex_init +sw $a1, 12($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#VCall init +move $t0, $sp +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 4($sp) +#AssignNode c_9 = result_0 +lw $t1, 4($sp) +sw $t1, 40($sp) +#VCall reflect_X +move $t0, $sp +# Arg c_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 64($sp) +#VCall reflect_0 +move $t0, $sp +# Arg c_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 68($sp) +#AssignNode left_13 = result_15 +lw $t1, 64($sp) +sw $t1, 56($sp) +#AssignNode right_14 = result_16 +lw $t1, 68($sp) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 72($sp) +# IFGoto result_11 -> label_1 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 80($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode String_init +move $t0, $sp +# Arg l_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 88($sp) +#VCall out_string +move $t0, $sp +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 164($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 76($sp) +#AssignNode result_10 = result_18 +lw $t1, 76($sp) +sw $t1, 44($sp) +#Goto label_2 +b label_2 +#LabelNode label_1 +label_1: +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 96($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#CallNode String_init +move $t0, $sp +# Arg l_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 104($sp) +#VCall out_string +move $t0, $sp +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 164($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 92($sp) +#AssignNode result_10 = result_22 +lw $t1, 92($sp) +sw $t1, 44($sp) +#LabelNode label_2 +label_2: +#VCall reflect_X +move $t0, $sp +# Arg c_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 120($sp) +#VCall reflect_Y +move $t0, $sp +# Arg result_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 120($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 116($sp) +#VCall reflect_0 +move $t0, $sp +# Arg c_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 36($t2) +jal $t3 +sw $a1, 124($sp) +#VCall equal +move $t0, $sp +# Arg result_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_28 +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 116($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 112($sp) +# IFGoto result_27 -> label_3 +lw $t0, 112($sp) +lw $a0, 16($t0) +bnez $a0, label_3 +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 132($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#CallNode String_init +move $t0, $sp +# Arg l_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 140($sp) +#VCall out_string +move $t0, $sp +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 164($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 128($sp) +#AssignNode result_26 = result_31 +lw $t1, 128($sp) +sw $t1, 108($sp) +#Goto label_4 +b label_4 +#LabelNode label_3 +label_3: +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 148($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 152($sp) +#CallNode String_init +move $t0, $sp +# Arg l_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 156($sp) +#VCall out_string +move $t0, $sp +# Arg instance_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 164($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 144($sp) +#AssignNode result_26 = result_35 +lw $t1, 144($sp) +sw $t1, 108($sp) +#LabelNode label_4 +label_4: +#AssignNode result_39 = result_26 +lw $t1, 108($sp) +sw $t1, 160($sp) +#Return result_39 +lw $a1, 160($sp) +lw $ra, 0($sp) +addi $sp, $sp, 168 +jr $ra +Complex_init: +addi $sp, $sp, -28 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Complexx = instance_1 +lw $t0, 32($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 28($sp) +#SetAttr Complexy = instance_4 +lw $t0, 32($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Complex.init: +addi $sp, $sp, -48 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 52($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr left_2 = Int.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 56($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 24($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 52($sp) +lw $t1, 20($t0) +sw $t1, 44($sp) +#GetAttr left_8 = Int.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr right_9 = Int.value +lw $t0, 60($sp) +lw $t1, 16($t0) +sw $t1, 40($sp) +#BinaryOperator left_8 = right_9 +lw $a0, 36($sp) +lw $t1, 40($sp) +seq $a0, $a0, $t1 +sw $a0, 32($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 48($sp) +#Return self +lw $a1, 52($sp) +lw $ra, 0($sp) +addi $sp, $sp, 64 +jr $ra +Complex.print: +addi $sp, $sp, -96 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 100($sp) +lw $t1, 20($t0) +sw $t1, 76($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_3 = Int.value +lw $t0, 76($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_1 -> label_5 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_5 +#GetAttr Complex.x = Complex.x +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#VCall out_int +move $t0, $sp +# Arg Complex.x +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 56($sp) +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 64($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode String_init +move $t0, $sp +# Arg l_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 72($sp) +#VCall out_string +move $t0, $sp +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 56($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 52($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 100($sp) +lw $t1, 20($t0) +sw $t1, 76($sp) +#VCall out_int +move $t0, $sp +# Arg Complex.y +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 52($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 48($sp) +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 80($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#CallNode String_init +move $t0, $sp +# Arg l_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 88($sp) +#VCall out_string +move $t0, $sp +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 44($sp) +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#Goto label_6 +b label_6 +#LabelNode label_5 +label_5: +#GetAttr Complex.x = Complex.x +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 96($sp) +#VCall out_int +move $t0, $sp +# Arg Complex.x +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 100($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 92($sp) +#AssignNode result_0 = result_22 +lw $t1, 92($sp) +sw $t1, 4($sp) +#LabelNode label_6 +label_6: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 104 +jr $ra +Complex.reflect_0: +addi $sp, $sp, -88 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr l_7 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#UnaryOperator ~ l_7 +lw $t1, 32($sp) +neg $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_2 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 92($sp) +lw $t1, 20($t0) +sw $t1, 80($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 92($sp) +lw $t1, 20($t0) +sw $t1, 80($sp) +#GetAttr l_18 = Int.value +lw $t0, 80($sp) +lw $t1, 16($t0) +sw $t1, 76($sp) +#UnaryOperator ~ l_18 +lw $t1, 76($sp) +neg $a0, $t1 +sw $a0, 72($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 84($sp) +#GetAttr left_13 = Int.value +lw $t0, 80($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 88($sp) +#Return self +lw $a1, 92($sp) +lw $ra, 0($sp) +addi $sp, $sp, 96 +jr $ra +Complex.reflect_X: +addi $sp, $sp, -44 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 48($sp) +lw $t1, 20($t0) +sw $t1, 36($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 48($sp) +lw $t1, 20($t0) +sw $t1, 36($sp) +#GetAttr l_7 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#UnaryOperator ~ l_7 +lw $t1, 32($sp) +neg $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_2 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +#Return self +lw $a1, 48($sp) +lw $ra, 0($sp) +addi $sp, $sp, 52 +jr $ra +Complex.reflect_Y: +addi $sp, $sp, -44 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 48($sp) +lw $t1, 16($t0) +sw $t1, 36($sp) +#GetAttr l_7 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 32($sp) +#UnaryOperator ~ l_7 +lw $t1, 32($sp) +neg $a0, $t1 +sw $a0, 28($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 40($sp) +#GetAttr left_2 = Int.value +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#GetAttr right_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#BinaryOperator left_2 = right_3 +lw $a0, 12($sp) +lw $t1, 16($sp) +seq $a0, $a0, $t1 +sw $a0, 8($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +#Return self +lw $a1, 48($sp) +lw $ra, 0($sp) +addi $sp, $sp, 52 +jr $ra +Complex.equal: +addi $sp, $sp, -100 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 104($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#VCall x_value +move $t0, $sp +# Arg d +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 108($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 28($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 32($sp) +# IFGoto result_1 -> label_7 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_7 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 40($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 44($sp) +#AssignNode result_0 = instance_8 +lw $t1, 36($sp) +sw $t1, 4($sp) +#Goto label_8 +b label_8 +#LabelNode label_7 +label_7: +#GetAttr Complex.y = Complex.y +lw $t0, 104($sp) +lw $t1, 20($t0) +sw $t1, 68($sp) +#VCall y_value +move $t0, $sp +# Arg d +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 108($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 72($sp) +#GetAttr left_14 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#GetAttr right_15 = Int.value +lw $t0, 72($sp) +lw $t1, 16($t0) +sw $t1, 64($sp) +#BinaryOperator left_14 = right_15 +lw $a0, 60($sp) +lw $t1, 64($sp) +seq $a0, $a0, $t1 +sw $a0, 56($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 52($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 76($sp) +# IFGoto result_12 -> label_9 +lw $t0, 52($sp) +lw $a0, 16($t0) +bnez $a0, label_9 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 84($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 88($sp) +#AssignNode result_11 = instance_19 +lw $t1, 80($sp) +sw $t1, 48($sp) +#Goto label_10 +b label_10 +#LabelNode label_9 +label_9: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 96($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 100($sp) +#AssignNode result_11 = instance_22 +lw $t1, 92($sp) +sw $t1, 48($sp) +#LabelNode label_10 +label_10: +#AssignNode result_0 = result_11 +lw $t1, 48($sp) +sw $t1, 4($sp) +#LabelNode label_8 +label_8: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 112 +jr $ra +Complex.x_value: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.x = Complex.x +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return Complex.x +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Complex.y_value: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Complex.y = Complex.y +lw $t0, 8($sp) +lw $t1, 20($t0) +sw $t1, 4($sp) +#Return Complex.y +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra \ No newline at end of file diff --git a/tests/codegen/new_complex_input.txt b/tests/codegen/new_complex_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/new_complex_output.txt b/tests/codegen/new_complex_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/palindrome.mips b/tests/codegen/palindrome.mips new file mode 100644 index 000000000..5abbb53af --- /dev/null +++ b/tests/codegen/palindrome.mips @@ -0,0 +1,1720 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.pal +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "enter a string +" +msg_4: .asciiz "that was not a palindrome +" +msg_5: .asciiz "that was a palindrome +" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Maini = instance_1 +lw $t0, 20($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main.pal: +addi $sp, $sp, -276 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 284($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 24($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#GetAttr left_3 = Int.value +lw $t0, 24($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 = right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +seq $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 40($sp) +# IFGoto result_1 -> label_1 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#VCall length +move $t0, $sp +# Arg s +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 284($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 64($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 72($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 76($sp) +#GetAttr left_13 = Int.value +lw $t0, 64($sp) +lw $t1, 16($t0) +sw $t1, 56($sp) +#GetAttr right_14 = Int.value +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 60($sp) +#BinaryOperator left_13 = right_14 +lw $a0, 56($sp) +lw $t1, 60($sp) +seq $a0, $a0, $t1 +sw $a0, 52($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 48($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_11 +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 80($sp) +# IFGoto result_11 -> label_2 +lw $t0, 48($sp) +lw $a0, 16($t0) +bnez $a0, label_2 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 108($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 112($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_27 +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 116($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 124($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 128($sp) +#VCall substr +move $t0, $sp +# Arg instance_26 +lw $t1, 108($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 284($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 104($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 136($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 140($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_34 +lw $t1, 140($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 144($sp) +#VCall length +move $t0, $sp +# Arg s +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 284($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 164($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 168($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 172($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_42 +lw $t1, 172($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 176($sp) +#GetAttr left_38 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 156($sp) +#GetAttr right_39 = Int.value +lw $t0, 168($sp) +lw $t1, 16($t0) +sw $t1, 160($sp) +#BinaryOperator left_38 - right_39 +lw $a0, 156($sp) +lw $t1, 160($sp) +sub $a0, $a0, $t1 +sw $a0, 152($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 148($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_37 +lw $t1, 152($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 180($sp) +#VCall substr +move $t0, $sp +# Arg instance_33 +lw $t1, 136($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 284($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 132($sp) +#CallNode String_equals +move $t0, $sp +# Arg result_32 +lw $t1, 132($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_equals +sw $a1, 92($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 184($sp) +# IFGoto result_21 -> label_3 +lw $t0, 88($sp) +lw $a0, 16($t0) +bnez $a0, label_3 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 188($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 192($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_47 +lw $t1, 192($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_46 +lw $t1, 188($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 196($sp) +#AssignNode result_20 = instance_46 +lw $t1, 188($sp) +sw $t1, 84($sp) +#Goto label_4 +b label_4 +#LabelNode label_3 +label_3: +#VCall length +move $t0, $sp +# Arg s +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 284($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 224($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 228($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 232($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_57 +lw $t1, 232($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_56 +lw $t1, 228($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 236($sp) +#GetAttr left_53 = Int.value +lw $t0, 224($sp) +lw $t1, 16($t0) +sw $t1, 216($sp) +#GetAttr right_54 = Int.value +lw $t0, 228($sp) +lw $t1, 16($t0) +sw $t1, 220($sp) +#BinaryOperator left_53 - right_54 +lw $a0, 216($sp) +lw $t1, 220($sp) +sub $a0, $a0, $t1 +sw $a0, 212($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 208($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_52 +lw $t1, 212($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 240($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 244($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 248($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_61 +lw $t1, 248($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 252($sp) +#VCall substr +move $t0, $sp +# Arg result_51 +lw $t1, 208($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_60 +lw $t1, 244($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg s +lw $t1, 284($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 284($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 204($sp) +#VCall pal +move $t0, $sp +# Arg result_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 280($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 280($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 200($sp) +#AssignNode result_20 = result_49 +lw $t1, 200($sp) +sw $t1, 84($sp) +#LabelNode label_4 +label_4: +#AssignNode result_10 = result_20 +lw $t1, 84($sp) +sw $t1, 44($sp) +#Goto label_5 +b label_5 +#LabelNode label_2 +label_2: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 256($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 260($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 264($sp) +#AssignNode result_10 = instance_63 +lw $t1, 256($sp) +sw $t1, 44($sp) +#LabelNode label_5 +label_5: +#AssignNode result_0 = result_10 +lw $t1, 44($sp) +sw $t1, 4($sp) +#Goto label_6 +b label_6 +#LabelNode label_1 +label_1: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 268($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 272($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_67 +lw $t1, 272($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_66 +lw $t1, 268($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 276($sp) +#AssignNode result_0 = instance_66 +lw $t1, 268($sp) +sw $t1, 4($sp) +#LabelNode label_6 +label_6: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 288 +jr $ra +Main.main: +addi $sp, $sp, -92 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 24($sp) +#GetAttr l_2 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#UnaryOperator ~ l_2 +lw $t1, 12($sp) +neg $a0, $t1 +sw $a0, 8($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 28($sp) +#SetAttr Maini = result_0 +lw $t0, 96($sp) +lw $t1, 4($sp) +sw $t1, 16($t0) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 40($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 44($sp) +#CallNode String_init +move $t0, $sp +# Arg l_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 48($sp) +#VCall out_string +move $t0, $sp +# Arg instance_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 96($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 36($sp) +#VCall in_string +move $t0, $sp +# Arg self +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 96($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 60($sp) +#VCall pal +move $t0, $sp +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 96($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 56($sp) +# IFGoto result_13 -> label_7 +lw $t0, 56($sp) +lw $a0, 16($t0) +bnez $a0, label_7 +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 68($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#CallNode String_init +move $t0, $sp +# Arg l_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 76($sp) +#VCall out_string +move $t0, $sp +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 96($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 64($sp) +#AssignNode result_12 = result_15 +lw $t1, 64($sp) +sw $t1, 52($sp) +#Goto label_8 +b label_8 +#LabelNode label_7 +label_7: +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 84($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 88($sp) +#CallNode String_init +move $t0, $sp +# Arg l_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 92($sp) +#VCall out_string +move $t0, $sp +# Arg instance_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 96($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 80($sp) +#AssignNode result_12 = result_19 +lw $t1, 80($sp) +sw $t1, 52($sp) +#LabelNode label_8 +label_8: +#Return result_12 +lw $a1, 52($sp) +lw $ra, 0($sp) +addi $sp, $sp, 100 +jr $ra \ No newline at end of file diff --git a/tests/codegen/palindrome_input.txt b/tests/codegen/palindrome_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/palindrome_output.txt b/tests/codegen/palindrome_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/primes.cl b/tests/codegen/primes.cl old mode 100644 new mode 100755 diff --git a/tests/codegen/primes.mips b/tests/codegen/primes.mips new file mode 100644 index 000000000..3fe419af7 --- /dev/null +++ b/tests/codegen/primes.mips @@ -0,0 +1,1922 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "2 is trivially prime. +" +msg_4: .asciiz " is prime. +" +msg_5: .asciiz "continue" +msg_6: .asciiz "halt" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 9:Class_size +li $a0, 36 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 9 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -540 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg l_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#VCall out_string +move $t0, $sp +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 8($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 24($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 28($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 32($sp) +#SetAttr Mainout = instance_5 +lw $t0, 544($sp) +lw $t1, 24($sp) +sw $t1, 16($t0) +#GetAttr Main.out = Main.out +lw $t0, 544($sp) +lw $t1, 16($t0) +sw $t1, 464($sp) +#SetAttr Maintestee = Main.out +lw $t0, 544($sp) +lw $t1, 464($sp) +sw $t1, 20($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 44($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 48($sp) +#SetAttr Maindivisor = instance_9 +lw $t0, 544($sp) +lw $t1, 40($sp) +sw $t1, 24($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 52($sp) +#LoadInt 500 +li $t0, 500 +sw $t0, 56($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 60($sp) +#SetAttr Mainstop = instance_12 +lw $t0, 544($sp) +lw $t1, 52($sp) +sw $t1, 28($t0) +#LabelNode label_1 +label_1: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 68($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 72($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_16 +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 76($sp) +# IFGoto instance_16 -> label_2 +lw $t0, 68($sp) +lw $a0, 16($t0) +bnez $a0, label_2 +#Goto label_3 +b label_3 +#LabelNode label_2 +label_2: +#GetAttr Main.testee = Main.testee +lw $t0, 544($sp) +lw $t1, 20($t0) +sw $t1, 508($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 100($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 104($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 108($sp) +#GetAttr left_21 = Int.value +lw $t0, 508($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#GetAttr right_22 = Int.value +lw $t0, 100($sp) +lw $t1, 16($t0) +sw $t1, 92($sp) +#BinaryOperator left_21 + right_22 +lw $a0, 88($sp) +lw $t1, 92($sp) +add $a0, $a0, $t1 +sw $a0, 84($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 80($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 112($sp) +#SetAttr Maintestee = result_19 +lw $t0, 544($sp) +lw $t1, 80($sp) +sw $t1, 20($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 120($sp) +#LoadInt 2 +li $t0, 2 +sw $t0, 124($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_30 +lw $t1, 124($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_29 +lw $t1, 120($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 128($sp) +#SetAttr Maindivisor = instance_29 +lw $t0, 544($sp) +lw $t1, 120($sp) +sw $t1, 24($t0) +#LabelNode label_4 +label_4: +#GetAttr Main.testee = Main.testee +lw $t0, 544($sp) +lw $t1, 20($t0) +sw $t1, 508($sp) +#GetAttr Main.divisor = Main.divisor +lw $t0, 544($sp) +lw $t1, 24($t0) +sw $t1, 428($sp) +#GetAttr Main.divisor = Main.divisor +lw $t0, 544($sp) +lw $t1, 24($t0) +sw $t1, 428($sp) +#GetAttr left_42 = Int.value +lw $t0, 428($sp) +lw $t1, 16($t0) +sw $t1, 172($sp) +#GetAttr right_43 = Int.value +lw $t0, 428($sp) +lw $t1, 16($t0) +sw $t1, 176($sp) +#BinaryOperator left_42 * right_43 +lw $a0, 172($sp) +lw $t1, 176($sp) +mul $a0, $a0, $t1 +sw $a0, 168($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 164($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_41 +lw $t1, 168($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_40 +lw $t1, 164($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 188($sp) +#GetAttr left_37 = Int.value +lw $t0, 508($sp) +lw $t1, 16($t0) +sw $t1, 152($sp) +#GetAttr right_38 = Int.value +lw $t0, 164($sp) +lw $t1, 16($t0) +sw $t1, 156($sp) +#BinaryOperator left_37 < right_38 +lw $a0, 152($sp) +lw $t1, 156($sp) +slt $a0, $a0, $t1 +sw $a0, 148($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 144($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_36 +lw $t1, 148($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_35 +lw $t1, 144($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 192($sp) +# IFGoto result_35 -> label_7 +lw $t0, 144($sp) +lw $a0, 16($t0) +bnez $a0, label_7 +#GetAttr Main.testee = Main.testee +lw $t0, 544($sp) +lw $t1, 20($t0) +sw $t1, 508($sp) +#GetAttr Main.divisor = Main.divisor +lw $t0, 544($sp) +lw $t1, 24($t0) +sw $t1, 428($sp) +#GetAttr Main.testee = Main.testee +lw $t0, 544($sp) +lw $t1, 20($t0) +sw $t1, 508($sp) +#GetAttr Main.divisor = Main.divisor +lw $t0, 544($sp) +lw $t1, 24($t0) +sw $t1, 428($sp) +#GetAttr left_65 = Int.value +lw $t0, 508($sp) +lw $t1, 16($t0) +sw $t1, 264($sp) +#GetAttr right_66 = Int.value +lw $t0, 428($sp) +lw $t1, 16($t0) +sw $t1, 268($sp) +#BinaryOperator left_65 / right_66 +lw $a0, 264($sp) +lw $t1, 268($sp) +beq $t1, 0, div_zero_error +div $a0, $a0, $t1 +sw $a0, 260($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 256($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_64 +lw $t1, 260($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_63 +lw $t1, 256($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 280($sp) +#GetAttr left_60 = Int.value +lw $t0, 428($sp) +lw $t1, 16($t0) +sw $t1, 244($sp) +#GetAttr right_61 = Int.value +lw $t0, 256($sp) +lw $t1, 16($t0) +sw $t1, 248($sp) +#BinaryOperator left_60 * right_61 +lw $a0, 244($sp) +lw $t1, 248($sp) +mul $a0, $a0, $t1 +sw $a0, 240($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 236($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_59 +lw $t1, 240($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_58 +lw $t1, 236($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 284($sp) +#GetAttr left_55 = Int.value +lw $t0, 508($sp) +lw $t1, 16($t0) +sw $t1, 224($sp) +#GetAttr right_56 = Int.value +lw $t0, 236($sp) +lw $t1, 16($t0) +sw $t1, 228($sp) +#BinaryOperator left_55 - right_56 +lw $a0, 224($sp) +lw $t1, 228($sp) +sub $a0, $a0, $t1 +sw $a0, 220($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 216($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_54 +lw $t1, 220($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_53 +lw $t1, 216($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 288($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 292($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 296($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_73 +lw $t1, 296($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_72 +lw $t1, 292($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 300($sp) +#GetAttr left_51 = Int.value +lw $t0, 216($sp) +lw $t1, 16($t0) +sw $t1, 208($sp) +#GetAttr right_52 = Int.value +lw $t0, 292($sp) +lw $t1, 16($t0) +sw $t1, 212($sp) +#BinaryOperator left_51 = right_52 +lw $a0, 208($sp) +lw $t1, 212($sp) +seq $a0, $a0, $t1 +sw $a0, 204($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 200($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_50 +lw $t1, 204($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_49 +lw $t1, 200($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 304($sp) +# IFGoto result_49 -> label_8 +lw $t0, 200($sp) +lw $a0, 16($t0) +bnez $a0, label_8 +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 308($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 312($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_77 +lw $t1, 312($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_76 +lw $t1, 308($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 316($sp) +#AssignNode result_48 = instance_76 +lw $t1, 308($sp) +sw $t1, 196($sp) +#Goto label_9 +b label_9 +#LabelNode label_8 +label_8: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 320($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 324($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_80 +lw $t1, 324($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_79 +lw $t1, 320($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 328($sp) +#AssignNode result_48 = instance_79 +lw $t1, 320($sp) +sw $t1, 196($sp) +#LabelNode label_9 +label_9: +#AssignNode result_34 = result_48 +lw $t1, 196($sp) +sw $t1, 140($sp) +#Goto label_10 +b label_10 +#LabelNode label_7 +label_7: +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 332($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 336($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_83 +lw $t1, 336($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_82 +lw $t1, 332($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 340($sp) +#AssignNode result_34 = instance_82 +lw $t1, 332($sp) +sw $t1, 140($sp) +#LabelNode label_10 +label_10: +# IFGoto result_34 -> label_5 +lw $t0, 140($sp) +lw $a0, 16($t0) +bnez $a0, label_5 +#Goto label_6 +b label_6 +#LabelNode label_5 +label_5: +#GetAttr Main.divisor = Main.divisor +lw $t0, 544($sp) +lw $t1, 24($t0) +sw $t1, 428($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 364($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 368($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_91 +lw $t1, 368($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_90 +lw $t1, 364($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 372($sp) +#GetAttr left_87 = Int.value +lw $t0, 428($sp) +lw $t1, 16($t0) +sw $t1, 352($sp) +#GetAttr right_88 = Int.value +lw $t0, 364($sp) +lw $t1, 16($t0) +sw $t1, 356($sp) +#BinaryOperator left_87 + right_88 +lw $a0, 352($sp) +lw $t1, 356($sp) +add $a0, $a0, $t1 +sw $a0, 348($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 344($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_86 +lw $t1, 348($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_85 +lw $t1, 344($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 376($sp) +#SetAttr Maindivisor = result_85 +lw $t0, 544($sp) +lw $t1, 344($sp) +sw $t1, 24($t0) +#Goto label_4 +b label_4 +#LabelNode label_6 +label_6: +#GetAttr Main.testee = Main.testee +lw $t0, 544($sp) +lw $t1, 20($t0) +sw $t1, 508($sp) +#GetAttr Main.divisor = Main.divisor +lw $t0, 544($sp) +lw $t1, 24($t0) +sw $t1, 428($sp) +#GetAttr Main.divisor = Main.divisor +lw $t0, 544($sp) +lw $t1, 24($t0) +sw $t1, 428($sp) +#GetAttr left_103 = Int.value +lw $t0, 428($sp) +lw $t1, 16($t0) +sw $t1, 416($sp) +#GetAttr right_104 = Int.value +lw $t0, 428($sp) +lw $t1, 16($t0) +sw $t1, 420($sp) +#BinaryOperator left_103 * right_104 +lw $a0, 416($sp) +lw $t1, 420($sp) +mul $a0, $a0, $t1 +sw $a0, 412($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 408($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_102 +lw $t1, 412($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_101 +lw $t1, 408($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 432($sp) +#GetAttr left_98 = Int.value +lw $t0, 508($sp) +lw $t1, 16($t0) +sw $t1, 396($sp) +#GetAttr right_99 = Int.value +lw $t0, 408($sp) +lw $t1, 16($t0) +sw $t1, 400($sp) +#BinaryOperator left_98 < right_99 +lw $a0, 396($sp) +lw $t1, 400($sp) +slt $a0, $a0, $t1 +sw $a0, 392($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 388($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_97 +lw $t1, 392($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_96 +lw $t1, 388($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 436($sp) +# IFGoto result_96 -> label_11 +lw $t0, 388($sp) +lw $a0, 16($t0) +bnez $a0, label_11 +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 440($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 444($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_110 +lw $t1, 444($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_109 +lw $t1, 440($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 448($sp) +#AssignNode result_95 = instance_109 +lw $t1, 440($sp) +sw $t1, 384($sp) +#Goto label_12 +b label_12 +#LabelNode label_11 +label_11: +#GetAttr Main.testee = Main.testee +lw $t0, 544($sp) +lw $t1, 20($t0) +sw $t1, 508($sp) +#SetAttr Mainout = Main.testee +lw $t0, 544($sp) +lw $t1, 508($sp) +sw $t1, 16($t0) +#GetAttr Main.out = Main.out +lw $t0, 544($sp) +lw $t1, 16($t0) +sw $t1, 464($sp) +#VCall out_int +move $t0, $sp +# Arg Main.out +lw $t1, 464($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 460($sp) +#LoadStr msg_4 +la $t0, msg_4 +sw $t0, 472($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 476($sp) +#CallNode String_init +move $t0, $sp +# Arg l_117 +lw $t1, 472($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 480($sp) +#VCall out_string +move $t0, $sp +# Arg instance_118 +lw $t1, 476($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 544($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 544($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 468($sp) +#AssignNode result_95 = result_116 +lw $t1, 468($sp) +sw $t1, 384($sp) +#LabelNode label_12 +label_12: +#GetAttr Main.stop = Main.stop +lw $t0, 544($sp) +lw $t1, 28($t0) +sw $t1, 504($sp) +#GetAttr Main.testee = Main.testee +lw $t0, 544($sp) +lw $t1, 20($t0) +sw $t1, 508($sp) +#GetAttr left_123 = Int.value +lw $t0, 504($sp) +lw $t1, 16($t0) +sw $t1, 496($sp) +#GetAttr right_124 = Int.value +lw $t0, 508($sp) +lw $t1, 16($t0) +sw $t1, 500($sp) +#BinaryOperator left_123 <= right_124 +lw $a0, 496($sp) +lw $t1, 500($sp) +sle $a0, $a0, $t1 +sw $a0, 492($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 488($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_122 +lw $t1, 492($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_121 +lw $t1, 488($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 512($sp) +# IFGoto result_121 -> label_13 +lw $t0, 488($sp) +lw $a0, 16($t0) +bnez $a0, label_13 +#LoadStr msg_5 +la $t0, msg_5 +sw $t0, 516($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 520($sp) +#CallNode String_init +move $t0, $sp +# Arg l_128 +lw $t1, 516($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_129 +lw $t1, 520($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 524($sp) +#AssignNode result_120 = instance_129 +lw $t1, 520($sp) +sw $t1, 484($sp) +#Goto label_14 +b label_14 +#LabelNode label_13 +label_13: +#LoadStr msg_6 +la $t0, msg_6 +sw $t0, 532($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 536($sp) +#CallNode String_init +move $t0, $sp +# Arg l_132 +lw $t1, 532($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_133 +lw $t1, 536($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 540($sp) +#VCall abort +move $t0, $sp +# Arg instance_133 +lw $t1, 536($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 536($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 528($sp) +#AssignNode result_120 = result_131 +lw $t1, 528($sp) +sw $t1, 484($sp) +#LabelNode label_14 +label_14: +#Goto label_1 +b label_1 +#LabelNode label_3 +label_3: +#SetAttr Mainm = result_15 +lw $t0, 544($sp) +lw $t1, 64($sp) +sw $t1, 32($t0) +lw $ra, 0($sp) +addi $sp, $sp, 548 +jr $ra +Main.main: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra \ No newline at end of file diff --git a/tests/codegen/primes_input.txt b/tests/codegen/primes_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/primes_output.txt b/tests/codegen/primes_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/print-cool.cl b/tests/codegen/print-cool.cl old mode 100644 new mode 100755 diff --git a/tests/codegen/print-cool.mips b/tests/codegen/print-cool.mips new file mode 100644 index 000000000..3b4d5f340 --- /dev/null +++ b/tests/codegen/print-cool.mips @@ -0,0 +1,1031 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 2:tag Main:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.main: +addi $sp, $sp, -108 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 0:tag Object:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 0 +sw $t1, 0($t0) +la $t1, Object_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Object_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode Object_init +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Object_init +sw $a1, 24($sp) +#VCall type_name +move $t0, $sp +# Arg result_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 4($t2) +jal $t3 +sw $a1, 16($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 28($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 32($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 36($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 40($sp) +#LoadInt 4 +li $t0, 4 +sw $t0, 44($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 48($sp) +#VCall substr +move $t0, $sp +# Arg instance_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 12($sp) +#VCall out_string +move $t0, $sp +# Arg result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 112($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 8($sp) +#IsVoid self +la $t0, void +lw $t1, 112($sp) +seq $a0, $t0, $t1 +sw $a0, 60($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 64($sp) +#CallNode Bool_init +move $t0, $sp +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 60($sp) +#Return instance_15 +lw $a1, 64($sp) +#VCall type_name +move $t0, $sp +# Arg instance_15 +lw $t1, 64($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 64($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 4($t2) +jal $t3 +sw $a1, 56($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 72($sp) +#LoadInt 3 +li $t0, 3 +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 84($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 88($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_21 +lw $t1, 88($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 92($sp) +#VCall substr +move $t0, $sp +# Arg instance_17 +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_20 +lw $t1, 84($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_13 +lw $t1, 56($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 56($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 20($t2) +jal $t3 +sw $a1, 52($sp) +#VCall out_string +move $t0, $sp +# Arg result_12 +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 100($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 104($sp) +#CallNode String_init +move $t0, $sp +# Arg l_24 +lw $t1, 100($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 108($sp) +#VCall out_string +move $t0, $sp +# Arg instance_25 +lw $t1, 104($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 112($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 112($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 96($sp) +#Return result_23 +lw $a1, 96($sp) +lw $ra, 0($sp) +addi $sp, $sp, 116 +jr $ra \ No newline at end of file diff --git a/tests/codegen/print-cool_input.txt b/tests/codegen/print-cool_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/print-cool_output.txt b/tests/codegen/print-cool_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/sort-list.cl b/tests/codegen/sort-list.cl old mode 100644 new mode 100755 diff --git a/tests/codegen/sort-list.mips b/tests/codegen/sort-list.mips new file mode 100644 index 000000000..09a6d74e1 --- /dev/null +++ b/tests/codegen/sort-list.mips @@ -0,0 +1,2242 @@ +.data +div_zero: .asciiz "Runtime Error: Division by zero" +dispatch_void: .asciiz "Runtime Error: A dispatch with void" +case_void: .asciiz "Runtime Error: A case with void" +case_no_match: .asciiz "Runtime Error: Execution of a case statement without a matching branch" +heap: .asciiz "Runtime Error: Heap overflow" +substr: .asciiz "Runtime Error: Index for substring out of range" +input_str: .space 2048 +void: .word 0 +Object_name: .asciiz "Object" +Object_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +Int_name: .asciiz "Int" +Int_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +String_name: .asciiz "String" +String_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word String.length +.word String.concat +.word String.substr +Bool_name: .asciiz "Bool" +Bool_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +IO_name: .asciiz "IO" +IO_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +List_name: .asciiz "List" +List_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word List.isNil +.word List.cons +.word List.car +.word List.cdr +.word List.rev +.word List.sort +.word List.insert +.word List.rcons +.word List.print_list +Cons_name: .asciiz "Cons" +Cons_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Cons.isNil +.word List.cons +.word Cons.car +.word Cons.cdr +.word Cons.rev +.word Cons.sort +.word Cons.insert +.word Cons.rcons +.word Cons.print_list +.word Cons.init +Nil_name: .asciiz "Nil" +Nil_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Nil.isNil +.word List.cons +.word List.car +.word List.cdr +.word Nil.rev +.word Nil.sort +.word Nil.insert +.word Nil.rcons +.word Nil.print_list +Main_name: .asciiz "Main" +Main_methods: +.word Object.abort +.word Object.type_name +.word Object.copy +.word IO.out_string +.word IO.out_int +.word IO.in_string +.word IO.in_int +.word Main.iota +.word Main.main +msg_0: .asciiz "Abort called from class " +msg_1: .asciiz " +" +empty_str: .asciiz "" +msg_3: .asciiz "How many numbers to sort? " +.text +div_zero_error: +la $a0, div_zero +li $v0, 4 +syscall +li $v0, 10 +syscall +dispatch_void_error: +la $a0, dispatch_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_void_error: +la $a0, case_void +li $v0, 4 +syscall +li $v0, 10 +syscall +case_no_match_error: +la $a0, case_no_match +li $v0, 4 +syscall +li $v0, 10 +syscall +heap_error: +la $a0, heap +li $v0, 4 +syscall +li $v0, 10 +syscall +substr_error: +la $a0, substr +li $v0, 4 +syscall +li $v0, 10 +syscall +main: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Main:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Main_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Main_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Main_init +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main_init +sw $a1, 8($sp) +#CallNode Main.main +move $t0, $sp +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Main.main +sw $a1, 8($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Object_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Object.abort: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_0 +la $t0, msg_0 +sw $t0, 4($sp) +#PrintString msg_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 8($sp) +#PrintString class_name_1 +lw $a0, 8($sp) +li $v0, 4 +syscall +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 12($sp) +#PrintString eol_2 +lw $a0, 12($sp) +li $v0, 4 +syscall +#Abort +li $v0, 10 +syscall +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.type_name: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#TypeOf self +lw $t0, 16($sp) +lw $t1, 4($t0) +sw $t1, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg class_name_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Object.copy: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Copy self +lw $t0, 8($sp) +lw $a0, 8($t0) +mul $a0, $a0, 4 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t1, $v0 +li $a0, 0 +lw $t3, 8($t0) +copy_object: +lw $t2, 0($t0) +sw $t2, 0($t1) +addi $t0, $t0, 4 +addi $t1, $t1, 4 +addi $a0, $a0, 1 +blt $a0, $t3, copy_object +sw $v0, 4($sp) +#Return object_copy_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +IO_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +IO.out_string: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = String.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintString v_0 +lw $a0, 4($sp) +li $v0, 4 +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.out_int: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr v_0 = Int.value +lw $t0, 12($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#PrintInteger v_0 +li $v0, 1 +lw $a0, 4($sp) +syscall +#Return self +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +IO.in_string: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadString read_string_0 +la $a0, input_str +li $a1, 2048 +li $v0, 8 +syscall +move $t0, $a0 +read_char: +li $t1, 0 +lb $t1, 0($t0) +beqz $t1, remove_characters_str_end +addi $t0, $t0, 1 +j read_char +remove_characters_str_end: +addi $t0, $t0, -1 +li $t1, 0 +lb $t1, 0($t0) +bne $t1, 10, rcs_end +sb $0, 0($t0) +addi $t0, $t0, -1 +lb $t1, 0($t0) +bne $t1, 13, rcs_end +sb $0, 0($t0) +j remove_characters_str_end +rcs_end: +sw $a0, 4($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode String_init +move $t0, $sp +# Arg read_string_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +IO.in_int: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#ReadInteger read_int_0 +li $v0, 5 +syscall +sw $v0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg read_int_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Int_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Intvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Stringvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String.length: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Length of self +lw $t0, 16($sp) +lw $t0, 16($t0) +li $a0, 0 +count: +lb $t1, 0($t0) +beqz $t1, end +addi $t0, $t0, 1 +addi $a0, $a0, 1 +j count +end: +sw $a0, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg length_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +String.concat: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 40($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#CallNode String.length +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 8($sp) +#GetAttr str2_2 = String.value +lw $t0, 44($sp) +lw $t1, 16($t0) +sw $t1, 12($sp) +#CallNode String.length +move $t0, $sp +# Arg s +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String.length +sw $a1, 16($sp) +#GetAttr len1_value_4 = Int.value +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#GetAttr len2_value_5 = Int.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#Concat str1_0 str2_2 +lw $a0, 20($sp) +lw $t0, 24($sp) +add $a0, $a0, $t0 +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t3, $v0 +lw $t0, 4($sp) +lw $t1, 12($sp) +copy_str: +lb $t2, 0($t0) +sb $t2, 0($v0) +beqz $t2, concat_str +addi $t0, $t0, 1 +addi $v0, $v0, 1 +j copy_str +concat_str: +lb $t2, 0($t1) +sb $t2, 0($v0) +beqz $t2, end_concat_str +addi $t1, $t1, 1 +addi $v0, $v0, 1 +j concat_str +end_concat_str: +sb $0, ($v0) +sw $t3, 28($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 32($sp) +#CallNode String_init +move $t0, $sp +# Arg result_string_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 36($sp) +#Return instance_7 +lw $a1, 32($sp) +lw $ra, 0($sp) +addi $sp, $sp, 48 +jr $ra +String.substr: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr i_value_0 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr l_value_1 = Int.value +lw $t0, 32($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#Substr self:string i_value_0:index l_value_1:length +lw $a0, 8($sp) +addi $a0, $a0, 1 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +lw $t0, 4($sp) +lw $t1, 8($sp) +lw $t4, 24($sp) +lw $t2, 16($t4) +bltz $t0, substr_error +li $a0, 0 +skip_char: +beq $a0, $t0, end_skip +addi $a0, $a0, 1 +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +j skip_char +end_skip: +li $a0, 0 +move $t3, $v0 +substr_copy: +beq $a0, $t1, end_substr_copy +li $t0, 0 +lb $t0, 0($t2) +sb $t0, 0($v0) +addi $t2, $t2, 1 +beq $t2, $zero, substr_error +addi $v0, $v0, 1 +addi $a0, $a0, 1 +j substr_copy +end_substr_copy: +sb $0, ($v0) +sw $t3, 12($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#CallNode String_init +move $t0, $sp +# Arg substr_result_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 20($sp) +#Return instance_3 +lw $a1, 16($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Bool_init: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Boolvalue = v +lw $t0, 4($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +String_equals: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr str1_0 = String.value +lw $t0, 16($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#GetAttr str2_1 = String.value +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#StringEquals str1_0 = str2_1 +lw $t1, 4($sp) +lw $t2, 8($sp) +compare_str: +li $t3, 0 +lb $t3, 0($t1) +li $t4, 0 +lb $t4, 0($t2) +seq $a0, $t3, $t4 +beqz $a0, end_compare_str +beqz $t3, end_compare_str +beqz $t4, end_compare_str +addi $t1, $t1, 1 +addi $t2, $t2, 1 +j compare_str +end_compare_str: +sw $a0, 12($sp) +#Return result_2 +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +List_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +List.isNil: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 12($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 16($sp) +#Return instance_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +List.cons: +addi $sp, $sp, -20 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 8($sp) +#AssignNode new_cell_2 = result_0 +lw $t1, 4($sp) +sw $t1, 12($sp) +#VCall init +move $t0, $sp +# Arg self +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg hd +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg new_cell_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 64($t2) +jal $t3 +sw $a1, 16($sp) +#AssignNode result_4 = result_3 +lw $t1, 16($sp) +sw $t1, 20($sp) +#Return result_4 +lw $a1, 20($sp) +lw $ra, 0($sp) +addi $sp, $sp, 32 +jr $ra +List.car: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Int_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 12($sp) +#Return result_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +List.cdr: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 16($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Allocate 2:tag List:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, List_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, List_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode List_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal List_init +sw $a1, 12($sp) +#Return result_1 +lw $a1, 8($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +List.rev: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall cdr +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +List.sort: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall cdr +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +List.insert: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall cdr +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +List.rcons: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall cdr +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 40($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +List.print_list: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall abort +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 0($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons_init: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode List_init +move $t0, $sp +# Arg self +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal List_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 12($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 16($sp) +#SetAttr Consxcar = instance_1 +lw $t0, 20($sp) +lw $t1, 8($sp) +sw $t1, 16($t0) +#SetAttr Consxcdr = void +lw $t0, 20($sp) +la $t1, void +sw $t1, 20($t0) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Cons.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Cons.init: +addi $sp, $sp, -8 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#SetAttr Consxcar = hd +lw $t0, 12($sp) +lw $t1, 16($sp) +sw $t1, 16($t0) +#SetAttr Consxcdr = tl +lw $t0, 12($sp) +lw $t1, 20($sp) +sw $t1, 20($t0) +#Return self +lw $a1, 12($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Cons.car: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 8($sp) +lw $t1, 16($t0) +sw $t1, 4($sp) +#Return Cons.xcar +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons.cdr: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 8($sp) +lw $t1, 20($t0) +sw $t1, 4($sp) +#Return Cons.xcdr +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Cons.rev: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 20($sp) +lw $t1, 20($t0) +sw $t1, 12($sp) +#VCall rev +move $t0, $sp +# Arg Cons.xcdr +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 8($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#VCall rcons +move $t0, $sp +# Arg Cons.xcar +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Cons.sort: +addi $sp, $sp, -16 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 20($sp) +lw $t1, 20($t0) +sw $t1, 12($sp) +#VCall sort +move $t0, $sp +# Arg Cons.xcdr +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 12($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 8($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 20($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#VCall insert +move $t0, $sp +# Arg Cons.xcar +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Cons.insert: +addi $sp, $sp, -64 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#GetAttr left_3 = Int.value +lw $t0, 72($sp) +lw $t1, 16($t0) +sw $t1, 16($sp) +#GetAttr right_4 = Int.value +lw $t0, 52($sp) +lw $t1, 16($t0) +sw $t1, 20($sp) +#BinaryOperator left_3 < right_4 +lw $a0, 16($sp) +lw $t1, 20($sp) +slt $a0, $a0, $t1 +sw $a0, 12($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 28($sp) +# IFGoto result_1 -> label_1 +lw $t0, 8($sp) +lw $a0, 16($t0) +bnez $a0, label_1 +#Allocate 3:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 40($sp) +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 68($sp) +lw $t1, 20($t0) +sw $t1, 48($sp) +#VCall insert +move $t0, $sp +# Arg i +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Cons.xcdr +lw $t1, 48($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 48($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 52($t2) +jal $t3 +sw $a1, 44($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 68($sp) +lw $t1, 16($t0) +sw $t1, 52($sp) +#VCall init +move $t0, $sp +# Arg result_10 +lw $t1, 44($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Cons.xcar +lw $t1, 52($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 36($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 64($t2) +jal $t3 +sw $a1, 32($sp) +#AssignNode result_0 = result_7 +lw $t1, 32($sp) +sw $t1, 4($sp) +#Goto label_2 +b label_2 +#LabelNode label_1 +label_1: +#Allocate 3:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 64($sp) +#VCall init +move $t0, $sp +# Arg self +lw $t1, 68($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i +lw $t1, 72($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 64($t2) +jal $t3 +sw $a1, 56($sp) +#AssignNode result_0 = result_13 +lw $t1, 56($sp) +sw $t1, 4($sp) +#LabelNode label_2 +label_2: +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 76 +jr $ra +Cons.rcons: +addi $sp, $sp, -24 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 12($sp) +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 28($sp) +lw $t1, 20($t0) +sw $t1, 20($sp) +#VCall rcons +move $t0, $sp +# Arg i +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Cons.xcdr +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 20($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 16($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 24($sp) +#VCall init +move $t0, $sp +# Arg result_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg Cons.xcar +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 64($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 36 +jr $ra +Cons.print_list: +addi $sp, $sp, -32 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#GetAttr Cons.xcar = Cons.xcar +lw $t0, 36($sp) +lw $t1, 16($t0) +sw $t1, 8($sp) +#VCall out_int +move $t0, $sp +# Arg Cons.xcar +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 36($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 16($t2) +jal $t3 +sw $a1, 4($sp) +#LoadStr msg_1 +la $t0, msg_1 +sw $t0, 16($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 20($sp) +#CallNode String_init +move $t0, $sp +# Arg l_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 24($sp) +#VCall out_string +move $t0, $sp +# Arg instance_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 36($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 12($sp) +#GetAttr Cons.xcdr = Cons.xcdr +lw $t0, 36($sp) +lw $t1, 20($t0) +sw $t1, 32($sp) +#VCall print_list +move $t0, $sp +# Arg Cons.xcdr +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 32($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 60($t2) +jal $t3 +sw $a1, 28($sp) +#Return result_6 +lw $a1, 28($sp) +lw $ra, 0($sp) +addi $sp, $sp, 40 +jr $ra +Nil_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode List_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal List_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Nil.isNil: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Nil.rev: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return self +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Nil.sort: +addi $sp, $sp, 0 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Return self +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 8 +jr $ra +Nil.insert: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#VCall rcons +move $t0, $sp +# Arg i +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 56($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 16 +jr $ra +Nil.rcons: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 8($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 12($sp) +#VCall init +move $t0, $sp +# Arg self +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg i +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 8($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 64($t2) +jal $t3 +sw $a1, 4($sp) +#Return result_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 24 +jr $ra +Nil.print_list: +addi $sp, $sp, -12 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 8($sp) +#CallNode Bool_init +move $t0, $sp +# Arg value_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 12($sp) +#Return instance_0 +lw $a1, 4($sp) +lw $ra, 0($sp) +addi $sp, $sp, 20 +jr $ra +Main_init: +addi $sp, $sp, -4 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#CallNode IO_init +move $t0, $sp +# Arg self +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal IO_init +sw $a1, 4($sp) +#Return None +move $a1, $zero +#SetAttr Mainl = void +lw $t0, 8($sp) +la $t1, void +sw $t1, 16($t0) +lw $ra, 0($sp) +addi $sp, $sp, 12 +jr $ra +Main.iota: +addi $sp, $sp, -116 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#Allocate 4:tag Nil:Class_name 4:Class_size +li $a0, 16 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Nil_name +sw $t1, 4($t0) +li $t1, 4 +sw $t1, 8($t0) +la $t1, Nil_methods +sw $t1, 12($t0) +sw $t0, 4($sp) +#CallNode Nil_init +move $t0, $sp +# Arg result_0 +lw $t1, 4($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Nil_init +sw $a1, 8($sp) +#SetAttr Mainl = result_0 +lw $t0, 120($sp) +lw $t1, 4($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 16($sp) +#LoadInt 0 +li $t0, 0 +sw $t0, 20($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_4 +lw $t1, 20($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_3 +lw $t1, 16($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 24($sp) +#AssignNode j_6 = instance_3 +lw $t1, 16($sp) +sw $t1, 28($sp) +#LabelNode label_3 +label_3: +#GetAttr left_10 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 44($sp) +#GetAttr right_11 = Int.value +lw $t0, 124($sp) +lw $t1, 16($t0) +sw $t1, 48($sp) +#BinaryOperator left_10 < right_11 +lw $a0, 44($sp) +lw $t1, 48($sp) +slt $a0, $a0, $t1 +sw $a0, 40($sp) +#Allocate 3:tag Bool:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Bool_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Bool_methods +sw $t1, 12($t0) +sw $t0, 36($sp) +#CallNode Bool_init +move $t0, $sp +# Arg op_9 +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Bool_init +sw $a1, 52($sp) +# IFGoto result_8 -> label_4 +lw $t0, 36($sp) +lw $a0, 16($t0) +bnez $a0, label_4 +#Goto label_5 +b label_5 +#LabelNode label_4 +label_4: +#Allocate 3:tag Cons:Class_name 6:Class_size +li $a0, 24 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 3 +sw $t1, 0($t0) +la $t1, Cons_name +sw $t1, 4($t0) +li $t1, 6 +sw $t1, 8($t0) +la $t1, Cons_methods +sw $t1, 12($t0) +sw $t0, 60($sp) +#CallNode Cons_init +move $t0, $sp +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Cons_init +sw $a1, 64($sp) +#GetAttr Main.l = Main.l +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#VCall init +move $t0, $sp +# Arg Main.l +lw $t1, 116($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg j_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_14 +lw $t1, 60($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 60($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 64($t2) +jal $t3 +sw $a1, 56($sp) +#SetAttr Mainl = result_13 +lw $t0, 120($sp) +lw $t1, 56($sp) +sw $t1, 16($t0) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 92($sp) +#LoadInt 1 +li $t0, 1 +sw $t0, 96($sp) +#CallNode Int_init +move $t0, $sp +# Arg value_23 +lw $t1, 96($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_22 +lw $t1, 92($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 100($sp) +#GetAttr left_20 = Int.value +lw $t0, 28($sp) +lw $t1, 16($t0) +sw $t1, 84($sp) +#GetAttr right_21 = Int.value +lw $t0, 92($sp) +lw $t1, 16($t0) +sw $t1, 88($sp) +#BinaryOperator left_20 + right_21 +lw $a0, 84($sp) +lw $t1, 88($sp) +add $a0, $a0, $t1 +sw $a0, 80($sp) +#Allocate 4:tag Int:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 4 +sw $t1, 0($t0) +la $t1, Int_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, Int_methods +sw $t1, 12($t0) +sw $t0, 76($sp) +#CallNode Int_init +move $t0, $sp +# Arg op_19 +lw $t1, 80($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg result_18 +lw $t1, 76($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal Int_init +sw $a1, 104($sp) +#AssignNode j_6 = result_18 +lw $t1, 76($sp) +sw $t1, 28($sp) +#Goto label_3 +b label_3 +#LabelNode label_5 +label_5: +#AssignNode result_27 = result_7 +lw $t1, 32($sp) +sw $t1, 112($sp) +#GetAttr Main.l = Main.l +lw $t0, 120($sp) +lw $t1, 16($t0) +sw $t1, 116($sp) +#Return Main.l +lw $a1, 116($sp) +lw $ra, 0($sp) +addi $sp, $sp, 128 +jr $ra +Main.main: +addi $sp, $sp, -36 +addi $sp, $sp, -4 +sw $ra, 0($sp) +#LoadStr msg_3 +la $t0, msg_3 +sw $t0, 8($sp) +#Allocate 2:tag String:Class_name 5:Class_size +li $a0, 20 +li $v0, 9 +syscall +bge $v0, $sp, heap_error +move $t0, $v0 +li $t1, 2 +sw $t1, 0($t0) +la $t1, String_name +sw $t1, 4($t0) +li $t1, 5 +sw $t1, 8($t0) +la $t1, String_methods +sw $t1, 12($t0) +sw $t0, 12($sp) +#CallNode String_init +move $t0, $sp +# Arg l_1 +lw $t1, 8($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +jal String_init +sw $a1, 16($sp) +#VCall out_string +move $t0, $sp +# Arg instance_2 +lw $t1, 12($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 12($t2) +jal $t3 +sw $a1, 4($sp) +#VCall in_int +move $t0, $sp +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 24($t2) +jal $t3 +sw $a1, 36($sp) +#VCall iota +move $t0, $sp +# Arg result_8 +lw $t1, 36($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +# Arg self +lw $t1, 40($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 40($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 28($t2) +jal $t3 +sw $a1, 32($sp) +#VCall rev +move $t0, $sp +# Arg result_7 +lw $t1, 32($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 32($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 44($t2) +jal $t3 +sw $a1, 28($sp) +#VCall sort +move $t0, $sp +# Arg result_6 +lw $t1, 28($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 28($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 48($t2) +jal $t3 +sw $a1, 24($sp) +#VCall print_list +move $t0, $sp +# Arg result_5 +lw $t1, 24($t0) +addi $sp, $sp, -4 +sw $t1, 0($sp) +lw $t1, 24($t0) +la $t0, void +beq $t1, $t0, dispatch_void_error +lw $t2, 12($t1) +lw $t3, 60($t2) +jal $t3 +sw $a1, 20($sp) +#Return result_4 +lw $a1, 20($sp) +lw $ra, 0($sp) +addi $sp, $sp, 44 +jr $ra \ No newline at end of file diff --git a/tests/codegen/sort-list_input.txt b/tests/codegen/sort-list_input.txt old mode 100644 new mode 100755 diff --git a/tests/codegen/sort-list_output.txt b/tests/codegen/sort-list_output.txt old mode 100644 new mode 100755 diff --git a/tests/codegen_test.py b/tests/codegen_test.py old mode 100644 new mode 100755 diff --git a/tests/conftest.py b/tests/conftest.py old mode 100644 new mode 100755 diff --git a/tests/lexer/comment1.cl b/tests/lexer/comment1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/comment1_error.txt b/tests/lexer/comment1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis1.cl b/tests/lexer/iis1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis1_error.txt b/tests/lexer/iis1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis2.cl b/tests/lexer/iis2.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis2_error.txt b/tests/lexer/iis2_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis3.cl b/tests/lexer/iis3.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis3_error.txt b/tests/lexer/iis3_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis4.cl b/tests/lexer/iis4.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis4_error.txt b/tests/lexer/iis4_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis5.cl b/tests/lexer/iis5.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis5_error.txt b/tests/lexer/iis5_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/iis6.cl b/tests/lexer/iis6.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/iis6_error.txt b/tests/lexer/iis6_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed1.cl b/tests/lexer/mixed1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed2.cl b/tests/lexer/mixed2.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/mixed2_error.txt b/tests/lexer/mixed2_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string1.cl b/tests/lexer/string1.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string1_error.txt b/tests/lexer/string1_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string2.cl b/tests/lexer/string2.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string2_error.txt b/tests/lexer/string2_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string3.cl b/tests/lexer/string3.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string3_error.txt b/tests/lexer/string3_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer/string4.cl b/tests/lexer/string4.cl old mode 100644 new mode 100755 diff --git a/tests/lexer/string4_error.txt b/tests/lexer/string4_error.txt old mode 100644 new mode 100755 diff --git a/tests/lexer_test.py b/tests/lexer_test.py old mode 100644 new mode 100755 diff --git a/tests/parser/assignment1.cl b/tests/parser/assignment1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/assignment1_error.txt b/tests/parser/assignment1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/assignment2.cl b/tests/parser/assignment2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/assignment2_error.txt b/tests/parser/assignment2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/assignment3.cl b/tests/parser/assignment3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/assignment3_error.txt b/tests/parser/assignment3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/attribute1.cl b/tests/parser/attribute1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/attribute1_error.txt b/tests/parser/attribute1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/attribute2.cl b/tests/parser/attribute2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/attribute2_error.txt b/tests/parser/attribute2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/attribute3.cl b/tests/parser/attribute3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/attribute3_error.txt b/tests/parser/attribute3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block1.cl b/tests/parser/block1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block1_error.txt b/tests/parser/block1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block2.cl b/tests/parser/block2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block2_error.txt b/tests/parser/block2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block3.cl b/tests/parser/block3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block3_error.txt b/tests/parser/block3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/block4.cl b/tests/parser/block4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/block4_error.txt b/tests/parser/block4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case1.cl b/tests/parser/case1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case1_error.txt b/tests/parser/case1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case2.cl b/tests/parser/case2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case2_error.txt b/tests/parser/case2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case3.cl b/tests/parser/case3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case3_error.txt b/tests/parser/case3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case4.cl b/tests/parser/case4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case4_error.txt b/tests/parser/case4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case5.cl b/tests/parser/case5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case5_error.txt b/tests/parser/case5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/case6.cl b/tests/parser/case6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/case6_error.txt b/tests/parser/case6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class1.cl b/tests/parser/class1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class1_error.txt b/tests/parser/class1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class2.cl b/tests/parser/class2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class2_error.txt b/tests/parser/class2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class3.cl b/tests/parser/class3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class3_error.txt b/tests/parser/class3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class4.cl b/tests/parser/class4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class4_error.txt b/tests/parser/class4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class5.cl b/tests/parser/class5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class5_error.txt b/tests/parser/class5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/class6.cl b/tests/parser/class6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/class6_error.txt b/tests/parser/class6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional1.cl b/tests/parser/conditional1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional1_error.txt b/tests/parser/conditional1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional2.cl b/tests/parser/conditional2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional2_error.txt b/tests/parser/conditional2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional3.cl b/tests/parser/conditional3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional3_error.txt b/tests/parser/conditional3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional4.cl b/tests/parser/conditional4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional4_error.txt b/tests/parser/conditional4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional5.cl b/tests/parser/conditional5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional5_error.txt b/tests/parser/conditional5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/conditional6.cl b/tests/parser/conditional6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/conditional6_error.txt b/tests/parser/conditional6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch1.cl b/tests/parser/dispatch1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch1_error.txt b/tests/parser/dispatch1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch2.cl b/tests/parser/dispatch2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch2_error.txt b/tests/parser/dispatch2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch3.cl b/tests/parser/dispatch3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch3_error.txt b/tests/parser/dispatch3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch4.cl b/tests/parser/dispatch4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch4_error.txt b/tests/parser/dispatch4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch5.cl b/tests/parser/dispatch5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch5_error.txt b/tests/parser/dispatch5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch6.cl b/tests/parser/dispatch6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch6_error.txt b/tests/parser/dispatch6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch7.cl b/tests/parser/dispatch7.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch7_error.txt b/tests/parser/dispatch7_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch8.cl b/tests/parser/dispatch8.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch8_error.txt b/tests/parser/dispatch8_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch9.cl b/tests/parser/dispatch9.cl old mode 100644 new mode 100755 diff --git a/tests/parser/dispatch9_error.txt b/tests/parser/dispatch9_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let1.cl b/tests/parser/let1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let1_error.txt b/tests/parser/let1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let2.cl b/tests/parser/let2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let2_error.txt b/tests/parser/let2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let3.cl b/tests/parser/let3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let3_error.txt b/tests/parser/let3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let4.cl b/tests/parser/let4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let4_error.txt b/tests/parser/let4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let5.cl b/tests/parser/let5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let5_error.txt b/tests/parser/let5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let6.cl b/tests/parser/let6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let6_error.txt b/tests/parser/let6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/let7.cl b/tests/parser/let7.cl old mode 100644 new mode 100755 diff --git a/tests/parser/let7_error.txt b/tests/parser/let7_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop1.cl b/tests/parser/loop1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop1_error.txt b/tests/parser/loop1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop2.cl b/tests/parser/loop2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop2_error.txt b/tests/parser/loop2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop3.cl b/tests/parser/loop3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop3_error.txt b/tests/parser/loop3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/loop4.cl b/tests/parser/loop4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/loop4_error.txt b/tests/parser/loop4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method1.cl b/tests/parser/method1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method1_error.txt b/tests/parser/method1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method2.cl b/tests/parser/method2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method2_error.txt b/tests/parser/method2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method3.cl b/tests/parser/method3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method3_error.txt b/tests/parser/method3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method4.cl b/tests/parser/method4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method4_error.txt b/tests/parser/method4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method5.cl b/tests/parser/method5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method5_error.txt b/tests/parser/method5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/method6.cl b/tests/parser/method6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/method6_error.txt b/tests/parser/method6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed1.cl b/tests/parser/mixed1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed1_error.txt b/tests/parser/mixed1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed2.cl b/tests/parser/mixed2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed2_error.txt b/tests/parser/mixed2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed3.cl b/tests/parser/mixed3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed3_error.txt b/tests/parser/mixed3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed4.cl b/tests/parser/mixed4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed4_error.txt b/tests/parser/mixed4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed5.cl b/tests/parser/mixed5.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed5_error.txt b/tests/parser/mixed5_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/mixed6.cl b/tests/parser/mixed6.cl old mode 100644 new mode 100755 diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation1.cl b/tests/parser/operation1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation1_error.txt b/tests/parser/operation1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation2.cl b/tests/parser/operation2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation2_error.txt b/tests/parser/operation2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation3.cl b/tests/parser/operation3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation3_error.txt b/tests/parser/operation3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/operation4.cl b/tests/parser/operation4.cl old mode 100644 new mode 100755 diff --git a/tests/parser/operation4_error.txt b/tests/parser/operation4_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/program1.cl b/tests/parser/program1.cl old mode 100644 new mode 100755 diff --git a/tests/parser/program1_error.txt b/tests/parser/program1_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/program2.cl b/tests/parser/program2.cl old mode 100644 new mode 100755 diff --git a/tests/parser/program2_error.txt b/tests/parser/program2_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser/program3.cl b/tests/parser/program3.cl old mode 100644 new mode 100755 diff --git a/tests/parser/program3_error.txt b/tests/parser/program3_error.txt old mode 100644 new mode 100755 diff --git a/tests/parser_test.py b/tests/parser_test.py old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic1.cl b/tests/semantic/arithmetic1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic10.cl b/tests/semantic/arithmetic10.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic10_error.txt b/tests/semantic/arithmetic10_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic11.cl b/tests/semantic/arithmetic11.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic11_error.txt b/tests/semantic/arithmetic11_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic12.cl b/tests/semantic/arithmetic12.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic12_error.txt b/tests/semantic/arithmetic12_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic1_error.txt b/tests/semantic/arithmetic1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic2.cl b/tests/semantic/arithmetic2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic2_error.txt b/tests/semantic/arithmetic2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic3.cl b/tests/semantic/arithmetic3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic3_error.txt b/tests/semantic/arithmetic3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic4.cl b/tests/semantic/arithmetic4.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic4_error.txt b/tests/semantic/arithmetic4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic5.cl b/tests/semantic/arithmetic5.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic5_error.txt b/tests/semantic/arithmetic5_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic6.cl b/tests/semantic/arithmetic6.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic6_error.txt b/tests/semantic/arithmetic6_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic7.cl b/tests/semantic/arithmetic7.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic7_error.txt b/tests/semantic/arithmetic7_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic8.cl b/tests/semantic/arithmetic8.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic8_error.txt b/tests/semantic/arithmetic8_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic9.cl b/tests/semantic/arithmetic9.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/arithmetic9_error.txt b/tests/semantic/arithmetic9_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/assignment1.cl b/tests/semantic/assignment1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/assignment1_error.txt b/tests/semantic/assignment1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/assignment2.cl b/tests/semantic/assignment2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/assignment2_error.txt b/tests/semantic/assignment2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/assignment3.cl b/tests/semantic/assignment3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/assignment3_error.txt b/tests/semantic/assignment3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes1.cl b/tests/semantic/attributes1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes1_error.txt b/tests/semantic/attributes1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes2.cl b/tests/semantic/attributes2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes2_error.txt b/tests/semantic/attributes2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes3.cl b/tests/semantic/attributes3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes3_error.txt b/tests/semantic/attributes3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes4.cl b/tests/semantic/attributes4.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/attributes4_error.txt b/tests/semantic/attributes4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics1.cl b/tests/semantic/basics1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics1_error.txt b/tests/semantic/basics1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics2.cl b/tests/semantic/basics2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics2_error.txt b/tests/semantic/basics2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics3.cl b/tests/semantic/basics3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics3_error.txt b/tests/semantic/basics3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics4.cl b/tests/semantic/basics4.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics4_error.txt b/tests/semantic/basics4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics5.cl b/tests/semantic/basics5.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics5_error.txt b/tests/semantic/basics5_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics6.cl b/tests/semantic/basics6.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics6_error.txt b/tests/semantic/basics6_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics7.cl b/tests/semantic/basics7.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics7_error.txt b/tests/semantic/basics7_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/basics8.cl b/tests/semantic/basics8.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/basics8_error.txt b/tests/semantic/basics8_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/blocks1.cl b/tests/semantic/blocks1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/blocks1_error.txt b/tests/semantic/blocks1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/case1.cl b/tests/semantic/case1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/case1_error.txt b/tests/semantic/case1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/case2.cl b/tests/semantic/case2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/case2_error.txt b/tests/semantic/case2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/case3.cl b/tests/semantic/case3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/case3_error.txt b/tests/semantic/case3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/class1.cl b/tests/semantic/class1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/class1_error.txt b/tests/semantic/class1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/conditionals1.cl b/tests/semantic/conditionals1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/conditionals1_error.txt b/tests/semantic/conditionals1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/conditionals2.cl b/tests/semantic/conditionals2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/conditionals2_error.txt b/tests/semantic/conditionals2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch1.cl b/tests/semantic/dispatch1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch1_error.txt b/tests/semantic/dispatch1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch2.cl b/tests/semantic/dispatch2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch2_error.txt b/tests/semantic/dispatch2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch3.cl b/tests/semantic/dispatch3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch3_error.txt b/tests/semantic/dispatch3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch4.cl b/tests/semantic/dispatch4.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch4_error.txt b/tests/semantic/dispatch4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch5.cl b/tests/semantic/dispatch5.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch5_error.txt b/tests/semantic/dispatch5_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch6.cl b/tests/semantic/dispatch6.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/dispatch6_error.txt b/tests/semantic/dispatch6_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/eq1.cl b/tests/semantic/eq1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/eq1_error.txt b/tests/semantic/eq1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/eq2.cl b/tests/semantic/eq2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/eq2_error.txt b/tests/semantic/eq2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/eq3.cl b/tests/semantic/eq3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/eq3_error.txt b/tests/semantic/eq3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/eq4.cl b/tests/semantic/eq4.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/eq4_error.txt b/tests/semantic/eq4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/inheritance3_error.txt b/tests/semantic/inheritance3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/inheritance4_error.txt b/tests/semantic/inheritance4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/inheritance5_error.txt b/tests/semantic/inheritance5_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/isvoid1.cl b/tests/semantic/isvoid1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/isvoid1_error.txt b/tests/semantic/isvoid1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/let1.cl b/tests/semantic/let1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/let1_error.txt b/tests/semantic/let1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/let2.cl b/tests/semantic/let2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/let2_error.txt b/tests/semantic/let2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/let3.cl b/tests/semantic/let3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/let3_error.txt b/tests/semantic/let3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/loops1.cl b/tests/semantic/loops1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/loops1_error.txt b/tests/semantic/loops1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/loops2.cl b/tests/semantic/loops2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/loops2_error.txt b/tests/semantic/loops2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods1.cl b/tests/semantic/methods1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods1_error.txt b/tests/semantic/methods1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods2.cl b/tests/semantic/methods2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods2_error.txt b/tests/semantic/methods2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods3.cl b/tests/semantic/methods3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods3_error.txt b/tests/semantic/methods3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods4.cl b/tests/semantic/methods4.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods4_error.txt b/tests/semantic/methods4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods5.cl b/tests/semantic/methods5.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods5_error.txt b/tests/semantic/methods5_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods6.cl b/tests/semantic/methods6.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods6_error.txt b/tests/semantic/methods6_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods7.cl b/tests/semantic/methods7.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods7_error.txt b/tests/semantic/methods7_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/methods8.cl b/tests/semantic/methods8.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/methods8_error.txt b/tests/semantic/methods8_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/new1.cl b/tests/semantic/new1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/new1_error.txt b/tests/semantic/new1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/self1.cl b/tests/semantic/self1.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/self1_error.txt b/tests/semantic/self1_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/self2.cl b/tests/semantic/self2.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/self2_error.txt b/tests/semantic/self2_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/self3.cl b/tests/semantic/self3.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/self3_error.txt b/tests/semantic/self3_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic/self4.cl b/tests/semantic/self4.cl old mode 100644 new mode 100755 diff --git a/tests/semantic/self4_error.txt b/tests/semantic/self4_error.txt old mode 100644 new mode 100755 diff --git a/tests/semantic_test.py b/tests/semantic_test.py old mode 100644 new mode 100755 diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py old mode 100644 new mode 100755 diff --git a/tests/utils/utils.py b/tests/utils/utils.py old mode 100644 new mode 100755