diff --git a/.gitignore b/.gitignore index 4acafde1..0a7b0c0d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,410 +1,280 @@ -# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig - -# Created by https://www.gitignore.io/api/visualstudiocode,linux,latex,python -# Edit at https://www.gitignore.io/?templates=visualstudiocode,linux,latex,python - -### LaTeX ### -## Core latex/pdflatex auxiliary files: -*.aux -*.lof -*.log -*.lot -*.fls -*.out -*.toc -*.fmt -*.fot -*.cb -*.cb2 -.*.lb - -## Intermediate documents: -*.dvi -*.xdv -*-converted-to.* -# these rules might exclude image files for figures etc. -# *.ps -# *.eps -# *.pdf - -## Generated if empty string is given at "Please type another file name for output:" -.pdf - -## Bibliography auxiliary files (bibtex/biblatex/biber): -*.bbl -*.bcf -*.blg -*-blx.aux -*-blx.bib -*.run.xml - -## Build tool auxiliary files: -*.fdb_latexmk -*.synctex -*.synctex(busy) -*.synctex.gz -*.synctex.gz(busy) -*.pdfsync - -## Build tool directories for auxiliary files -# latexrun -latex.out/ - -## Auxiliary and intermediate files from other packages: -# algorithms -*.alg -*.loa - -# achemso -acs-*.bib - -# amsthm -*.thm - -# beamer -*.nav -*.pre -*.snm -*.vrb - -# changes -*.soc - -# comment -*.cut - -# cprotect -*.cpt - -# elsarticle (documentclass of Elsevier journals) -*.spl - -# endnotes -*.ent - -# fixme -*.lox - -# feynmf/feynmp -*.mf -*.mp -*.t[1-9] -*.t[1-9][0-9] -*.tfm - -#(r)(e)ledmac/(r)(e)ledpar -*.end -*.?end -*.[1-9] -*.[1-9][0-9] -*.[1-9][0-9][0-9] -*.[1-9]R -*.[1-9][0-9]R -*.[1-9][0-9][0-9]R -*.eledsec[1-9] -*.eledsec[1-9]R -*.eledsec[1-9][0-9] -*.eledsec[1-9][0-9]R -*.eledsec[1-9][0-9][0-9] -*.eledsec[1-9][0-9][0-9]R - -# glossaries -*.acn -*.acr -*.glg -*.glo -*.gls -*.glsdefs - -# uncomment this for glossaries-extra (will ignore makeindex's style files!) -# *.ist - -# gnuplottex -*-gnuplottex-* - -# gregoriotex -*.gaux -*.gtex - -# htlatex -*.4ct -*.4tc -*.idv -*.lg -*.trc -*.xref - -# hyperref -*.brf - -# knitr -*-concordance.tex -# TODO Comment the next line if you want to keep your tikz graphics files -*.tikz -*-tikzDictionary - -# listings -*.lol - -# luatexja-ruby -*.ltjruby - -# makeidx -*.idx -*.ilg -*.ind - -# minitoc -*.maf -*.mlf -*.mlt -*.mtc[0-9]* -*.slf[0-9]* -*.slt[0-9]* -*.stc[0-9]* - -# minted -_minted* -*.pyg - -# morewrites -*.mw - -# nomencl -*.nlg -*.nlo -*.nls - -# pax -*.pax - -# pdfpcnotes -*.pdfpc - -# sagetex -*.sagetex.sage -*.sagetex.py -*.sagetex.scmd - -# scrwfile -*.wrt - -# sympy -*.sout -*.sympy -sympy-plots-for-*.tex/ - -# pdfcomment -*.upa -*.upb - -# pythontex -*.pytxcode -pythontex-files-*/ - -# tcolorbox -*.listing - -# thmtools -*.loe - -# TikZ & PGF -*.dpth -*.md5 -*.auxlock - -# todonotes -*.tdo - -# vhistory -*.hst -*.ver - -# easy-todo -*.lod - -# xcolor -*.xcp - -# xmpincl -*.xmpi - -# xindy -*.xdy - -# xypic precompiled matrices -*.xyc - -# endfloat -*.ttt -*.fff - -# Latexian -TSWLatexianTemp* - -## Editors: -# WinEdt -*.bak -*.sav - -# Texpad -.texpadtmp - -# LyX -*.lyx~ - -# Kile -*.backup - -# KBibTeX -*~[0-9]* - -# auto folder when using emacs and auctex -./auto/* -*.el - -# expex forward references with \gathertags -*-tags.tex - -# standalone packages -*.sta - -### LaTeX Patch ### -# glossaries -*.glstex - -### Linux ### -*~ - -# temporary files which can be created if a process still has a handle open of a deleted file -.fuse_hidden* - -# KDE directory preferences -.directory - -# Linux trash folder which might appear on any partition or disk -.Trash-* - -# .nfs files are created when an open file is removed but is still being accessed -.nfs* - -### Python ### -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# celery beat schedule file -celerybeat-schedule - -# SageMath parsed files -*.sage.py - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# Mr Developer -.mr.developer.cfg -.project -.pydevproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -### VisualStudioCode ### -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -### VisualStudioCode Patch ### -# Ignore all local history of files -.history - -# End of https://www.gitignore.io/api/visualstudiocode,linux,latex,python - -# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) - +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# Pycharm +.idea/ + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +.dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ diff --git a/.idea/cool-compiler-2020.iml b/.idea/cool-compiler-2020.iml new file mode 100644 index 00000000..e7c5b03b --- /dev/null +++ b/.idea/cool-compiler-2020.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..ba00af5c --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..4decd4ab --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..9661ac71 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..b0d290eb --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,281 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1600909677361 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Readme.md b/src/Readme.md index 1200371b..cdca282e 100644 --- a/src/Readme.md +++ b/src/Readme.md @@ -1,78 +1,78 @@ -# COOL: Proyecto de Compilación - -La evaluación de la asignatura Complementos de Compilación, inscrita en el programa del 4to año de la Licenciatura en Ciencia de la Computación de la Facultad de Matemática y Computación de la -Universidad de La Habana, consiste este curso en la implementación de un compilador completamente -funcional para el lenguaje _COOL_. - -_COOL (Classroom Object-Oriented Language)_ es un pequeño lenguaje que puede ser implementado con un esfuerzo razonable en un semestre del curso. Aun así, _COOL_ mantiene muchas de las características de los lenguajes de programación modernos, incluyendo orientación a objetos, tipado estático y manejo automático de memoria. - -### Sobre el Lenguaje COOL - -Ud. podrá encontrar la especificación formal del lenguaje COOL en el documento _"COOL Language Reference Manual"_, que se distribuye junto con el presente texto. - -## Código Fuente - -### Compilando su proyecto - -Si es necesario compilar su proyecto, incluya todas las instrucciones necesarias en un archivo [`/src/makefile`](/src/makefile). -Durante la evaluación su proyecto se compilará ejecutando la siguiente secuencia: - -```bash -$ cd source -$ make clean -$ make -``` - -### Ejecutando su proyecto - -Incluya en un archivo [`/src/coolc.sh`](/src/coolc.sh) todas las instrucciones que hacen falta para lanzar su compilador. Recibirá como entrada un archivo con extensión `.cl` y debe generar como salida un archivo `.mips` cuyo nombre será el mismo que la entrada. - -Para lanzar el compilador, se ejecutará la siguiente instrucción: - -```bash -$ cd source -$ ./coolc.sh -``` - -### Sobre el Compilador de COOL - -El compilador de COOL se ejecutará como se ha definido anteriormente. -En caso de que no ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código de salida 0, generar (o sobrescribir si ya existe) en la misma carpeta del archivo **.cl** procesado, y con el mismo nombre que éste, un archivo con extension **.mips** que pueda ser ejecutado con **spim**. Además, reportar a la salida estándar solamente lo siguiente: - - - - -En caso de que ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código -de salida (exit code) 1 y reportar a la salida estándar (standard output stream) lo que sigue... - - - - _1 - ... - _n - -... donde `_i` tiene el siguiente formato: - - (,) - : - -Los campos `` y `` indican la ubicación del error en el fichero **.cl** procesado. En caso -de que la naturaleza del error sea tal que no pueda asociárselo a una línea y columna en el archivo de -código fuente, el valor de dichos campos debe ser 0. - -El campo `` será alguno entre: - -- `CompilerError`: se reporta al detectar alguna anomalía con la entrada del compilador. Por ejemplo, si el fichero a compilar no existe. -- `LexicographicError`: errores detectados por el lexer. -- `SyntacticError`: errores detectados por el parser. -- `NameError`: se reporta al referenciar un `identificador` en un ámbito en el que no es visible. -- `TypeError`: se reporta al detectar un problema de tipos. Incluye: - - incompatibilidad de tipos entre `rvalue` y `lvalue`, - - operación no definida entre objetos de ciertos tipos, y - - tipo referenciado pero no definido. -- `AttributeError`: se reporta cuando un atributo o método se referencia pero no está definido. -- `SemanticError`: cualquier otro error semántico. - -### Sobre la Implementación del Compilador de COOL - -El compilador debe estar implementado en `python`. Usted debe utilizar una herramienta generadora de analizadores -lexicográficos y sintácticos. Puede utilizar la que sea de su preferencia. +# COOL: Proyecto de Compilación + +La evaluación de la asignatura Complementos de Compilación, inscrita en el programa del 4to año de la Licenciatura en Ciencia de la Computación de la Facultad de Matemática y Computación de la +Universidad de La Habana, consiste este curso en la implementación de un compilador completamente +funcional para el lenguaje _COOL_. + +_COOL (Classroom Object-Oriented Language)_ es un pequeño lenguaje que puede ser implementado con un esfuerzo razonable en un semestre del curso. Aun así, _COOL_ mantiene muchas de las características de los lenguajes de programación modernos, incluyendo orientación a objetos, tipado estático y manejo automático de memoria. + +### Sobre el Lenguaje COOL + +Ud. podrá encontrar la especificación formal del lenguaje COOL en el documento _"COOL Language Reference Manual"_, que se distribuye junto con el presente texto. + +## Código Fuente + +### Compilando su proyecto + +Si es necesario compilar su proyecto, incluya todas las instrucciones necesarias en un archivo [`/src/makefile`](/src/makefile). +Durante la evaluación su proyecto se compilará ejecutando la siguiente secuencia: + +```bash +$ cd source +$ make clean +$ make +``` + +### Ejecutando su proyecto + +Incluya en un archivo [`/src/coolc.sh`](/src/coolc.sh) todas las instrucciones que hacen falta para lanzar su compilador. Recibirá como entrada un archivo con extensión `.cl` y debe generar como salida un archivo `.mips` cuyo nombre será el mismo que la entrada. + +Para lanzar el compilador, se ejecutará la siguiente instrucción: + +```bash +$ cd source +$ ./coolc.sh +``` + +### Sobre el Compilador de COOL + +El compilador de COOL se ejecutará como se ha definido anteriormente. +En caso de que no ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código de salida 0, generar (o sobrescribir si ya existe) en la misma carpeta del archivo **.cl** procesado, y con el mismo nombre que éste, un archivo con extension **.mips** que pueda ser ejecutado con **spim**. Además, reportar a la salida estándar solamente lo siguiente: + + + + +En caso de que ocurran errores durante la operación del compilador, **coolc.sh** deberá terminar con código +de salida (exit code) 1 y reportar a la salida estándar (standard output stream) lo que sigue... + + + + _1 + ... + _n + +... donde `_i` tiene el siguiente formato: + + (,) - : + +Los campos `` y `` indican la ubicación del error en el fichero **.cl** procesado. En caso +de que la naturaleza del error sea tal que no pueda asociárselo a una línea y columna en el archivo de +código fuente, el valor de dichos campos debe ser 0. + +El campo `` será alguno entre: + +- `CompilerError`: se reporta al detectar alguna anomalía con la entrada del compilador. Por ejemplo, si el fichero a compilar no existe. +- `LexicographicError`: errores detectados por el lexer. +- `SyntacticError`: errores detectados por el parser. +- `NameError`: se reporta al referenciar un `identificador` en un ámbito en el que no es visible. +- `TypeError`: se reporta al detectar un problema de tipos. Incluye: + - incompatibilidad de tipos entre `rvalue` y `lvalue`, + - operación no definida entre objetos de ciertos tipos, y + - tipo referenciado pero no definido. +- `AttributeError`: se reporta cuando un atributo o método se referencia pero no está definido. +- `SemanticError`: cualquier otro error semántico. + +### Sobre la Implementación del Compilador de COOL + +El compilador debe estar implementado en `python`. Usted debe utilizar una herramienta generadora de analizadores +lexicográficos y sintácticos. Puede utilizar la que sea de su preferencia. diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/codegen/__init__.py b/src/codegen/__init__.py new file mode 100644 index 00000000..055a4f8a --- /dev/null +++ b/src/codegen/__init__.py @@ -0,0 +1,26 @@ +from codegen.visitors.cil_visitor import COOLToCILVisitor +from codegen.visitors.cil_format_visitor import get_formatter +from codegen.visitors.mips_visitor import CILToMIPSVistor +from pprint import pprint + +def codegen_pipeline(context, ast, scope, debug=False): + if debug: + print('============= TRANSFORMING TO CIL =============') + cool_to_cil = COOLToCILVisitor(context) + cil_ast = cool_to_cil.visit(ast, scope) + if debug: + formatter = get_formatter() + with open('test.cil', 'w+') as fd: + fd.write(formatter(cil_ast)) + inherit_graph = context.build_inheritance_graph() + # pprint(inherit_graph) + data_code, text_code = CILToMIPSVistor(inherit_graph).visit(cil_ast) + return get_code(data_code, text_code, False) + +def get_code(data_code, text_code, debug): + text = '\n'.join(text_code) + '\n' + '\n'.join(data_code) + if debug: + print(text) + with open('test.asm', 'w+') as fd: + fd.write(text) + return text \ No newline at end of file diff --git a/src/codegen/__pycache__/__init__.cpython-37.pyc b/src/codegen/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 00000000..5e35dcee Binary files /dev/null and b/src/codegen/__pycache__/__init__.cpython-37.pyc differ diff --git a/src/codegen/__pycache__/cil_ast.cpython-37.pyc b/src/codegen/__pycache__/cil_ast.cpython-37.pyc new file mode 100644 index 00000000..710ce862 Binary files /dev/null and b/src/codegen/__pycache__/cil_ast.cpython-37.pyc differ diff --git a/src/codegen/__pycache__/pipeline.cpython-37.pyc b/src/codegen/__pycache__/pipeline.cpython-37.pyc new file mode 100644 index 00000000..f0470319 Binary files /dev/null and b/src/codegen/__pycache__/pipeline.cpython-37.pyc differ diff --git a/src/codegen/cil_ast.py b/src/codegen/cil_ast.py new file mode 100644 index 00000000..177bdc67 --- /dev/null +++ b/src/codegen/cil_ast.py @@ -0,0 +1,358 @@ +class Node: + pass + +class ProgramNode(Node): + def __init__(self, dottypes, dotdata, dotcode, idx=None): + self.dottypes = dottypes + self.dotdata = dotdata + self.dotcode = dotcode + self.index = idx + +class TypeNode(Node): + def __init__(self, name, atributes=None, methods=None, idx=None): + self.name = name + self.attributes = atributes if atributes is not None else [] + self.methods = methods if methods is not None else [] + self.index = idx + +class DataNode(Node): + def __init__(self, vname, value, idx=None): + self.name = vname + self.value = value + self.index = idx + + +class FunctionNode(Node): + def __init__(self, fname, params, localvars, instructions, idx=None): + self.name = fname + self.params = params + self.localvars = localvars + self.instructions = instructions + self.index = idx + +class ParamNode(Node): + def __init__(self, name, typex, idx=None): + self.name = name + self.type = typex + self.index = idx + +class LocalNode(Node): + def __init__(self, name, idx=None): + self.name = name + self.index = idx + +class InstructionNode(Node): + def __init__(self, idx=None): + self.in1 = None + self.in2 = None + self.out = None + self.index = idx + +class AssignNode(InstructionNode): + def __init__(self, dest, source, idx=None): + super().__init__(idx) + self.dest = dest + self.source = source + + self.in1 = source + self.out = dest + +class UnaryNode(InstructionNode): + def __init__(self, dest, expr, idx=None): + super().__init__(idx) + self.dest = dest + self.expr = expr + + self.in1 = expr + self.out = dest + +class NotNode(UnaryNode): + pass + +class LogicalNotNode(UnaryNode): + pass + +class BinaryNode(InstructionNode): + def __init__(self, dest, left, right, idx=None): + super().__init__(idx) + self.dest = dest + self.left = left + self.right = right + + self.in1 = left + self.in2 = right + self.out = dest + +class PlusNode(BinaryNode): + pass + +class MinusNode(BinaryNode): + pass + +class StarNode(BinaryNode): + pass + +class DivNode(BinaryNode): + pass + +class LessNode(BinaryNode): + pass + +class LessEqNode(BinaryNode): + pass + +class EqualNode(BinaryNode): + pass + +class GetAttribNode(InstructionNode): + def __init__(self, obj, attr, typex, dest, attr_type, idx=None): + super().__init__(idx) + self.obj = obj + self.attr = attr + self.type_name = typex + # self.attr_offset = offset + self.dest = dest + self.attr_type = attr_type + + self.out = dest + self.in1 = obj + +class SetAttribNode(InstructionNode): + def __init__(self, obj, attr, typex, value, idx=None): + super().__init__(idx) + self.obj = obj + self.attr = attr + # self.attr_offset = offset + self.value = value + self.type_name = typex + + self.out = obj + self.in1 = value + +class GetIndexNode(InstructionNode): + pass + +class SetIndexNode(InstructionNode): + pass + +class AllocateNode(InstructionNode): + def __init__(self, itype, dest, idx=None): + super().__init__(idx) + self.type = itype + self.dest = dest + + self.out = dest + +class ArrayNode(InstructionNode): + pass + +class TypeOfNode(InstructionNode): + def __init__(self, obj, dest, idx=None): + super().__init__(idx) + self.obj = obj + self.dest = dest + + self.out = dest + self.in1 = obj + +class LabelNode(InstructionNode): + def __init__(self, label, idx=None): + super().__init__(idx) + self.label = label + +class GotoNode(InstructionNode): + def __init__(self, label, idx=None): + super().__init__(idx) + self.label = label + +class GotoIfNode(InstructionNode): + def __init__(self, cond, label, idx=None): + super().__init__(idx) + self.cond = cond + self.label = label + + self.in1 = cond + +class GotoIfFalseNode(InstructionNode): + def __init__(self, cond, label, idx=None): + super().__init__(idx) + self.cond = cond + self.label = label + + self.in1 = cond + +class StaticCallNode(InstructionNode): + def __init__(self, xtype, function, dest, args, return_type, idx=None): + super().__init__(idx) + self.type = xtype + self.function = function + self.dest = dest + self.args = args + self.return_type = return_type + + self.out = dest + +class DynamicCallNode(InstructionNode): + def __init__(self, xtype, obj, method, dest, args, return_type, idx=None): + super().__init__(idx) + self.type = xtype + self.method = method + self.dest = dest + self.args = args + self.return_type = return_type + self.obj = obj + + self.out = dest + self.in1 = obj + +class ArgNode(InstructionNode): + def __init__(self, name, idx=None): + super().__init__(idx) + self.dest = name + + self.out = name + +class ReturnNode(InstructionNode): + def __init__(self, value, idx=None): + super().__init__(idx) + self.value = value + + self.out = value + +class LoadNode(InstructionNode): + def __init__(self, dest, msg, idx=None): + super().__init__(idx) + self.dest = dest + self.msg = msg + + self.out = dest + +class LengthNode(InstructionNode): + def __init__(self, dest, arg, idx=None): + super().__init__(idx) + self.dest = dest + self.arg = arg + + self.out = dest + self.in1 = arg + +class ConcatNode(InstructionNode): + def __init__(self, dest, arg1, arg2, idx=None): + super().__init__(idx) + self.dest = dest + self.arg1 = arg1 + self.arg2 = arg2 + + self.out = dest + self.in1 = arg1 + self.in2 = arg2 + +class PrefixNode(InstructionNode): + def __init__(self, dest, word, n, idx=None): + super().__init__(idx) + self.dest = dest + self.word = word + self.n = n + + self.out = dest + self.in1 = word + self.in2 = n + +class SubstringNode(InstructionNode): + def __init__(self, dest, word, begin, end, idx=None): + super().__init__(idx) + self.dest = dest + self.begin = begin + self.word = word + self.end = end + + self.out = dest + self.in1 = begin + self.in2 = end + +class ToStrNode(InstructionNode): + def __init__(self, dest, ivalue, idx=None): + super().__init__(idx) + self.dest = dest + self.ivalue = ivalue + + self.out = dest + self.in1 = ivalue + +class OutStringNode(InstructionNode): + def __init__(self, value, idx=None): + super().__init__(idx) + self.value = value + + self.in1 = value + +class OutIntNode(InstructionNode): + def __init__(self, value, idx=None): + super().__init__(idx) + self.value = value + + self.in1 = value + +class ReadStringNode(InstructionNode): + def __init__(self, dest, idx=None): + super().__init__(idx) + self.dest = dest + + self.out = dest + +class ReadIntNode(InstructionNode): + def __init__(self, dest, idx=None): + super().__init__(idx) + self.dest = dest + + self.out = dest + +class ExitNode(InstructionNode): + def __init__(self, classx, value=0, idx=None): + super().__init__(idx) + self.classx = classx # instance of the method that called the class + self.value = value + + self.in1 = value + self.in2 = classx + +class CopyNode(InstructionNode): + def __init__(self, dest, source, idx=None): + super().__init__(idx) + self.dest = dest + self.source = source + + self.out = dest + self.in1 = source + +class ConformsNode(InstructionNode): + "Checks if the type of expr conforms to type2" + def __init__(self, dest, expr, type2, idx=None): + super().__init__(idx) + self.dest = dest + self.expr = expr + self.type = type2 + + self.out = dest + self.in1 = expr # is a string, so is always a variable + +class VoidConstantNode(InstructionNode): + def __init__(self, obj, idx=None): + super().__init__(idx) + self.obj = obj + + self.out = obj + +class ErrorNode(InstructionNode): + "Generic class to report errors in mips" + def __init__(self, typex, idx=None): + super().__init__(idx) + self.type = typex + +class BoxingNode(InstructionNode): + def __init__(self, dest, type_name, idx=None): + super().__init__(idx) + self.dest = dest + self.type = type_name + + self.out = dest diff --git a/src/codegen/cil_built_in.py b/src/codegen/cil_built_in.py new file mode 100644 index 00000000..28486b29 --- /dev/null +++ b/src/codegen/cil_built_in.py @@ -0,0 +1,3 @@ + +from codegen.cil_ast import * + diff --git a/src/codegen/tools.py b/src/codegen/tools.py new file mode 100644 index 00000000..6430a883 --- /dev/null +++ b/src/codegen/tools.py @@ -0,0 +1,216 @@ +from typing import List, Dict +from enum import Enum +from collections import OrderedDict +import re + +class SymbolTabEntry: + def __init__(self, name, is_live=False, next_use=None): + self.name = name + self.is_live = is_live + self.next_use = next_use + +class SymbolTable: + def __init__(self, entries:List[SymbolTabEntry]=None): + values = entries if entries is not None else [] + self.entries = {v.name: v for v in values} + + def lookup(self, entry_name: str) -> SymbolTabEntry: + if entry_name != None: + if entry_name in self.entries.keys(): + return self.entries[entry_name] + + def insert(self, entry: SymbolTabEntry): + self.entries[entry.name] = entry + + def insert_name(self, name): + self.entries[name] = SymbolTabEntry(name) + + def __getitem__(self, item): + return self.entries[item] + + def __iter__(self): + return iter(self.entries) + + +class NextUseEntry: + """For each line : for all three variables involved their next use and is live information""" + def __init__(self, in1, in2, out, in1nextuse, in2nextuse, outnextuse, in1islive, in2islive, outislive): + self.in1 = in1 + self.in2 = in2 + self.out = out + self.in1nextuse = in1nextuse + self.in2nextuse = in2nextuse + self.outnextuse = outnextuse + self.in1islive = in1islive + self.in2islive = in2islive + self.outislive = outislive + +class AddrType(Enum): + REF = 1, + STR = 2, + BOOL = 3, + INT = 4, + VOID = 5 + +class AddressDescriptor: + 'Stores the location of each variable' + def __init__(self): + self.vars = {} + + def insert_var(self, name, address, register=None, stack=None): + if address is not None: + self.vars[name] = [4*address, register, stack] + else: + self.vars[name] = [address, register, stack] + + + def get_var_addr(self, name): + return self.vars[name][0] + + def set_var_addr(self, name, addr): + self.vars[name][0] = 4*addr + + def get_var_reg(self, var): + return self.vars[var][1] + + def set_var_reg(self, name, reg): + self.vars[name][1] = reg + + def get_var_stack(self, name): + return self.vars[name][2] + + def set_var_stack(self, name, stack_pos): + self.vars[name][1] = stack_pos + + def get_var_storage(self, name): + return self.vars[name] + +class RegisterType(Enum): + TEMP = 0 + GLOBAL = 1 + ARG = 2 + RETURN = 3 + +class RegisterDescriptor: + 'Stores the contents of each register' + def __init__(self): + registers = ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7', 'a1', 'a2', 'a3', \ + 's0', 's1', 's2', 's3', 's4', 's5', 's6', 's7', 'v1'] + self.registers = {reg: None for reg in registers} + + def insert_register(self, register:str, content:str): + self.registers[register] = content + + def get_content(self, register: str): + return self.registers[register] + + def find_empty_reg(self): + for k, v in self.registers.items(): + if v is None: + return k + + def used_registers(self): + return [(k, v) for k, v in self.registers.items() if v is not None] + + def empty_registers(self): + for k in self.registers: + self.registers[k] = None + + +class DispatchTable: + def __init__(self): + self.classes = OrderedDict() + self.regex = re.compile(r'function_(.+)_\w+') + + def add_class(self, type_name, methods): + self.classes[type_name] = methods + + def get_offset(self, type_name, method): + return self.classes[type_name].index(method) + + def find_full_name(self, type_name, mth_name): + for meth in self.classes[type_name]: + # format of methods: 'function_{method_name}_{type_name}' + name = self.regex.search(meth).groups()[0] + if name == mth_name: + return meth + return None + + def get_methods(self, type_name): + "Returns all the methods of a specific type" + return self.classes[type_name] + + def __len__(self): + return len(self.classes) + + +class ObjTabEntry: + def __init__(self, name, methods, attrs): + self.class_tag: str = name + self.size: int = 3 + len(attrs) + self.dispatch_table_size = len(methods) + self.dispatch_table_entry = methods + self.attrs = attrs + + @property + def class_tag_offset(self): + return 0 + + @property + def size_offset(self): + return 1 + + @property + def dispatch_ptr_offset(self): + return 2 + + def attr_offset(self, attr): + return self.attrs.index(attr) + 3 + + def method_offset(self, meth): + "Method offset in dispatch table" + return self.dispatch_table_entry.index(meth) + + +class ObjTable: + def __init__(self, dispatch_table: DispatchTable): + self.objects: Dict[str, ObjTabEntry] = {} #self.initialize_built_in() + self.dispatch_table = dispatch_table + + def initialize_built_in(self): + object_methods = [ + 'function_abort_Object', + 'function_type_name_Object', + 'function_copy_Object'] + io_methods = [ + 'function_out_string_IO', + 'function_out_int_IO', + 'function_in_string_IO', + 'function_in_int_IO'] + str_methods = [ + 'function_length_String', + 'function_concat_String', + 'function_substr_String' ] + return { + 'Int': ObjTabEntry('Int', [], []), + 'Bool': ObjTabEntry('Bool', [], []), + 'IO': ObjTabEntry('IO', io_methods, []), + 'String': ObjTabEntry('String', str_methods, []), + 'Object': ObjTabEntry('Object', object_methods, []) + } + + def add_entry(self, name, methods, attrs): + methods = [y for x, y in methods] + attrs = [x for x, y in attrs] + self.objects[name] = ObjTabEntry(name, methods, attrs) + # Adding the methods in the dispatch table + self.dispatch_table.add_class(name, methods) + + def size_of_entry(self, name): + return self.objects[name].size + + def __getitem__(self, item) -> ObjTabEntry: + return self.objects[item] + + def __iter__(self): + return iter(self.objects.values()) \ No newline at end of file diff --git a/src/codegen/visitors/__pycache__/base_cil_visitor.cpython-37.pyc b/src/codegen/visitors/__pycache__/base_cil_visitor.cpython-37.pyc new file mode 100644 index 00000000..d6d1e3f4 Binary files /dev/null and b/src/codegen/visitors/__pycache__/base_cil_visitor.cpython-37.pyc differ diff --git a/src/codegen/visitors/__pycache__/cil_format_visitor.cpython-37.pyc b/src/codegen/visitors/__pycache__/cil_format_visitor.cpython-37.pyc new file mode 100644 index 00000000..662e8c14 Binary files /dev/null and b/src/codegen/visitors/__pycache__/cil_format_visitor.cpython-37.pyc differ diff --git a/src/codegen/visitors/__pycache__/cil_visitor.cpython-37.pyc b/src/codegen/visitors/__pycache__/cil_visitor.cpython-37.pyc new file mode 100644 index 00000000..bacd2a9c Binary files /dev/null and b/src/codegen/visitors/__pycache__/cil_visitor.cpython-37.pyc differ diff --git a/src/codegen/visitors/base_cil_visitor.py b/src/codegen/visitors/base_cil_visitor.py new file mode 100644 index 00000000..5c3e191e --- /dev/null +++ b/src/codegen/visitors/base_cil_visitor.py @@ -0,0 +1,284 @@ +from codegen.cil_ast import ParamNode, LocalNode, FunctionNode, TypeNode, DataNode +from semantic.tools import VariableInfo, Scope, Context +from semantic.types import Type, StringType, ObjectType, IOType, Method, Attribute +from codegen import cil_ast as cil +from utils.ast import BinaryNode, UnaryNode, AssignNode, ProgramNode +import re + +class BaseCOOLToCILVisitor: + def __init__(self, context): + self.dottypes = [] + self.dotdata = [] + self.dotcode = [] + self.current_type: Type = None + self.current_method: Method = None + self.current_function = None + self.context: Context = context + self.idx = 0 + # self.name_regex = re.compile('local_[^_]+_[^_]+_(.+)_\d+') + self.constructors = [] + self.void_data = None + self.inherit_graph = {} + + @property + def index(self): + i = self.idx + self.idx += 1 + return i + + @property + def params(self): + return self.current_function.params + + @property + def localvars(self): + return self.current_function.localvars + + @property + def instructions(self): + return self.current_function.instructions + + def register_param(self, vname, vtype): + name = f'param_{self.current_function.name[9:]}_{vname}_{len(self.params)}' + param_node = ParamNode(vname, vtype, self.index) + self.params.append(param_node) + return vname + + def register_local(self, vname): + name = f'local_{self.current_function.name[9:]}_{vname}_{len(self.localvars)}' + local_node = LocalNode(name, self.index) + self.localvars.append(local_node) + return name + + def define_internal_local(self): + return self.register_local('internal') + + def register_instruction(self, instruction): + self.instructions.append(instruction) + instruction.index = self.index + return instruction + + def to_attr_name(self, attr_name, type_name): + return f'attribute_{attr_name}_{type_name}' + + def to_function_name(self, method_name, type_name): + return f'function_{method_name}_{type_name}' + + def to_var_name(self, var_name): + regex = re.compile(f'local_{self.current_function.name[9:]}_(.+)_\d+') + for node in reversed(self.localvars): + m = regex.match(node.name).groups()[0] + if m == var_name: + return node.name + for node in self.params: + if node.name == var_name: + return var_name + return None + + def register_function(self, function_name): + function_node = FunctionNode(function_name, [], [], [], self.index) + self.dotcode.append(function_node) + return function_node + + def register_type(self, name): + type_node = TypeNode(name) + self.dottypes.append(type_node) + return type_node + + def register_data(self, value): + vname = f'data_{len(self.dotdata)}' + data_node = DataNode(vname, value, self.index) + self.dotdata.append(data_node) + return data_node + + def _define_binary_node(self, node: BinaryNode, scope: Scope, cil_node: cil.Node): + result = self.define_internal_local() + left, typex = self.visit(node.left, scope) + right, typex = self.visit(node.right, scope) + self.register_instruction(cil_node(result, left, right)) + return result, typex + + def _define_unary_node(self, node: UnaryNode, scope: Scope, cil_node): + result = self.define_internal_local() + expr, typex = self.visit(node.expr, scope) + self.register_instruction(cil_node(result, expr)) + return result, typex + + def initialize_attr(self, constructor, attr: Attribute, scope: Scope): + if attr.expr: + constructor.body.expr_list.append(AssignNode(attr.name, attr.expr)) + elif attr.type == 'Int': + constructor.body.expr_list.append(AssignNode(attr.name, ConstantNumNode(0))) + elif attr.type == 'Bool': + constructor.body.expr_list.append(AssignNode(attr.name, ConstantBoolNode(False))) + elif attr.type == 'String': + constructor.body.expr_list.append(AssignNode(attr.name, ConstantStrNode(""))) + else: + constructor.body.expr_list.append(AssignNode(attr.name, ConstantVoidNode(atrr.name))) + + def create_built_in(self): + + # ---------------------------------- Object Functions ---------------------------------- # + f1_params = [ParamNode("self", 'Object')] + f1_localVars = [LocalNode("local_abort_Object_self_0")] + f1_intructions = [cil.AssignNode(f1_localVars[0].name,f1_params[0].name, self.index), + cil.ExitNode(f1_params[0].name, idx=self.index)] + f1 = FunctionNode("function_abort_Object",f1_params,f1_localVars,f1_intructions) + + f2_params = [ParamNode("self", 'Object')] + f2_localVars = [LocalNode("local_type_name_Object_result_0")] + f2_intructions = [cil.TypeOfNode(f2_params[0].name,f2_localVars[0].name, self.index), + cil.ReturnNode(f2_localVars[0].name, self.index)] + f2 = FunctionNode("function_type_name_Object",f2_params,f2_localVars,f2_intructions) + + f3_params = [ParamNode("self", 'Object')] + f3_localVars = [LocalNode("local_copy_Object_result_0")] + f3_intructions = [cil.CopyNode(f3_localVars[0].name,f3_params[0].name, self.index), + cil.ReturnNode(f3_localVars[0].name, self.index)] + f3 = FunctionNode("function_copy_Object",f3_params,f3_localVars,f3_intructions) + + # ---------------------------------- IO Functions ---------------------------------- # + f4_params = [ParamNode("self", 'IO'), ParamNode("word", 'String')] + f4_localVars = [LocalNode("local_out_string_String_self_0")] + f4_intructions = [cil.AssignNode(f4_localVars[0].name, f4_params[0].name, self.index), + cil.OutStringNode(f4_params[1].name, self.index), + cil.ReturnNode(f4_localVars[0].name, self.index)] + f4 = FunctionNode("function_out_string_IO",f4_params,f4_localVars,f4_intructions) + + f5_params = [ParamNode("self", 'IO'),ParamNode("number", 'Int')] + f5_localVars = [LocalNode("local_out_int_IO_self_0")] + f5_intructions = [cil.AssignNode(f5_localVars[0].name,f5_params[0].name, self.index), + cil.OutIntNode(f5_params[1].name, self.index), + cil.ReturnNode(f5_localVars[0].name, self.index)] + f5 = FunctionNode("function_out_int_IO",f5_params,f5_localVars,f5_intructions) + + f6_params = [ParamNode("self", 'IO')] + f6_localVars = [LocalNode("local_in_int_IO_result_0")] + f6_intructions = [cil.ReadIntNode(f6_localVars[0].name, self.index), + cil.ReturnNode(f6_localVars[0].name, self.index)] + f6 = FunctionNode("function_in_int_IO",f6_params,f6_localVars,f6_intructions) + + f7_params = [ParamNode("self", 'IO')] + f7_localVars = [LocalNode("local_in_string_IO_result_0")] + f7_intructions = [cil.ReadStringNode(f7_localVars[0].name, self.index), + cil.ReturnNode(f7_localVars[0].name, self.index)] + f7 = FunctionNode("function_in_string_IO",f7_params,f7_localVars,f7_intructions) + + # ---------------------------------- String Functions ---------------------------------- # + f8_params = [ParamNode("self", 'String')] + f8_localVars = [LocalNode("local_length_String_result_0")] + f8_intructions = [cil.LengthNode(f8_localVars[0].name,f8_params[0].name, self.index), + cil.ReturnNode(f8_localVars[0].name, self.index)] + f8 = FunctionNode("function_length_String",f8_params,f8_localVars,f8_intructions) + + f9_params = [ParamNode("self", 'String'),ParamNode("word", 'String')] + f9_localVars = [LocalNode("local_concat_String_result_0")] + f9_intructions = [cil.ConcatNode(f9_localVars[0].name,f9_params[0].name,f9_params[1].name, self.index), + cil.ReturnNode(f9_localVars[0].name, self.index)] + f9 = FunctionNode("function_concat_String",f9_params,f9_localVars,f9_intructions) + + f10_params = [ParamNode("self", 'String'),ParamNode("begin", 'Int'),ParamNode("end", 'Int')] + f10_localVars = [LocalNode("local_substr_String_result_0")] + f10_intructions = [cil.SubstringNode(f10_localVars[0].name,f10_params[0].name,f10_params[1].name,f10_params[2].name, self.index), + cil.ReturnNode(f10_localVars[0].name, self.index)] + f10 = FunctionNode("function_substr_String",f10_params,f10_localVars,f10_intructions) + + f11_params = [ParamNode("self", 'String')] + f11_localVars = [LocalNode("local_type_name_String_result_0")] + f11_intructions = [cil.LoadNode(f11_localVars[0].name, 'type_String', self.index), + cil.ReturnNode(f11_localVars[0].name, self.index)] + f11 = FunctionNode("function_type_name_String",f11_params,f11_localVars,f11_intructions) + + f12_params = [ParamNode("self", 'String')] + f12_localVars = [LocalNode("local_copy_String_result_0")] + f12_intructions = [cil.ConcatNode(f12_localVars[0].name, f12_params[0].name, None, self.index), + cil.ReturnNode(f12_localVars[0].name, self.index)] + f12 = FunctionNode("function_copy_String",f12_params,f12_localVars,f12_intructions) + + f17_params = [ParamNode("self", 'String')] + f17_localVars = [LocalNode('local_abort_String_msg_0')] + f17_intructions = [cil.LoadNode(f17_params[0].name, 'string_abort'), + cil.OutStringNode(f17_params[0].name, self.index), + cil.ExitNode(f17_params[0].name, idx=self.index)] + f17 = FunctionNode("function_abort_String",f17_params,f17_localVars,f17_intructions) + + # ---------------------------------- Int Functions ---------------------------------- # + f13_params = [ParamNode("self", 'Int')] + f13_localVars = [LocalNode("local_type_name_Int_result_0")] + f13_intructions = [cil.LoadNode(f13_localVars[0].name, 'type_Int', self.index), + cil.ReturnNode(f13_localVars[0].name, self.index)] + f13 = FunctionNode("function_type_name_Int",f13_params,f13_localVars,f13_intructions) + + f14_params = [ParamNode("self", 'Int')] + f14_localVars = [LocalNode("local_copy_Int_result_0")] + f14_intructions = [cil.AssignNode(f14_localVars[0].name, f14_params[0].name), + cil.ReturnNode(f14_localVars[0].name, self.index)] + f14 = FunctionNode("function_copy_Int",f14_params,f14_localVars,f14_intructions) + + f18_params = [ParamNode("self", 'Int')] + f18_localVars = [LocalNode('local_abort_Int_msg_0')] + f18_intructions = [cil.LoadNode(f18_params[0].name, 'int_abort'), + cil.OutStringNode(f18_params[0].name, self.index), + cil.ExitNode(f18_params[0].name, idx=self.index)] + f18 = FunctionNode("function_abort_Int",f18_params,f18_localVars,f18_intructions) + + # ---------------------------------- Bool Functions ---------------------------------- # + f15_params = [ParamNode("self", 'Bool')] + f15_localVars = [LocalNode("local_type_name_Bool_result_0")] + f15_intructions = [cil.LoadNode(f15_localVars[0].name, 'type_Bool', self.index), + cil.ReturnNode(f15_localVars[0].name, self.index)] + f15 = FunctionNode("function_type_name_Bool",f15_params,f15_localVars,f15_intructions) + + f16_params = [ParamNode("self", 'Bool')] + f16_localVars = [LocalNode("local_copy_result_Bool_0")] + f16_intructions = [cil.AssignNode(f16_localVars[0].name, f16_params[0].name), + cil.ReturnNode(f16_localVars[0].name, self.index)] + f16 = FunctionNode("function_copy_Bool",f16_params,f16_localVars,f16_intructions) + + f19_params = [ParamNode("self", 'Bool')] + f19_localVars = [LocalNode('local_abort_Bool_msg_0')] + f19_intructions = [cil.LoadNode(f19_params[0].name, 'bool_abort'), + cil.OutStringNode(f19_params[0].name, self.index), + cil.ExitNode(f19_params[0].name, idx=self.index)] + f19 = FunctionNode("function_abort_Bool",f19_params,f19_localVars,f19_intructions) + + + self.dotcode += [f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11, f12, f13, f14, f15, f16, f17, f18, f19] + object_methods = [('abort', f1.name), ('type_name', f2.name), ('copy', f3.name)] + string_methods = [('length', f8.name), ('concat', f9.name), ('substr', f10.name), ('abort', f17.name), ('type_name', f11.name), ('copy', f12.name)] + io_methods = [('out_string', f4.name), ('out_int', f5.name), ('in_int', f6.name), ('in_string', f7.name)] + int_methods = [('abort', f18.name), ('type_name', f13.name), ('copy', f14.name)] + bool_methods = [('abort', f19.name), ('type_name', f15.name), ('copy', f16.name)] + + self.dottypes += [TypeNode("Object", [], object_methods), + TypeNode("IO", [], object_methods + io_methods) , + TypeNode("String", [], string_methods), + TypeNode('Int', [], int_methods), + TypeNode('Bool', [], bool_methods)] + + def sort_option_nodes_by_type(self, case_list): + "Sort option nodes from specific types to more general types" + return sorted(case_list, reverse=True, + key=lambda x: self.context.get_depth(x.typex)) + + def check_void(self, expr): + result = self.define_internal_local() + self.register_instruction(cil.TypeOfNode(expr, result)) + + void_expr = self.define_internal_local() + self.register_instruction(cil.LoadNode(void_expr, self.void_data)) + self.register_instruction(cil.EqualNode(result, result, void_expr)) + return result + + def handle_arguments(self, args, scope, param_types): + args_node = [] + args = [self.visit(arg, scope) for arg in args] + + for (arg, typex), param_type in zip(args, param_types): + if typex.name in ['String', 'Int', 'Bool'] and param_type.name == 'Object': + auxiliar = self.define_internal_local() + self.register_instruction(cil.BoxingNode(auxiliar, typex.name)) + else: + auxiliar = arg + args_node.append(cil.ArgNode(auxiliar, self.index)) + return args_node \ No newline at end of file diff --git a/src/codegen/visitors/base_mips_visitor.py b/src/codegen/visitors/base_mips_visitor.py new file mode 100644 index 00000000..f234241b --- /dev/null +++ b/src/codegen/visitors/base_mips_visitor.py @@ -0,0 +1,466 @@ +from codegen.cil_ast import * +from codegen.tools import * +from semantic.tools import VariableInfo +from semantic.types import Attribute +from typing import List + +class BaseCILToMIPSVisitor: + def __init__(self, inherit_graph): + self.code: list = ['.text', '.globl main', 'main:'] + self.initialize_data_code() + # self.initialize_built_in_types() + self.symbol_table = SymbolTable() + # temp registers: t9, voy a usarlo para llevarlo de temporal en expresiones aritmeticas + # Not sure if i should only use local registers + self.reg_desc = RegisterDescriptor() + self.addr_desc = AddressDescriptor() + + self.dispatch_table: DispatchTable = DispatchTable() + self.obj_table: ObjTable = ObjTable(self.dispatch_table) + self.initialize_methods() + self.load_abort_messages() + # Will hold the type of any of the vars + self.var_address = {'self': AddrType.REF} + + self.loop_idx = 0 # to count the generic loops in the app + self.first_defined = {'strcopier': True} # bool to keep in account when the first defined string function was defined + self.inherit_graph = inherit_graph + self.space_idx = 0 + + def initialize_methods(self): + self.methods = [] + # Built in methods added + for entry in self.obj_table: + entry: ObjTabEntry + self.methods.extend(entry.dispatch_table_entry) + + def initialize_data_code(self): + self.data_code = ['.data'] + + def initialize_runtime_errors(self): + self.code.append('# Raise exception method') + self.code.append('.raise:') + # Waits in $a0 error msg + self.code.append('li $v0, 4') + # Prints error message + self.code.append('syscall') + + self.code.append('li $v0, 17') + self.code.append('li $a0, 1') + # Exists + self.code.append('syscall\n') + + self.data_code.append('zero_error: .asciiz \"Division by zero error\n\"') + self.data_code.append('case_void_error: .asciiz \"Case on void error\n\"') + self.data_code.append('dispatch_error: .asciiz \"Dispatch on void error\n\"' ) + self.data_code.append('case_error: .asciiz \"Case statement without a matching branch error\n\"' ) + self.data_code.append('index_error: .asciiz \"Substring out of range error\n\"') + self.data_code.append('heap_error: .asciiz \"Heap overflow error\n\"') # no idea how to check for this + + + def load_abort_messages(self): + self.data_code.append("abort_msg: .asciiz \"Abort called from class \"") # guarda el nombre de Void Type + self.data_code.append(f"new_line: .asciiz \"\n\"") # guarda el nombre de Void Type + self.data_code.append('string_abort: .asciiz \"Abort called from class String\n\"') + self.data_code.append('int_abort: .asciiz \"Abort called from class Int\n\"') + self.data_code.append('bool_abort: .asciiz \"Abort called from class Bool\n\"') + + + def get_basic_blocks(self, instructions: List[InstructionNode]): + leaders = self.find_leaders(instructions) + blocks = [instructions[leaders[i-1]:leaders[i]] for i in range(1, len(leaders))] + return blocks + + + def find_leaders(self, instructions: List[InstructionNode]): + "Returns the positions in the block that are leaders" + leaders = {0, len(instructions)} + for i, inst in enumerate(instructions): + if isinstance(inst, GotoNode) or isinstance(inst, GotoIfNode) or isinstance(inst, ReturnNode) \ + or isinstance(inst, StaticCallNode) or isinstance(inst, DynamicCallNode): + leaders.add(i+1) + elif isinstance(inst, LabelNode) or isinstance(inst, FunctionNode): + leaders.add(i) + return sorted(list(leaders)) + + def is_variable(self, expr): + return isinstance(expr, str) + + def is_int(self, expr): + return isinstance(expr, int) + + def is_void(self, expr): + return isinstance(expr, VoidConstantNode) + + def add_entry_symb_tab(self, name): + "Method to add a entry in the symbol table. (Local)" + self.symbol_table.insert(name) + + def construct_next_use(self, basic_blocks: List[List[InstructionNode]]): + next_use = {} + for basic_block in basic_blocks: + #Flush Symbol table's nextuse islive information + for x in self.symbol_table: + self.symbol_table[x].is_live = False + self.symbol_table[x].next_use = None + + for inst in reversed(basic_block): + in1 = inst.in1 if self.is_variable(inst.in1) else None + in2 = inst.in2 if self.is_variable(inst.in2) else None + out = inst.out if self.is_variable(inst.out) else None + + in1nextuse = None + in2nextuse = None + outnextuse = None + in1islive = False + in2islive = False + outislive = False + + entry_in1 = self.symbol_table.lookup(in1) + entry_in2 = self.symbol_table.lookup(in2) + entry_out = self.symbol_table.lookup(out) + if out is not None: + if entry_out is not None: + outnextuse = entry_out.next_use + outislive = entry_out.is_live + else: + # Esto no debería pasar + entry_out = SymbolTabEntry(out) + entry_out.next_use = None + entry_out.is_live = False + self.symbol_table.insert(entry_out) + if in1 is not None: + if entry_in1 is not None: + in1nextuse = entry_in1.next_use + in1islive = entry_in1.is_live + else: + # Esto no debería pasar + entry_in1 = SymbolTabEntry(out) + entry_in1.next_use = inst.index + entry_in1.is_live = True + self.symbol_table.insert(entry_in1) + if in2 is not None: + if entry_in2 is not None: + in2nextuse = entry_in2.next_use + in2islive = entry_in2.is_live + else: + # Esto no debería pasar + entry_in2 = SymbolTabEntry(in2) + entry_in2.next_use = inst.index + entry_in2.is_live = True + self.symbol_table.insert(entry_in2) + + n_entry = NextUseEntry(in1, in2, out, in1nextuse, in2nextuse, outnextuse, in1islive, in2islive, outislive) + next_use[inst.index] = n_entry + return next_use + + def get_reg(self, inst: InstructionNode): + if self.is_variable(inst.in1): + in1_reg = self.get_reg_var(inst.in1) + if self.is_variable(inst.in2): + in2_reg = self.get_reg_var(inst.in2) + + # Comprobar si se puede usar uno de estos registros tambien para el destino + nu_entry = self.next_use[inst.index] + if nu_entry.in1islive and nu_entry.in1nextuse < inst.index: + self.update_register(inst.out, in1_reg) + return + if nu_entry.in2islive and nu_entry.in2nextuse < inst.index: + self.update_register(inst.out, in2_reg) + return + # Si no buscar un registro para z por el otro procedimiento + if self.is_variable(inst.out): + self.get_reg_var(inst.out) + + + def get_reg_var(self, var): + curr_inst = self.inst + register = self.addr_desc.get_var_reg(var) + if register is not None: # ya la variable está en un registro + return register + + var_st = self.symbol_table.lookup(var) + register = self.reg_desc.find_empty_reg() + if register is not None: + self.update_register(var, register) + self.load_var_code(var) + return register + + next_use = self.next_use[inst.index] + # Choose a register that requires the minimal number of load and store instructions + score = self.initialize_score() # keeps the score of each variable (the amount of times a variable in a register is used) + for inst in self.block[1:]: + inst: InstructionNode + if self.is_variable(inst.in1) and inst.in1 not in [curr_inst.in1, curr_inst.in2, curr_inst.out] and next_use.in1islive: + self._update_score(score, inst.in1) + if self.is_variable(inst.in2) and inst.in2 not in [curr_inst.in1, curr_inst.in2, curr_inst.out] and next_use.in2islive: + self._update_score(score, inst.in2) + if self.is_variable(inst.out) and inst.out not in [curr_inst.in1, curr_inst.in2, curr_inst.out] and next_use.outislive: + self._update_score(score, inst.out) + + # Chooses the one that is used less + register = min(score, key=lambda x: score[x]) + + # register, memory, _ = self.addr_desc.get_var_storage(n_var) + + self.update_register(var, register) + self.load_var_code(var) + return register + + def initialize_score(self): + score = {} + for reg in self.reg_desc.registers: + score[reg] = 0 + try: + reg = self.addr_desc.get_var_reg(self.inst.in1) + if reg: + score[reg] = 999 + except: pass + try: + reg = self.addr_desc.get_var_reg(self.inst.in2) + if reg: + score[reg] = 999 + except: pass + try: + reg = self.addr_desc.get_var_reg(self.inst.out) + if reg: + score[reg] = 999 + except: pass + return score + + def _update_score(self, score, var): + reg = self.addr_desc.get_var_reg(var) + if reg is None: + return + try: + score[reg] += 1 + except: + score[reg] = 1 + + def update_register(self, var, register): + content = self.reg_desc.get_content(register) + if content is not None: + self.save_var_code(content) + self.addr_desc.set_var_reg(content, None) + self.reg_desc.insert_register(register, var) + self.addr_desc.set_var_reg(var, register) + + def save_var_code(self, var): + "Code to save a variable to memory" + memory, register, _= self.addr_desc.get_var_storage(var) + self.code.append(f"sw ${register}, -{memory}($fp)") + + def load_var_code(self, var): + "Code to load a variable from memory" + memory, register, _ = self.addr_desc.get_var_storage(var) + self.code.append(f'lw ${register}, -{memory}($fp)') + + def load_used_reg(self, registers): + "Loads the used variables in there registers" + for reg in used_reg: + self.code.append('addiu $sp, $sp, 4') + self.code.append(f'lw ${reg}, ($sp)') + + def empty_registers(self, save=True): + "Empty all used registers and saves there values to memory" + registers = self.reg_desc.used_registers() + for reg, var in registers: + if save: + self.save_var_code(var) + self.addr_desc.set_var_reg(var, None) + self.reg_desc.insert_register(reg, None) + + def push_register(self, register): + "Pushes the register to the stack" + self.code.append(f'sw ${register}, ($sp)') + self.code.append('addiu $sp, $sp, -4') + + def pop_register(self, register): + "Popes the register from the stack" + self.code.append('addiu $sp, $sp, 4') + self.code.append(f'lw ${register}, ($sp)') + + def save_to_register(self, expr): + "Aditional code to save an expression into a register. Returns the register" + if self.is_int(expr): + self.code.append(f'li $t9, {expr}') + return 't9' + elif self.is_variable(expr): + return self.addr_desc.get_var_reg(expr) + + def get_attr_offset(self, attr_name:str, type_name:str): + return self.obj_table[type_name].attr_offset(attr_name) + + def get_method_offset(self, type_name, method_name): + self.obj_table[type_name].method_offset(method_name) + + def save_meth_addr(self, func_nodes: List[FunctionNode]): + self.methods += [funct.name for funct in func_nodes] + words = 'methods: .word ' + ', '.join(map(lambda x: '0', self.methods)) + self.data_code.append(words) + # guardo la dirección del método en el array de métodos + self.code.append('# Save method directions in the methods array') + self.code.append('la $v0, methods') + for i, meth in enumerate(self.methods): + self.code.append(f'la $t9, {meth}') + self.code.append(f'sw $t9, {4*i}($v0)') + + def save_types_addr(self, type_nodes: List[FunctionNode]): + "Saves the structure where the type information is stored" + words = 'types: .word ' + ', '.join(map(lambda x: '0', self.inherit_graph)) + self.data_code.append(words) + self.code.append('# Save types directions in the types array') + self.code.append('la $t9, types') + self.types = [] + self.code.append('# Save space to locate the type info') + for i, (ntype, nparent) in enumerate(self.inherit_graph.items()): + self.code.append('# Allocating memory') + self.code.append('li $v0, 9') + self.code.append(f'li $a0, 12') + self.code.append('syscall') + self.types.append(ntype) + + self.code.append('# Filling table methods') + self.code.append(f'la $t8, type_{ntype}') + self.code.append(f'sw $t8, 0($v0)') + + self.code.append('# Copying direction to array') + self.code.append(f'sw $v0, {4*i}($t9)') + + self.code.append('# Table addr is now stored in t8') + self.code.append('move $t8, $v0') + self.code.append('# Creating the dispatch table') + self.create_dispatch_table(ntype) # table addr is stored in $v0 + self.code.append('sw $v0, 8($t8)') + + + # self.code.append('la $t9, types') + self.code.append('# Copying parents') + for i, ntype in enumerate(self.types): + self.code.append(f'lw $v0, {4*i}($t9)') + # self.code.append('lw $v0, 0($t8)') + nparent = self.inherit_graph[ntype] + if nparent is not None: + parent_idx = self.types.index(nparent) + + self.code.append(f'lw $t8, {4*parent_idx}($t9)') + else: + self.code.append('li $t8, 0') + self.code.append('sw $t8, 4($v0)') + + def create_dispatch_table(self, type_name): + # Get methods of the dispatch table + methods = self.dispatch_table.get_methods(type_name) + # Allocate the dispatch table in the heap + self.code.append('# Allocate dispatch table in the heap') + self.code.append('li $v0, 9') # code to request memory + dispatch_table_size = 4*len(methods) + self.code.append(f'li $a0, {dispatch_table_size+4}') + self.code.append('syscall') # Memory of the dispatch table in v0 + + var = self.save_reg_if_occupied('v1') + + self.code.append(f'# I save the offset of every one of the methods of this type') + self.code.append('# Save the direction of methods') + self.code.append('la $v1, methods') # cargo la dirección de methods + for i, meth in enumerate(methods, 1): + # guardo el offset de cada uno de los métodos de este tipo + + offset = 4*self.methods.index(meth) + self.code.append(f'# Save the direction of the method {meth} in a0') + self.code.append(f'lw $a0, {offset}($v1)') # cargo la dirección del método en t9 + self.code.append('# Save the direction of the method in his position in the dispatch table') + self.code.append(f'sw $a0, {4*i}($v0)') # guardo la direccion del metodo en su posicion en el dispatch table + self.load_var_if_occupied(var) + + def get_type(self, xtype): + 'Return the var address type according to its static type' + if xtype == 'Int': + return AddrType.INT + elif xtype == 'Bool': + return AddrType.BOOL + elif xtype == 'String': + return AddrType.STR + return AddrType.REF + + def save_reg_if_occupied(self, reg): + var = self.reg_desc.get_content(reg) + if var is not None: + self.code.append(f'# Saving content of {reg} to memory to use that register') + self.save_var_code(var) + return var + + def load_var_if_occupied(self, var): + if var is not None: + self.code.append(f'# Restore the variable of {var}') + self.load_var_code(var) + + def compare_strings(self, node: EqualNode): + rdest = self.addr_desc.get_var_reg(node.dest) + rleft = self.addr_desc.get_var_reg(node.left) + rright = self.addr_desc.get_var_reg(node.right) + + var = self.save_reg_if_occupied('a1') + loop_idx = self.loop_idx + + self.code.append(f'move $t8, ${rleft}') # counter + self.code.append(f'move $t9, ${rright}') + self.code.append(f'loop_{loop_idx}:') + self.code.append(f'lb $a0, ($t8)') # load byte from each string + self.code.append(f'lb $a1, ($t9)') + self.code.append(f'beqz $a0, check_{loop_idx}') # str1 ended + self.code.append(f'beqz $a1, mismatch_{loop_idx}') # str2 ended when str1 hasnt ended + self.code.append('seq $v0, $a0, $a1') # compare two bytes + self.code.append(f'beqz $v0, mismatch_{loop_idx}') # bytes are different + self.code.append('addi $t8, $t8, 1') # Point to the next byte of str + self.code.append('addi $t9, $t9, 1') + self.code.append(f'j loop_{loop_idx}') + + self.code.append(f'mismatch_{loop_idx}:') + self.code.append('li $v0, 0') + self.code.append(f'j end_{loop_idx}') + self.code.append(f'check_{loop_idx}:') + self.code.append(f'bnez $a1, mismatch_{loop_idx}') + self.code.append('li $v0, 1') + self.code.append(f'end_{loop_idx}:') + self.code.append(f'move ${rdest}, $v0') + self.load_var_if_occupied(var) + self.loop_idx += 1 + + def conforms_to(self, rsrc, rdest, type_name): + "Returns if the object in rsrc conforms to type_name" + self.code.append(f'la $t9, type_{type_name}') + + loop_idx = self.loop_idx + self.code.append(f'lw $v0, 8(${rsrc})') # saves the direction to the type info table + self.code.append(f'loop_{loop_idx}:') + self.code.append(f'move $t8, $v0') # Saves parent addr + self.code.append(f'beqz $t8, false_{loop_idx}') + self.code.append('lw $v1, 0($t8)') + self.code.append(f'beq $t9, $v1, true_{loop_idx}') + self.code.append('lw $v0, 4($t8)') + self.code.append(f'j loop_{loop_idx}') + + self.code.append(f'true_{loop_idx}:') + self.code.append(f'li ${rdest}, 1') + self.code.append(f'j end_{loop_idx}') + self.code.append(f'false_{loop_idx}:') + self.code.append(f'li ${rdest}, 0') + self.code.append(f'end_{loop_idx}:') + self.loop_idx += 1 + + def value_conforms_to_obj(self, rdest, typex, branch_type): + self.code.append('# Comparing value types in case node') + true_label = f'true_{self.loop_idx}' + end_label = f'end_{self.loop_idx}' + self.code.append('la $t9, type_Object') # si es de tipo object entonces se conforma + self.code.append(f'la $t8, type_{branch_type}') + self.code.append(f'beq $t9, $t8, {true_label}') + self.code.append(f'la $t9, type_{typex}') # si es del mismo tipo que él entonces se conforma + self.code.append(f'beq $t9, $t8, {true_label}') + self.code.append(f'li ${rdest}, 0') + self.code.append(f'j {end_label}') + self.code.append(f'{true_label}:') + self.code.append(f'li ${rdest}, 1') + self.code.append(f'{end_label}:') + self.loop_idx += 1 \ No newline at end of file diff --git a/src/codegen/visitors/cil_format_visitor.py b/src/codegen/visitors/cil_format_visitor.py new file mode 100644 index 00000000..fdb3ef32 --- /dev/null +++ b/src/codegen/visitors/cil_format_visitor.py @@ -0,0 +1,193 @@ +from utils import visitor +from codegen.cil_ast import * + +def get_formatter(): + + class PrintVisitor(object): + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node: ProgramNode): + dottypes = '\n'.join(self.visit(t) for t in node.dottypes) + dotdata = '\n'.join(self.visit(t) for t in node.dotdata) + dotcode = '\n'.join(self.visit(t) for t in node.dotcode) + + return f'.TYPES\n{dottypes}\n\n.DATA\n{dotdata}\n\n.CODE\n{dotcode}' + + @visitor.when(TypeNode) + def visit(self, node: TypeNode): + attributes = '\n\t'.join(f'attribute {x}: {y}' for x, y in node.attributes) + methods = '\n\t'.join(f'method {x}: {y}' for x, y in node.methods) + + return f'type {node.name} {{\n\t{attributes}\n\n\t{methods}\n}}' + + @visitor.when(FunctionNode) + def visit(self, node: FunctionNode): + params = '\n\t'.join(self.visit(x) for x in node.params) + localvars = '\n\t'.join(self.visit(x) for x in node.localvars) + instructions = '\n\t'.join(self.visit(x) for x in node.instructions) + + return f'function {node.name} {{\n\t{params}\n\n\t{localvars}\n\n\t{instructions}\n}}' + + @visitor.when(DataNode) + def visit(self, node: DataNode): + return f'{node.name} = "{node.value}"' + + @visitor.when(ParamNode) + def visit(self, node: ParamNode): + return f'PARAM {node.name}' + + @visitor.when(LocalNode) + def visit(self, node: LocalNode): + return f'LOCAL {node.name}' + + @visitor.when(AssignNode) + def visit(self, node: AssignNode): + return f'{node.dest} = {node.source}' + + @visitor.when(NotNode) + def visit(self, node: NotNode): + return f'{node.dest} = ~{node.expr}' + + @visitor.when(LogicalNotNode) + def visit(self, node: LogicalNotNode): + return f'{node.dest} = NOT {node.expr}' + + @visitor.when(VoidConstantNode) + def visit(self, node: VoidConstantNode): + return f'{node.obj} = Void' + + @visitor.when(PlusNode) + def visit(self, node: PlusNode): + return f'{node.dest} = {node.left} + {node.right}' + + @visitor.when(MinusNode) + def visit(self, node: MinusNode): + return f'{node.dest} = {node.left} - {node.right}' + + @visitor.when(StarNode) + def visit(self, node: StarNode): + return f'{node.dest} = {node.left} * {node.right}' + + @visitor.when(DivNode) + def visit(self, node: DivNode): + return f'{node.dest} = {node.left} / {node.right}' + + @visitor.when(LessEqNode) + def visit(self, node: LessEqNode): + return f'{node.dest} = {node.left} <= {node.right}' + + @visitor.when(LessNode) + def visit(self, node: LessNode): + return f'{node.dest} = {node.left} < {node.right}' + + @visitor.when(EqualNode) + def visit(self, node: StarNode): + return f'{node.dest} = {node.left} = {node.right}' + + @visitor.when(AllocateNode) + def visit(self, node: AllocateNode): + return f'{node.dest} = ALLOCATE {node.type}' + + @visitor.when(TypeOfNode) + def visit(self, node: TypeOfNode): + return f'{node.dest} = TYPEOF {node.obj}' + + @visitor.when(GotoNode) + def visit(self, node: GotoNode): + return f'GOTO {node.label}' + + @visitor.when(GotoIfNode) + def visit(self, node: GotoIfNode): + return f'IF {node.cond} GOTO {node.label}' + + @visitor.when(GotoIfFalseNode) + def visit(self, node: GotoIfFalseNode): + return f'IF NOT {node.cond} GOTO {node.label}' + + @visitor.when(LabelNode) + def visit(self, node: LabelNode): + return f'LABEL {node.label}' + + @visitor.when(StaticCallNode) + def visit(self, node: StaticCallNode): + args = '\n\t'.join(self.visit(arg) for arg in node.args) + return f'{args}\n' + f'\t{node.dest} = CALL {node.function}' + + @visitor.when(LoadNode) + def visit(self, node: LoadNode): + return f'{node.dest} = LOAD {node.msg}' + + @visitor.when(DynamicCallNode) + def visit(self, node: DynamicCallNode): + args = '\n\t'.join(self.visit(arg) for arg in node.args) + return f'{args}\n' + f'\t{node.dest} = VCALL {node.type} {node.method}' + + @visitor.when(ArgNode) + def visit(self, node: ArgNode): + return f'ARG {node.dest}' + + @visitor.when(ReturnNode) + def visit(self, node: ReturnNode): + return f'RETURN {node.value if node.value is not None else ""}' + + @visitor.when(GetAttribNode) + def visit(self, node: GetAttribNode): + return f'{node.dest} = GETATTR {node.obj} {node.attr}' + + @visitor.when(SetAttribNode) + def visit(self, node: SetAttribNode): + return f'SETATTR {node.obj} {node.attr} = {node.value}' + + @visitor.when(LengthNode) + def visit(self, node: LengthNode): + return f'{node.dest} = LENGTH {node.arg}' + + @visitor.when(ConcatNode) + def visit(self, node: ConcatNode): + return f'{node.dest} = CONCAT {node.arg1} {node.arg2}' + + @visitor.when(SubstringNode) + def visit(self, node: SubstringNode): + return f'{node.dest} = SUBSTRING {node.word} {node.begin} {node.end}' + + @visitor.when(ToStrNode) + def visit(self, node: ToStrNode): + return f'{node.dest} = STR {node.ivalue}' + + @visitor.when(OutStringNode) + def visit(self, node: OutStringNode): + return f'OUT_STR {node.value}' + + @visitor.when(OutIntNode) + def visit(self, node: OutIntNode): + return f'OUT_INT {node.value}' + + @visitor.when(ReadStringNode) + def visit(self, node: ReadStringNode): + return f'{node.dest} = READ_STR' + + @visitor.when(ReadIntNode) + def visit(self, node: ReadIntNode): + return f'{node.dest} = READ_INT' + + @visitor.when(ExitNode) + def visit(self, node: ExitNode): + return f'EXIT {node.value}' + + @visitor.when(CopyNode) + def visit(self, node: CopyNode): + return f'{node.dest} = COPY {node.source}' + + @visitor.when(ConformsNode) + def visit(self, node: ConformsNode): + return f'{node.dest} = CONFORMS {node.expr} {node.type}' + + @visitor.when(ErrorNode) + def visit(self, node: ErrorNode): + return f'ERROR {node.type}' + + printer = PrintVisitor() + return lambda ast: printer.visit(ast) diff --git a/src/codegen/visitors/cil_visitor.py b/src/codegen/visitors/cil_visitor.py new file mode 100644 index 00000000..cf0d8f04 --- /dev/null +++ b/src/codegen/visitors/cil_visitor.py @@ -0,0 +1,407 @@ +import codegen.cil_ast as cil +from codegen.visitors.base_cil_visitor import BaseCOOLToCILVisitor +from utils.ast import * +from semantic.tools import Scope, VariableInfo +from semantic.types import * +from utils import visitor +from utils.utils import get_type, get_common_basetype + +class COOLToCILVisitor(BaseCOOLToCILVisitor): + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node: ProgramNode, scope: Scope): + self.current_function = self.register_function('entry') + idx = self.index + instance = self.define_internal_local() + result = self.define_internal_local() + + self.register_instruction(cil.AllocateNode('Main', instance)) + typex = self.context.get_type('Main', (0,0)) + if typex.all_attributes(): + self.register_instruction(cil.StaticCallNode(typex.name, typex.name, None, [cil.ArgNode(instance)], typex.name)) + + name = self.to_function_name('main', 'Main') + self.register_instruction(cil.StaticCallNode('Main', 'main', result, [cil.ArgNode(instance)], 'Object')) + self.register_instruction(cil.ReturnNode(0)) + self.current_function = None + + self.void_data = self.register_data(VOID_NAME).name + + self.create_built_in() + for declaration, child_scope in zip(node.declarations, scope.children): + self.visit(declaration, child_scope) + + return cil.ProgramNode(self.dottypes, self.dotdata, self.dotcode, idx) + + + @visitor.when(ClassDeclarationNode) + def visit(self, node: ClassDeclarationNode, scope: Scope): + self.current_type = self.context.get_type(node.id, node.pos) + + cil_type = self.register_type(node.id) + + attrs = self.current_type.all_attributes() + if len(attrs) > 0: + # Si hay atributos creo el constructor, en otro caso no + constructor = FuncDeclarationNode(node.token, [], node.token, BlockNode([], node.token)) + # definiendo el constructor en el tipo para analizar + func_declarations = [constructor] + self.constructors.append(node.id) + self.current_type.define_method(self.current_type.name, [], [], self.current_type, node.pos) + scopes = [scope] + list(scope.functions.values()) + else: + func_declarations = [] + scopes = list(scope.functions.values()) + + for attr, a_type in attrs: + cil_type.attributes.append((attr.name, self.to_attr_name(attr.name, a_type.name))) + self.initialize_attr(constructor, attr, scope) ## add the initialization code in the constructor + if attrs: + # Append like the last expression self type + constructor.body.expr_list.append(SelfNode()) + + + for method, mtype in self.current_type.all_methods(): + cil_type.methods.append((method.name, self.to_function_name(method.name, mtype.name))) + + + func_declarations += [f for f in node.features if isinstance(f, FuncDeclarationNode)] + for feature, child_scope in zip(func_declarations, scopes): + self.visit(feature, child_scope) + + + @visitor.when(FuncDeclarationNode) + def visit(self, node: FuncDeclarationNode, scope: Scope): + self.current_method = self.current_type.get_method(node.id, node.pos) + + name = self.to_function_name(node.id, self.current_type.name) + self.current_function = self.register_function(name) + + # Handle PARAMS + self.register_param('self', self.current_type.name) + for p_name, p_type in node.params: + self.register_param(p_name, p_type.value) + + value, typex = self.visit(node.body, scope) + if not isinstance(value, str): + result = self.define_internal_local() + self.register_instruction(cil.AssignNode(result, value)) + else: + result = value + + # Boxing if necessary + if (typex.name == 'Int' or typex.name == 'String' or typex.name == 'Bool') and self.current_method.return_type.name == 'Object': + self.register_instruction(cil.BoxingNode(result, typex.name)) + + # Handle RETURN + self.register_instruction(cil.ReturnNode(result)) + self.current_method = None + + + @visitor.when(VarDeclarationNode) + def visit(self, node: VarDeclarationNode, scope: Scope): + var_info = scope.find_variable(node.id) + vtype = get_type(var_info.type, self.current_type) + local_var = self.register_local(var_info.name) + + value, typex = self.visit(node.expr, scope) + if vtype.name == 'Object' and typex.name in ['String', 'Int', 'Bool']: + self.register_instruction(cil.BoxingNode(local_var, typex.name)) + else: + self.register_instruction(cil.AssignNode(local_var, value)) + return local_var, vtype + + + @visitor.when(AssignNode) + def visit(self, node: AssignNode, scope: Scope): + var_info = scope.find_local(node.id) + value, typex = self.visit(node.expr, scope) + if var_info is None: + var_info = scope.find_attribute(node.id) + attributes = [attr.name for attr, a_type in self.current_type.all_attributes()] + if var_info.type.name == 'Object' and typex.name in ['String', 'Bool', 'Int']: + value = self.define_internal_local() + self.register_instruction(cil.BoxingNode(value, typex.name)) + self.register_instruction(cil.SetAttribNode('self', var_info.name, self.current_type.name, value)) + else: + local_name = self.to_var_name(var_info.name) + if var_info.type.name == 'Object' and typex.name in ['String', 'Bool', 'Int']: + self.register_instruction(cil.BoxingNode(local_name, typex.name)) + else: + self.register_instruction(cil.AssignNode(local_name, value)) + return value, typex + + def _return_type(self, typex: Type, node): + meth = typex.get_method(node.id, node.pos) + return get_type(meth.return_type, self.current_type) + + @visitor.when(CallNode) + def visit(self, node: CallNode, scope: Scope): + obj, otype = self.visit(node.obj, scope) + + meth = otype.get_method(node.id, node.pos) + args_node = [cil.ArgNode(obj, self.index)] + self.handle_arguments(node.args, scope, meth.param_types) + + rtype = meth.return_type + result = None if isinstance(rtype, VoidType) else self.define_internal_local() + + continue_label = cil.LabelNode(f'continue__{self.index}') + isvoid = self.check_void(obj) + self.register_instruction(cil.GotoIfFalseNode(isvoid, continue_label.label)) + self.register_instruction(cil.ErrorNode('dispatch_error')) + self.register_instruction(continue_label) + + if otype in [StringType(), IntType(), BoolType()]: + self.register_instruction(cil.StaticCallNode(otype.name, node.id, result, args_node, rtype.name)) + else: + self.register_instruction(cil.DynamicCallNode(otype.name, obj, node.id, result, args_node, rtype.name)) + return result, self._return_type(otype, node) + + @visitor.when(BaseCallNode) + def visit(self, node: BaseCallNode, scope: Scope): + obj, otype = self.visit(node.obj, scope) + + meth = otype.get_method(node.id, node.pos) + args_node = [cil.ArgNode(obj, self.index)] + self.handle_arguments(node.args, scope, meth.param_types) + + rtype = meth.return_type + result = None if isinstance(rtype, VoidType) else self.define_internal_local() + + continue_label = cil.LabelNode(f'continue__{self.index}') + isvoid = self.check_void(obj) + self.register_instruction(cil.GotoIfFalseNode(isvoid, continue_label.label)) + self.register_instruction(cil.ErrorNode('dispatch_error')) + self.register_instruction(continue_label) + + self.register_instruction(cil.StaticCallNode(node.type, node.id, result, args_node, rtype.name)) + return result, self._return_type(otype, node) + + @visitor.when(StaticCallNode) + def visit(self, node: StaticCallNode, scope: Scope): + meth = self.current_type.get_method(node.id, node.pos) + args_node = [cil.ArgNode('self', self.index)] + self.handle_arguments(node.args, scope, meth.param_types) + + rtype = meth.return_type + if isinstance(rtype, VoidType): + result = None + else: + result = self.define_internal_local() + + self.register_instruction(cil.DynamicCallNode(self.current_type.name, 'self', node.id, result, args_node, rtype.name)) + return result, self._return_type(self.current_type, node) + + @visitor.when(ConstantNumNode) + def visit(self, node: ConstantNumNode, scope: Scope): + return int(node.lex), IntType() + + @visitor.when(ConstantBoolNode) + def visit(self, node: ConstantBoolNode, scope: Scope): + return 1 if node.lex == 'true' else 0, BoolType() + + @visitor.when(ConstantStrNode) + def visit(self, node: ConstantStrNode, scope: Scope): + data = self.register_data(node.lex) + result = self.define_internal_local() + self.register_instruction(cil.LoadNode(result, data.name)) + return result, StringType() + + @visitor.when(ConstantVoidNode) + def visit(self, node: ConstantVoidNode, scope: Scope): + result = self.register_local(node.lex) + void = cil.VoidConstantNode(result) + self.register_instruction(void) + return result, VoidType() + + @visitor.when(SelfNode) + def visit(self, node: SelfNode, scope: Scope): + return 'self', self.current_type + + @visitor.when(VariableNode) + def visit(self, node: VariableNode, scope: Scope): + try: + typex = scope.find_local(node.lex).type + name = self.to_var_name(node.lex) + return name, get_type(typex, self.current_type) + except: + var_info = scope.find_attribute(node.lex) + local_var = self.register_local(var_info.name) + self.register_instruction(cil.GetAttribNode('self', var_info.name, self.current_type.name, local_var, var_info.type.name)) + return local_var, get_type(var_info.type, self.current_type) + + @visitor.when(InstantiateNode) + def visit(self, node: InstantiateNode, scope: Scope): + instance = self.define_internal_local() + typex = self.context.get_type(node.lex, node.pos) + typex = get_type(typex, self.current_type) + self.register_instruction(cil.AllocateNode(typex.name, instance)) + + # calling the constructor to load all attributes + # Si tiene atributos entonces tendrá constructor (esto se deberia optimizar mas) + if typex.all_attributes(): + self.register_instruction(cil.StaticCallNode(typex.name, typex.name, instance, [cil.ArgNode(instance)], typex.name)) + + return instance, typex + + + @visitor.when(WhileNode) + def visit(self, node: WhileNode, scope: Scope): + ''' + LABEL start + IF NOT GOTO end + res = + GOTO start + LABEL end + ''' + start_label = cil.LabelNode(f'start__{self.idx}') + end_label = cil.LabelNode(f'end__{self.idx}') + + result = self.define_internal_local() + self.register_instruction(cil.VoidConstantNode(result)) + self.register_instruction(start_label) + + cond, _ = self.visit(node.cond, scope) + self.register_instruction(cil.GotoIfFalseNode(cond, end_label.label)) + expr, typex = self.visit(node.expr, scope) + self.register_instruction(cil.AssignNode(result, expr)) + self.register_instruction(cil.GotoNode(start_label.label)) + self.register_instruction(end_label) + + return result, ObjectType() + + @visitor.when(ConditionalNode) + def visit(self, node: ConditionalNode, scope: Scope): + ''' + IF cond GOTO true + result = + GOTO end + LABEL true + result = + LABEL end + ''' + cond, _ = self.visit(node.cond, scope) + + true_label = cil.LabelNode(f"true__{self.idx}") + end_label = cil.LabelNode(f"end__{self.idx}") + + result = self.define_internal_local() + self.register_instruction(cil.GotoIfNode(cond, true_label.label)) + + false_expr, ftypex = self.visit(node.else_stm, scope) + self.register_instruction(cil.AssignNode(result, false_expr)) + self.register_instruction(cil.GotoNode(end_label.label)) + self.register_instruction(true_label) + + true_expr, ttypex = self.visit(node.stm, scope) + self.register_instruction(cil.AssignNode(result, true_expr)) + self.register_instruction(end_label) + return result, get_common_basetype([ttypex, ftypex]) + + @visitor.when(BlockNode) + def visit(self, node: BlockNode, scope: Scope): + value = None + for exp in node.expr_list: + value, typex = self.visit(exp, scope) + result = self.define_internal_local() + self.register_instruction(cil.AssignNode(result, value)) + return result, typex + + @visitor.when(LetNode) + def visit(self, node: LetNode, scope: Scope): + child_scope = scope.expr_dict[node] + for init in node.init_list: + self.visit(init, child_scope) + + expr, typex = self.visit(node.expr, child_scope) + return expr, typex + + + @visitor.when(CaseNode) + def visit(self, node: CaseNode, scope: Scope): + expr, typex = self.visit(node.expr, scope) + + result = self.define_internal_local() + end_label = cil.LabelNode(f'end__{self.idx}') + error_label = cil.LabelNode(f'error__{self.idx}') + + isvoid = self.check_void(expr) + self.register_instruction(cil.GotoIfNode(isvoid, error_label.label)) + + try: + new_scope = scope.expr_dict[node] + except: + new_scope = scope + sorted_case_list = self.sort_option_nodes_by_type(node.case_list) + for i, case in enumerate(sorted_case_list): + next_label = cil.LabelNode(f'next__{self.idx}_{i}') + expr_i = self.visit(case, new_scope.create_child(), expr, next_label, typex) + self.register_instruction(cil.AssignNode(result, expr_i)) + self.register_instruction(cil.GotoNode(end_label.label)) + self.register_instruction(next_label) + # Si llegó aquí es porque no matcheó nunca + self.register_instruction(cil.ErrorNode('case_error')) + self.register_instruction(error_label) + self.register_instruction(cil.ErrorNode('case_void_error')) + self.register_instruction(end_label) + return result, typex + + @visitor.when(OptionNode) + def visit(self, node: OptionNode, scope:Scope, expr, next_label, type_e): + aux = self.define_internal_local() + self.register_instruction(cil.ConformsNode(aux, expr, node.typex)) + self.register_instruction(cil.GotoIfFalseNode(aux, next_label.label)) + + local_var = self.register_local(node.id) + typex = self.context.get_type(node.typex, node.type_pos) + scope.define_variable(node.id, typex) + if typex.name == 'Object' and type_e.name in ['String', 'Int', 'Bool']: + self.register_instruction(cil.BoxingNode(local_var, type_e.name)) + else: + self.register_instruction(cil.AssignNode(local_var, expr)) + expr_i, type_expr = self.visit(node.expr, scope) + return expr_i + + @visitor.when(NotNode) + def visit(self, node: NotNode, scope: Scope): + return self._define_unary_node(node, scope, cil.LogicalNotNode) + + @visitor.when(BinaryNotNode) + def visit(self, node: BinaryNotNode, scope: Scope): + return self._define_unary_node(node, scope, cil.NotNode) + + + @visitor.when(IsVoidNode) + def visit(self, node: IsVoidNode, scope: Scope): + expr, _ = self.visit(node.expr, scope) + result = self.check_void(expr) + return result, BoolType() + + @visitor.when(PlusNode) + def visit(self, node: PlusNode, scope: Scope): + return self._define_binary_node(node, scope, cil.PlusNode) + + @visitor.when(MinusNode) + def visit(self, node: MinusNode, scope: Scope): + return self._define_binary_node(node, scope, cil.MinusNode) + + @visitor.when(StarNode) + def visit(self, node: StarNode, scope: Scope): + return self._define_binary_node(node, scope, cil.StarNode) + + @visitor.when(DivNode) + def visit(self, node: DivNode, scope: Scope): + return self._define_binary_node(node, scope, cil.DivNode) + + @visitor.when(LessNode) + def visit(self, node: LessNode, scope: Scope): + return self._define_binary_node(node, scope, cil.LessNode) + + @visitor.when(LessEqNode) + def visit(self, node: LessEqNode, scope: Scope): + return self._define_binary_node(node, scope, cil.LessEqNode) + + @visitor.when(EqualNode) + def visit(self, node: EqualNode, scope: Scope): + return self._define_binary_node(node, scope, cil.EqualNode) diff --git a/src/codegen/visitors/mips_visitor.py b/src/codegen/visitors/mips_visitor.py new file mode 100644 index 00000000..4fdd95bc --- /dev/null +++ b/src/codegen/visitors/mips_visitor.py @@ -0,0 +1,783 @@ +from codegen.cil_ast import * +from utils import visitor +from codegen.visitors.base_mips_visitor import BaseCILToMIPSVisitor +from codegen.tools import SymbolTable, AddressDescriptor, RegisterDescriptor, AddrType +from semantic.tools import VariableInfo +from semantic.types import VOID_NAME +from pprint import pprint + +class CILToMIPSVistor(BaseCILToMIPSVisitor): + ''' + Registers: + v0-v1: Used for expression evaluations and to hold the integer type + function results. Also used to pass the static link when calling + nested procedures. + a0-a3: Used to pass the first 4 words of integer type actual + arguments, their values are not preserved across procedure + calls. + t0-t7: Temporary registers used for expression evaluations; their + values aren’t preserved across procedure calls. + s0-s7: Saved registers. Their values must be preserved across + procedure calls. + t8-t9: Temporary registers used for expression evaluations; their + values aren’t preserved across procedure calls. + k0-k1: Reserved for the operating system kernel. + gp: Contains the global pointer. + sp: Contains the stack pointer. + fp: Contains the frame pointer (if needed); otherwise a saved register. + ra: Contains the return address and is used for expression evaluation. + Register $ra only needs to be saved if the callee itself makes a call. + + ''' + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node: ProgramNode): + #? Quizá tenga que cambiar el orden en que estas cosas se visitan + # visit TypeNodes + for type_ in node.dottypes: + self.visit(type_) + + # guardo las direcciones de cada método + self.save_meth_addr(node.dotcode) + self.data_code.append(f"type_Void: .asciiz \"Void\"") # guarda el nombre de Void Type + # guardo las direcciones de cada tipo + self.save_types_addr(node.dottypes) + # visit DataNodes + for data in node.dotdata: + self.visit(data) + # visit code instrunctions + for code in node.dotcode: + self.visit(code) + + self.initialize_runtime_errors() + + return self.data_code, self.code + + @visitor.when(TypeNode) + def visit(self, node:TypeNode): + self.obj_table.add_entry(node.name, node.methods, node.attributes) + self.data_code.append(f"type_{node.name}: .asciiz \"{node.name}\"") # guarda el nombre de la variable en la memoria + + @visitor.when(DataNode) + def visit(self, node:DataNode): + self.data_code.append(f"{node.name}: .asciiz \"{node.value}\"") + + @visitor.when(FunctionNode) + def visit(self, node:FunctionNode): + self.code.append('') + self.code.append(f'{node.name}:') + self.locals = 0 # pointer to count the ammount of locals that are pushed into the stack + + self.code.append('# Gets the params from the stack') + self.code.append(f'move $fp, $sp') # gets the frame pointer from the stack + n = len(node.params) + for i, param in enumerate(node.params, 1): # gets the params from the stack + self.visit(param, i, n) + self.code.append('# Gets the frame pointer from the stack') + for i, var in enumerate(node.localvars, len(node.params)): + self.visit(var, i) + self.locals = len(node.params) + len(node.localvars) + blocks = self.get_basic_blocks(node.instructions) + self.next_use = self.construct_next_use(blocks) + + for block in blocks: + self.block = block + for inst in block: + self.inst = inst + self.get_reg(inst) + self.visit(inst) + inst = block[-1] + if not (isinstance(inst, GotoNode) or isinstance(inst, GotoIfNode) or isinstance(inst, ReturnNode) \ + or isinstance(inst, StaticCallNode) or isinstance(inst, DynamicCallNode)): + self.empty_registers() + # self.empty_registers() + + @visitor.when(ParamNode) + def visit(self, node:ParamNode, idx:int, length:int): + self.symbol_table.insert_name(node.name) + self.var_address[node.name] = self.get_type(node.type) + self.code.append(f'# Pops the register with the param value {node.name}') + self.code.append('addiu $fp, $fp, 4') # pops the register with the param value from stack + self.addr_desc.insert_var(node.name, length-idx) + + @visitor.when(LocalNode) + def visit(self, node:LocalNode, idx:int): + self.symbol_table.insert_name(node.name) # inserts the var in the symbol table, local by default + self.addr_desc.insert_var(node.name, idx) # saves the address relative from the actual fp + self.code.append(f'# Updates stack pointer pushing {node.name} to the stack') + self.code.append(f'addiu $sp, $sp, -4') # updates stack pointers (pushing this value) + + @visitor.when(AssignNode) + def visit(self, node:AssignNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append(f'# Moving {node.source} to {node.dest}') + if self.is_variable(node.source): + rsrc = self.addr_desc.get_var_reg(node.source) + self.code.append(f'move ${rdest}, ${rsrc}') + self.var_address[node.dest] = self.var_address[node.source] + elif self.is_int(node.source): + self.code.append(f'li ${rdest}, {node.source}') + self.var_address[node.dest] = AddrType.INT + self.save_var_code(node.dest) + + + @visitor.when(NotNode) + def visit(self, node:NotNode): + rdest = self.addr_desc.get_var_reg(node.dest) + rsrc = self.save_to_register(node.expr) + self.code.append(f'# {node.dest} <- ~{node.expr}') + self.code.append(f'not ${rdest}, ${rsrc}') + self.code.append(f'addi ${rdest}, ${rdest}, 1') + self.var_address[node.dest] = AddrType.INT + + @visitor.when(LogicalNotNode) + def visit(self, node:LogicalNotNode): + rdest = self.addr_desc.get_var_reg(node.dest) + rsrc = self.save_to_register(node.expr) + self.code.append(f'# {node.dest} <- not {node.expr}') + self.code.append(f'beqz ${rsrc}, false_{self.loop_idx}') + self.code.append(f'li ${rdest}, 0') + self.code.append(f'j end_{self.loop_idx}') + self.code.append(f'false_{self.loop_idx}:') + self.code.append(f'li ${rdest}, 1') + self.code.append(f'end_{self.loop_idx}:') + self.loop_idx += 1 + self.var_address[node.dest] = AddrType.BOOL + + @visitor.when(PlusNode) + def visit(self, node:PlusNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append(f'# {node.dest} <- {node.left} + {node.right}') + if self.is_variable(node.left): + rleft = self.addr_desc.get_var_reg(node.left) + if self.is_variable(node.right): + rright = self.addr_desc.get_var_reg(node.right) + self.code.append(f"add ${rdest}, ${rleft}, ${rright}") + elif self.is_int(node.right): + self.code.append(f"addi ${rdest}, ${rleft}, {node.right}") + elif self.is_int(node.left): + if self.is_int(node.right): + self.code.append(f"li ${rdest}, {node.left + node.right}") + elif self.is_variable(node.right): + rright = self.addr_desc.get_var_reg(node.right) + self.code.append(f"addi ${rdest}, ${rright}, {node.left}") + self.var_address[node.dest] = AddrType.INT + + @visitor.when(MinusNode) + def visit(self, node:MinusNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append(f'# {node.dest} <- {node.left} - {node.right}') + if self.is_variable(node.left): + rleft = self.addr_desc.get_var_reg(node.left) + if self.is_variable(node.right): + rright = self.addr_desc.get_var_reg(node.right) + self.code.append(f"sub ${rdest}, ${rleft}, ${rright}") + elif self.is_int(node.right): + self.code.append(f"addi ${rdest}, ${rleft}, -{node.right}") + elif self.is_int(node.left): + if self.is_int(node.right): + self.code.append(f"li ${rdest}, {node.left-node.right}") + elif self.is_variable(node.right): + rright = self.addr_desc.get_var_reg(node.right) + self.code.append(f"sub $t9, $zero, {rright}") + self.code.append(f"addi ${rdest}, {node.left}, $t9") + self.var_address[node.dest] = AddrType.INT + + @visitor.when(StarNode) + def visit(self, node:StarNode): + self.code.append(f'# {node.dest} <- {node.left} * {node.right}') + self._code_to_mult_div(node, op='mult', func_op=lambda x, y: x*y) + + @visitor.when(DivNode) + def visit(self, node:DivNode): + self.code.append(f'# {node.dest} <- {node.left} / {node.right}') + self._code_to_mult_div(node, op='div', func_op=lambda x, y: int(x / y)) + + def _code_to_mult_div(self, node, op:str, func_op): + rdest = self.addr_desc.get_var_reg(node.dest) + if self.is_int(node.left) and self.is_int(node.right): + try: + self.code.append(f"li ${rdest}, {func_op(node.left, node.right)}") + except ZeroDivisionError: + self.code.append('la $a0, zero_error') + self.code.append('j .raise') + else: + if self.is_variable(node.left): + rleft = self.addr_desc.get_var_reg(node.left) + if self.is_variable(node.right): + rright = self.addr_desc.get_var_reg(node.right) + elif self.is_int(node.right): + self.code.append(f"li $t9, {node.right}") + rright = 't9' + elif self.is_int(node.left): + # right es una variable porque falló el primer if + rright = self.addr_desc.get_var_reg(node.right) + self.code.append(f"li $t9, {node.left}") + rleft = 't9' + if op == 'div': + self.code.append('la $a0, zero_error') + self.code.append(f'beqz ${rright}, .raise') + self.code.append(f"{op} ${rleft}, ${rright}") + self.code.append(f"mflo ${rdest}") + self.var_address[node.dest] = AddrType.INT + + @visitor.when(LessNode) + def visit(self, node:LessNode): + self.code.append(f'# {node.dest} <- {node.left} < {node.right}') + self._code_to_comp(node, 'slt', lambda x, y: x < y) + + @visitor.when(LessEqNode) + def visit(self, node:MinusNode): + self.code.append(f'# {node.dest} <- {node.left} <= {node.right}') + self._code_to_comp(node, 'sle', lambda x, y: x <= y) + + @visitor.when(EqualNode) + def visit(self, node:MinusNode): + self.code.append(f'# {node.dest} <- {node.left} = {node.right}') + if self.is_variable(node.left) and self.is_variable(node.right) and self.var_address[node.left] == AddrType.STR and self.var_address[node.right] == AddrType.STR: + self.compare_strings(node) + else: + self._code_to_comp(node, 'seq', lambda x, y: x == y) + + def _code_to_comp(self, node, op, func_op): + rdest = self.addr_desc.get_var_reg(node.dest) + if self.is_variable(node.left): + rleft = self.addr_desc.get_var_reg(node.left) + if self.is_variable(node.right): + rright = self.addr_desc.get_var_reg(node.right) + self.code.append(f"{op} ${rdest}, ${rleft}, ${rright}") + elif self.is_int(node.right): + self.code.append(f"li $t9, {node.right}") + self.code.append(f"{op} ${rdest}, ${rleft}, $t9") + elif self.is_int(node.left): + if self.is_int(node.right): + self.code.append(f"li ${rdest}, {int(func_op(node.left, node.right))}") + elif self.is_variable(node.right): + rright = self.addr_desc.get_var_reg(node.right) + self.code.append(f"li $t9, {node.left}") + self.code.append(f"{op} ${rdest}, $t9, ${rright}") + self.var_address[node.dest] = AddrType.BOOL + + @visitor.when(GetAttribNode) + def visit(self, node:GetAttribNode): + self.code.append(f'# {node.dest} <- GET {node.obj} . {node.attr}') + rdest = self.addr_desc.get_var_reg(node.dest) + self.var_address[node.dest] = self.get_type(node.attr_type) + rsrc = self.addr_desc.get_var_reg(node.obj) + attr_offset = 4*self.get_attr_offset(node.attr, node.type_name) + self.code.append(f'lw ${rdest}, {attr_offset}(${rsrc})') + + + @visitor.when(SetAttribNode) + def visit(self, node:SetAttribNode): + self.code.append(f'# {node.obj} . {node.attr} <- SET {node.value}') + rdest = self.addr_desc.get_var_reg(node.obj) + attr_offset = 4*self.get_attr_offset(node.attr, node.type_name) + if self.is_variable(node.value): + rsrc = self.addr_desc.get_var_reg(node.value) + elif self.is_int(node.value): + self.code.append(f'li $t9, {node.value}') + rsrc = 't9' + elif self.is_void(node.value): + self.code.append(f'la $t9, type_{VOID_NAME}') + rsrc = 't9' + self.code.append(f'sw ${rsrc}, {attr_offset}(${rdest})') # saves the new value in the attr offset + + @visitor.when(AllocateNode) + def visit(self, node:AllocateNode): + rdest = self.addr_desc.get_var_reg(node.dest) + size = 4*self.obj_table.size_of_entry(node.type) # size of the table entry of the new type + self.var_address[node.dest] = AddrType.REF + # syscall to allocate memory of the object entry in heap + + self.code.append('# Syscall to allocate memory of the object entry in heap') + self.code.append('li $v0, 9') # code to request memory + self.code.append(f'li $a0, {size}') # argument (size) + self.code.append('syscall') + # in v0 is the address of the new memory + addrs_stack = self.addr_desc.get_var_addr(node.dest) + # self.code.append('# Save the address in the stack') + # self.code.append(f'sw $v0, -{addrs_stack}($fp)') # save the address in the stack (where is the local variable) + + self.code.append('# Loads the name of the variable and saves the name like the first field') + self.code.append(f'la $t9, type_{node.type}') # loads the name of the variable + self.code.append(f'sw $t9, 0($v0)') # saves the name like the first field + + self.code.append(f'# Saves the size of the node') + self.code.append(f'li $t9, {size}') # saves the size of the node + self.code.append(f'sw $t9, 4($v0)') # this is the second file of the table offset + self.code.append(f'move ${rdest}, $v0') # guarda la nueva dirección de la variable en el registro destino + + idx = self.types.index(node.type) + self.code.append('# Adding Type Info addr') + self.code.append('la $t8, types') + self.code.append(f'lw $v0, {4*idx}($t8)') + self.code.append(f'sw $v0, 8(${rdest})') + + + @visitor.when(TypeOfNode) + def visit(self, node:TypeOfNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append(f'# {node.dest} <- Type of {node.obj}') + if self.is_variable(node.obj): + rsrc = self.addr_desc.get_var_reg(node.obj) + if self.var_address[node.obj] == AddrType.REF: + self.code.append(f'lw ${rdest}, 0(${rsrc})') # como en el offset 0 está el nombre del tipo this is ok + elif self.var_address[node.obj] == AddrType.STR: + self.code.append(f'la ${rdest}, type_String') + elif self.var_address[node.obj] == AddrType.INT: + self.code.append(f'la ${rdest}, type_Int') + elif self.var_address[node.obj] == AddrType.BOOL: + self.code.append(f'la ${rdest}, type_Bool') + elif self.is_int(node.obj): + self.code.append(f'la ${rdest}, type_Int') + self.var_address[node.dest] = AddrType.STR + + @visitor.when(LabelNode) + def visit(self, node:LabelNode): + self.code.append(f'{node.label}:') + + @visitor.when(GotoNode) + def visit(self, node:GotoNode): + self.empty_registers() + self.code.append(f'j {node.label}') + + @visitor.when(GotoIfNode) + def visit(self, node:GotoIfNode): + reg = self.save_to_register(node.cond) + self.code.append(f'# If {node.cond} goto {node.label}') + self.empty_registers() + self.code.append(f'bnez ${reg}, {node.label}') + + @visitor.when(GotoIfFalseNode) + def visit(self, node:GotoIfNode): + reg = self.save_to_register(node.cond) + self.code.append(f'# If not {node.cond} goto {node.label}') + self.empty_registers() + self.code.append(f'beqz ${reg}, {node.label}') + + @visitor.when(StaticCallNode) + def visit(self, node:StaticCallNode): + function = self.dispatch_table.find_full_name(node.type, node.function) + self.code.append(f'# Static Dispatch of the method {node.function}') + self._code_to_function_call(node.args, function, node.dest) + + self.var_address[node.dest] = self.get_type(node.return_type) + + @visitor.when(DynamicCallNode) + def visit(self, node:DynamicCallNode): + # Find the actual name of the method in the dispatch table + self.code.append('# Find the actual name in the dispatch table') + reg = self.addr_desc.get_var_reg(node.obj) # obtiene la instancia actual + + self.code.append('# Gets in a0 the actual direction of the dispatch table') + self.code.append(f'lw $t9, 8(${reg})') # obtiene en t9 la dirección del dispatch table + self.code.append('lw $a0, 8($t9)') + function = self.dispatch_table.find_full_name(node.type, node.method) + index = 4*self.dispatch_table.get_offset(node.type, function) + 4 # guarda el offset del me + self.code.append(f'# Saves in t8 the direction of {function}') + self.code.append(f'lw $t8, {index}($a0)') # guarda en $t8 la dirección de la función a llamar + # Call function + self._code_to_function_call(node.args, '$t8', node.dest, function) + + self.var_address[node.dest] = self.get_type(node.return_type) + + def _code_to_function_call(self, args, function, dest, function_name=None): + self.push_register('fp') # pushes fp register to the stack + self.push_register('ra') # pushes ra register to the stack + self.code.append('# Push the arguments to the stack') + for arg in reversed(args): # push the arguments to the stack + self.visit(arg) + + + self.code.append('# Empty all used registers and saves them to memory') + self.empty_registers() + self.code.append('# This function will consume the arguments') + + self.code.append(f'jal {function}') # this function will consume the arguments + self.code.append('# Pop ra register of return function of the stack') + self.pop_register('ra') # pop register ra from the stack + self.code.append('# Pop fp register from the stack') + self.pop_register('fp') # pop fp register from the stack + if dest is not None: + self.get_reg_var(dest) + rdest = self.addr_desc.get_var_reg(dest) + self.code.append('# saves the return value') + self.code.append(f'move ${rdest}, $v0') # v0 es usado para guardar el valor de retorno + + @visitor.when(ArgNode) + def visit(self, node:ArgNode): + self.code.append('# The rest of the arguments are push into the stack') + if self.is_variable(node.dest): + self.get_reg_var(node.dest) + reg = self.addr_desc.get_var_reg(node.dest) + self.code.append(f'sw ${reg}, ($sp)') + elif self.is_int(node.dest): + self.code.append(f'li $t9, {node.dest}') + self.code.append(f'sw $t9, ($sp)') + self.code.append('addiu $sp, $sp, -4') + + @visitor.when(ReturnNode) + def visit(self, node:ReturnNode): + # save the return value + if self.is_variable(node.value): + rdest = self.addr_desc.get_var_reg(node.value) + self.code.append(f'move $v0, ${rdest}') + elif self.is_int(node.value): + self.code.append(f'li $v0, {node.value}') + self.code.append('# Empty all used registers and saves them to memory') + self.empty_registers() # empty all used registers and saves them to memory + self.code.append('# Removing all locals from stack') + self.code.append(f'addiu $sp, $sp, {self.locals*4}') + # return to the caller + self.code.append(f'jr $ra') + + self.code.append('') + + @visitor.when(LoadNode) + def visit(self, node:LoadNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append(f'# Saves in {node.dest} {node.msg}') + self.var_address[node.dest] = AddrType.STR + self.code.append(f'la ${rdest}, {node.msg}') + + @visitor.when(LengthNode) + def visit(self, node: LengthNode): + rdest = self.addr_desc.get_var_reg(node.dest) + reg = self.addr_desc.get_var_reg(node.arg) + loop = f'loop_{self.loop_idx}' + end = f'end_{self.loop_idx}' + # saving the value of reg to iterate + self.code.append(f'move $t8, ${reg}') + self.code.append('# Determining the length of a string') + self.code.append(f'{loop}:') + self.code.append(f'lb $t9, 0($t8)') + self.code.append(f'beq $t9, $zero, {end}') + self.code.append(f'addi $t8, $t8, 1') + self.code.append(f'j {loop}') + self.code.append(f'{end}:') + + self.code.append(f'sub ${rdest}, $t8, ${reg}') + self.loop_idx += 1 + + @visitor.when(ConcatNode) + def visit(self, node: ConcatNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append('# Allocating memory for the buffer') + self.code.append('li $a0, 356') + self.code.append('li $v0, 9') + self.code.append('syscall') + self.code.append(f'move ${rdest}, $v0') + + + rsrc1 = self.addr_desc.get_var_reg(node.arg1) + if node.arg2 is not None: + rsrc2 = self.addr_desc.get_var_reg(node.arg2) + + self.code.append('# Copy the first string to dest') + var = self.save_reg_if_occupied('a1') + self.code.append(f'move $a0, ${rsrc1}') + self.code.append(f'move $a1, ${rdest}') + self.push_register('ra') + self.code.append('jal strcopier') + + if node.arg2 is not None: + self.code.append('# Concatenate second string on result buffer') + self.code.append(f'move $a0, ${rsrc2}') + self.code.append(f'move $a1, $v0') + self.code.append('jal strcopier') + self.code.append('sb $0, 0($v0)') + self.pop_register('ra') + self.code.append(f'j finish_{self.loop_idx}') + + if self.first_defined['strcopier']: + self.code.append('# Definition of strcopier') + self.code.append('strcopier:') + self.code.append('# In a0 is the source and in a1 is the destination') + self.code.append(f'loop_{self.loop_idx}:') + self.code.append('lb $t8, ($a0)') + self.code.append(f'beq $t8, $zero, end_{self.loop_idx}') + self.code.append('addiu $a0, $a0, 1') + self.code.append('sb $t8, ($a1)') + self.code.append('addiu $a1, $a1, 1') + self.code.append(f'b loop_{self.loop_idx}') + self.code.append(f'end_{self.loop_idx}:') + self.code.append('move $v0, $a1') + self.code.append('jr $ra') + self.first_defined['strcopier'] = False + + self.code.append(f'finish_{self.loop_idx}:') + self.load_var_if_occupied(var) + self.loop_idx += 1 + + @visitor.when(SubstringNode) + def visit(self, node: SubstringNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append('# Allocating memory for the buffer') + self.code.append('li $a0, 356') + self.code.append('li $v0, 9') + self.code.append('syscall') + self.code.append(f'move ${rdest}, $v0') + + + if self.is_variable(node.begin): + rstart = self.addr_desc.get_var_reg(node.begin) + elif self.is_int(node.begin): + rstart = 't8' + self.code.append(f'li $t8, {node.begin}') + if self.is_variable(node.end): + rend = self.addr_desc.get_var_reg(node.end) + var = None + elif self.is_int(node.end): + var = self.save_reg_if_occupied('a3') + rend = 'a3' + self.code.append(f'li $a3, {node.end}') + + self.get_reg_var(node.word) + rself = self.addr_desc.get_var_reg(node.word) + + self.code.append("# Getting the substring of a node") + # Moves to the first position of the string + # self.code.append(f'sll $t9, ${rstart}, 2') # multiplicar por 4 + start = f'start_{self.loop_idx}' + error = f'error_{self.loop_idx}' + end_lp = f'end_len_{self.loop_idx}' + + self.code.append('# Move to the first position in the string') + self.code.append('li $v0, 0') + + self.code.append(f'move $t8, ${rself}') + self.code.append(f'{start}:') + self.code.append('lb $t9, 0($t8)') + self.code.append(f'beqz $t9, {error}') + self.code.append('addi $v0, 1') + self.code.append(f'bgt $v0, ${rstart}, {end_lp}') + self.code.append(f'addi $t8, 1') + self.code.append(f'j {start}') + self.code.append(f'{end_lp}:') + + self.code.append('# Saving dest to iterate over him') + self.code.append(f'move $v0, ${rdest}') + + loop = f'loop_{self.loop_idx}' + end = f'end_{self.loop_idx}' + # Loops moving the bytes until reaching to end + self.code.append(f'{loop}:') + self.code.append(f'sub $t9, $v0, ${rdest}') + + self.code.append(f'beq $t9, ${rend}, {end}') + self.code.append(f'lb $t9, 0($t8)') + self.code.append(f'beqz $t9, {error}') # if $t9 is zero error cause havent finished + self.code.append(f'sb $t9, 0($v0)') + self.code.append('addi $t8, $t8, 1') + self.code.append(f'addi $v0, $v0, 1') + self.code.append(f'j {loop}') + self.code.append(f'{error}:') + self.code.append('la $a0, index_error') + + self.code.append('li $v0, 4') + self.code.append(f'move $a0, ${rself}') + self.code.append('syscall') + + self.code.append('li $v0, 1') + self.code.append(f'move $a0, ${rstart}') + self.code.append('syscall') + + self.code.append('li $v0, 1') + self.code.append(f'move $a0, ${rend}') + self.code.append('syscall') + + self.code.append('j .raise') + self.code.append(f'{end}:') + self.code.append('sb $0, 0($v0)') + self.load_var_if_occupied(var) + self.loop_idx += 1 + + @visitor.when(OutStringNode) + def visit(self, node: OutStringNode): + reg = self.addr_desc.get_var_reg(node.value) + self.code.append('# Printing a string') + self.code.append('li $v0, 4') + self.code.append(f'move $a0, ${reg}') + self.code.append('syscall') + + @visitor.when(OutIntNode) + def visit(self, node: OutIntNode): + if self.is_variable(node.value): + reg = self.addr_desc.get_var_reg(node.value) + elif self.is_int(node.value): + reg = 't8' + self.code.append(f'li $t8, ${node.value}') + + self.code.append('# Printing an int') + self.code.append('li $v0, 1') + self.code.append(f'move $a0, ${reg}') + self.code.append('syscall') + + + @visitor.when(ReadStringNode) + def visit(self, node: ReadStringNode): + # self.data_code.append(f'{node.dest}: .space 20') + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append('# Allocating memory for the buffer') + self.code.append('li $a0, 356') + self.code.append('li $v0, 9') + self.code.append('syscall') + self.code.append(f'move ${rdest}, $v0') + # self.code.append(f'sb $0, 0(${rdest})') + + self.code.append('# Reading a string') + var = self.save_reg_if_occupied('a1') + self.code.append('# Putting buffer in a0') + self.code.append(f'move $a0, ${rdest}') # Get length of the string + self.code.append('# Putting length of string in a1') + self.code.append(f'li $a1, 356') + self.code.append('li $v0, 8') + self.code.append('syscall') + self.code.append('# Walks to eliminate the newline') + + start = f'start_{self.loop_idx}' + end = f'end_{self.loop_idx}' + + self.code.append(f'move $t9, ${rdest}') + self.code.append(f'{start}:') # moves to the newline + self.code.append('lb $t8, 0($t9)') + self.code.append(f"beqz $t8, {end}") + self.code.append('add $t9, $t9, 1') + self.code.append(f'j {start}') + self.code.append(f'{end}:') + self.code.append('addiu $t9, $t9, -1') + self.code.append('sb $0, ($t9)') # overwrites the newline with zero + self.loop_idx += 1 + self.load_var_if_occupied(var) + + + @visitor.when(ReadIntNode) + def visit(self, node: ReadIntNode): + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append('# Reading a int') + self.code.append('li $v0, 5') + self.code.append('syscall') + self.code.append(f'move ${rdest}, $v0') + + + @visitor.when(ExitNode) + def visit(self, node: ExitNode): + self.code.append('# Exiting the program') + if self.is_variable(node.value): + reg = self.addr_desc.get_var_reg(node.value) + elif self.is_int(node.value): + reg = 't8' + self.code.append(f'li $t8, {node.value}') + + rself = self.addr_desc.get_var_reg(node.classx) + + 'Abort called from class String' + if self.var_address[node.classx] == AddrType.REF: + self.code.append('# Printing abort message') + self.code.append('li $v0, 4') + self.code.append(f'la $a0, abort_msg') + self.code.append('syscall') + + self.code.append('li $v0, 4') + self.code.append(f'lw $a0, 0(${rself})') + self.code.append('syscall') + self.code.append('li $v0, 4') + self.code.append(f'la $a0, new_line') + self.code.append('syscall') + + self.code.append('li $v0, 17') + self.code.append(f'move $a0, ${reg}') + self.code.append('syscall') + + @visitor.when(CopyNode) + def visit(self, node: CopyNode): + rdest = self.addr_desc.get_var_reg(node.dest) + rsrc = self.addr_desc.get_var_reg(node.source) + + self.code.append(f'lw $t9, 4(${rsrc})') # getting the size of the object + self.code.append('# Syscall to allocate memory of the object entry in heap') + self.code.append('li $v0, 9') # code to request memory + self.code.append(f'move $a0, $t9') # argument (size) + self.code.append('syscall') + + self.code.append(f'move ${rdest}, $v0') + + self.code.append('# Loop to copy every field of the previous object') + # loop to copy every field of the previous object + self.code.append('# t8 the register to loop') + self.code.append('li $t8, 0') + self.code.append(f'loop_{self.loop_idx}:') + self.code.append('# In t9 is stored the size of the object') + self.code.append(f'bge $t8, $t9, exit_{self.loop_idx}') + self.code.append(f'lw $a0, (${rsrc})') + self.code.append('sw $a0, ($v0)') + # offset in the copied element + self.code.append('addi $v0, $v0, 4') + # offset in the original element + self.code.append(f'addi ${rsrc}, ${rsrc}, 4') + self.code.append('# Increase loop counter') + self.code.append('addi $t8, $t8, 4') + self.code.append(f'j loop_{self.loop_idx}') + self.code.append(f'exit_{self.loop_idx}:') + self.loop_idx += 1 + + @visitor.when(ConformsNode) + def visit(self, node: ConformsNode): + rdest = self.addr_desc.get_var_reg(node.dest) + if self.is_variable(node.expr): + rsrc = self.addr_desc.get_var_reg(node.expr) + if self.var_address[node.expr] == AddrType.REF: + self.conforms_to(rsrc, rdest, node.type) + elif self.var_address[node.expr] == AddrType.STR: + self.value_conforms_to_obj(rdest, 'String', node.type) + elif self.var_address[node.expr] == AddrType.INT: + self.value_conforms_to_obj(rdest, 'Int', node.type) + elif self.var_address[node.expr] == AddrType.BOOL: + self.value_conforms_to_obj(rdest, 'Bool', node.type) + elif self.is_int(node.expr): + self.value_conforms_to_obj(rdest, 'Int', node.type) + + @visitor.when(ErrorNode) + def visit(self, node: ErrorNode): + self.code.append(f'la $a0, {node.type}') + self.code.append('j .raise') + + @visitor.when(VoidConstantNode) + def visit(self, node:VoidConstantNode): + rdest = self.addr_desc.get_var_reg(node.out) + self.code.append('# Initialize void node') + self.code.append(f'li $a0, 4') # argument (size) + self.code.append('li $v0, 9') # code to request memory + self.code.append('syscall') + self.code.append('# Loads the name of the variable and saves the name like the first field') + self.code.append(f'la $t9, type_{VOID_NAME}') # loads the name of the variable + self.code.append('sw $t9, 0($v0)') # saves the name like the first field + self.code.append(f'move ${rdest}, $v0') + self.var_address[node.obj] = AddrType.REF + + @visitor.when(BoxingNode) + def visit(self, node:BoxingNode): + "Node to convert a value type into object" + rdest = self.addr_desc.get_var_reg(node.dest) + self.code.append('# Initialize new node') + self.code.append('li $a0, 12') + self.code.append('li $v0, 9') + self.code.append('syscall') + + self.code.append(f'la $t9, type_{node.type}') + self.code.append('sw $t9, 0($v0)') # saves the name like the first field + self.code.append('li $t9, 12') + self.code.append('sw $t9, 4($v0)') # saves the size like the second field + self.code.append(f'move ${rdest}, $v0') + + self.code.append('# Saving the methods of object') + idx = self.types.index('Object') + self.code.append('# Adding Type Info addr') + self.code.append('la $t8, types') + self.code.append(f'lw $v0, {4*idx}($t8)') + self.code.append(f'sw $v0, 8(${rdest})') + self.var_address[node.dest] = AddrType.REF diff --git a/src/cool_parser/__init__.py b/src/cool_parser/__init__.py new file mode 100644 index 00000000..ce456e07 --- /dev/null +++ b/src/cool_parser/__init__.py @@ -0,0 +1 @@ +from cool_parser.parser import CoolParser diff --git a/src/cool_parser/__pycache__/__init__.cpython-37.pyc b/src/cool_parser/__pycache__/__init__.cpython-37.pyc new file mode 100644 index 00000000..39de5da3 Binary files /dev/null and b/src/cool_parser/__pycache__/__init__.cpython-37.pyc differ diff --git a/src/cool_parser/__pycache__/base_parser.cpython-37.pyc b/src/cool_parser/__pycache__/base_parser.cpython-37.pyc new file mode 100644 index 00000000..bd12b20e Binary files /dev/null and b/src/cool_parser/__pycache__/base_parser.cpython-37.pyc differ diff --git a/src/cool_parser/__pycache__/logger.cpython-37.pyc b/src/cool_parser/__pycache__/logger.cpython-37.pyc new file mode 100644 index 00000000..090b0eca Binary files /dev/null and b/src/cool_parser/__pycache__/logger.cpython-37.pyc differ diff --git a/src/cool_parser/__pycache__/parser.cpython-37.pyc b/src/cool_parser/__pycache__/parser.cpython-37.pyc new file mode 100644 index 00000000..7fabd687 Binary files /dev/null and b/src/cool_parser/__pycache__/parser.cpython-37.pyc differ diff --git a/src/cool_parser/base_parser.py b/src/cool_parser/base_parser.py new file mode 100644 index 00000000..29188afe --- /dev/null +++ b/src/cool_parser/base_parser.py @@ -0,0 +1,26 @@ +from utils.tokens import tokens +import os +import ply.yacc as yacc + +from cool_parser.logger import log +from lexer.lexer import CoolLexer +from utils.tokens import tokens + +class Parser: + def __init__(self, lexer=None): + self.lexer = lexer if lexer else CoolLexer() + self.outputdir = 'cool_parser/output_parser' + self.tokens = tokens + self.errors = False + self.parser = yacc.yacc(start='program', + module=self, + outputdir=self.outputdir, + optimize=1, + debuglog=log, + errorlog=log) + + + def parse(self, program, debug=False): + self.errors = False + # tokens = self.lexer.tokenize_text(program) + return self.parser.parse(program, self.lexer.lexer, debug=log) \ No newline at end of file diff --git a/src/cool_parser/logger.py b/src/cool_parser/logger.py new file mode 100644 index 00000000..e1d62278 --- /dev/null +++ b/src/cool_parser/logger.py @@ -0,0 +1,13 @@ + # Set up a logging object +import logging +import os + +cwd = os.getcwd() + +logging.basicConfig( + level = logging.DEBUG, + filename = f"cool_parser/output_parser/parselog.txt", + filemode = "w", + format = "%(filename)10s:%(lineno)4d:%(message)s" + ) +log = logging.getLogger() diff --git a/src/cool_parser/output_parser/debug.txt b/src/cool_parser/output_parser/debug.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/cool_parser/output_parser/parselog.txt b/src/cool_parser/output_parser/parselog.txt new file mode 100644 index 00000000..2cb03511 --- /dev/null +++ b/src/cool_parser/output_parser/parselog.txt @@ -0,0 +1,9548 @@ + yacc.py:3317:Created by PLY version 3.11 (http://www.dabeaz.com/ply) + yacc.py:3377: + yacc.py:3378:Grammar + yacc.py:3379: + yacc.py:3381:Rule 0 S' -> program + yacc.py:3381:Rule 1 program -> class_list + yacc.py:3381:Rule 2 epsilon -> + yacc.py:3381:Rule 3 class_list -> def_class class_list + yacc.py:3381:Rule 4 class_list -> def_class + yacc.py:3381:Rule 5 class_list -> error class_list + yacc.py:3381:Rule 6 def_class -> class type ocur feature_list ccur semi + yacc.py:3381:Rule 7 def_class -> class type inherits type ocur feature_list ccur semi + yacc.py:3381:Rule 8 def_class -> class error ocur feature_list ccur semi + yacc.py:3381:Rule 9 def_class -> class type ocur feature_list ccur error + yacc.py:3381:Rule 10 def_class -> class error inherits type ocur feature_list ccur semi + yacc.py:3381:Rule 11 def_class -> class error inherits error ocur feature_list ccur semi + yacc.py:3381:Rule 12 def_class -> class type inherits error ocur feature_list ccur semi + yacc.py:3381:Rule 13 def_class -> class type inherits type ocur feature_list ccur error + yacc.py:3381:Rule 14 feature_list -> epsilon + yacc.py:3381:Rule 15 feature_list -> def_attr semi feature_list + yacc.py:3381:Rule 16 feature_list -> def_func semi feature_list + yacc.py:3381:Rule 17 feature_list -> error feature_list + yacc.py:3381:Rule 18 def_attr -> id colon type + yacc.py:3381:Rule 19 def_attr -> id colon type larrow expr + yacc.py:3381:Rule 20 def_attr -> error colon type + yacc.py:3381:Rule 21 def_attr -> id colon error + yacc.py:3381:Rule 22 def_attr -> error colon type larrow expr + yacc.py:3381:Rule 23 def_attr -> id colon error larrow expr + yacc.py:3381:Rule 24 def_attr -> id colon type larrow error + yacc.py:3381:Rule 25 def_func -> id opar formals cpar colon type ocur expr ccur + yacc.py:3381:Rule 26 def_func -> error opar formals cpar colon type ocur expr ccur + yacc.py:3381:Rule 27 def_func -> id opar error cpar colon type ocur expr ccur + yacc.py:3381:Rule 28 def_func -> id opar formals cpar colon error ocur expr ccur + yacc.py:3381:Rule 29 def_func -> id opar formals cpar colon type ocur error ccur + yacc.py:3381:Rule 30 formals -> param_list + yacc.py:3381:Rule 31 formals -> param_list_empty + yacc.py:3381:Rule 32 param_list -> param + yacc.py:3381:Rule 33 param_list -> param comma param_list + yacc.py:3381:Rule 34 param_list_empty -> epsilon + yacc.py:3381:Rule 35 param -> id colon type + yacc.py:3381:Rule 36 let_list -> let_assign + yacc.py:3381:Rule 37 let_list -> let_assign comma let_list + yacc.py:3381:Rule 38 let_assign -> param larrow expr + yacc.py:3381:Rule 39 let_assign -> param + yacc.py:3381:Rule 40 cases_list -> casep semi + yacc.py:3381:Rule 41 cases_list -> casep semi cases_list + yacc.py:3381:Rule 42 cases_list -> error cases_list + yacc.py:3381:Rule 43 cases_list -> error semi + yacc.py:3381:Rule 44 casep -> id colon type rarrow expr + yacc.py:3381:Rule 45 expr -> id larrow expr + yacc.py:3381:Rule 46 expr -> comp + yacc.py:3381:Rule 47 comp -> comp less op + yacc.py:3381:Rule 48 comp -> comp lesseq op + yacc.py:3381:Rule 49 comp -> comp equal op + yacc.py:3381:Rule 50 comp -> op + yacc.py:3381:Rule 51 op -> op plus term + yacc.py:3381:Rule 52 op -> op minus term + yacc.py:3381:Rule 53 op -> term + yacc.py:3381:Rule 54 term -> term star base_call + yacc.py:3381:Rule 55 term -> term div base_call + yacc.py:3381:Rule 56 term -> base_call + yacc.py:3381:Rule 57 term -> term star error + yacc.py:3381:Rule 58 term -> term div error + yacc.py:3381:Rule 59 base_call -> factor arroba type dot func_call + yacc.py:3381:Rule 60 base_call -> factor + yacc.py:3381:Rule 61 base_call -> error arroba type dot func_call + yacc.py:3381:Rule 62 base_call -> factor arroba error dot func_call + yacc.py:3381:Rule 63 factor -> atom + yacc.py:3381:Rule 64 factor -> opar expr cpar + yacc.py:3381:Rule 65 factor -> factor dot func_call + yacc.py:3381:Rule 66 factor -> not expr + yacc.py:3381:Rule 67 factor -> func_call + yacc.py:3381:Rule 68 factor -> isvoid base_call + yacc.py:3381:Rule 69 factor -> nox base_call + yacc.py:3381:Rule 70 factor -> let let_list in expr + yacc.py:3381:Rule 71 factor -> case expr of cases_list esac + yacc.py:3381:Rule 72 factor -> if expr then expr else expr fi + yacc.py:3381:Rule 73 factor -> while expr loop expr pool + yacc.py:3381:Rule 74 atom -> num + yacc.py:3381:Rule 75 atom -> id + yacc.py:3381:Rule 76 atom -> new type + yacc.py:3381:Rule 77 atom -> ocur block ccur + yacc.py:3381:Rule 78 atom -> error block ccur + yacc.py:3381:Rule 79 atom -> ocur error ccur + yacc.py:3381:Rule 80 atom -> ocur block error + yacc.py:3381:Rule 81 atom -> true + yacc.py:3381:Rule 82 atom -> false + yacc.py:3381:Rule 83 atom -> string + yacc.py:3381:Rule 84 block -> expr semi + yacc.py:3381:Rule 85 block -> expr semi block + yacc.py:3381:Rule 86 block -> error block + yacc.py:3381:Rule 87 block -> error semi + yacc.py:3381:Rule 88 func_call -> id opar args cpar + yacc.py:3381:Rule 89 func_call -> id opar error cpar + yacc.py:3381:Rule 90 func_call -> error opar args cpar + yacc.py:3381:Rule 91 args -> arg_list + yacc.py:3381:Rule 92 args -> arg_list_empty + yacc.py:3381:Rule 93 arg_list -> expr + yacc.py:3381:Rule 94 arg_list -> expr comma arg_list + yacc.py:3381:Rule 95 arg_list -> error arg_list + yacc.py:3381:Rule 96 arg_list_empty -> epsilon + yacc.py:3399: + yacc.py:3400:Terminals, with rules where they appear + yacc.py:3401: + yacc.py:3405:arroba : 59 61 62 + yacc.py:3405:case : 71 + yacc.py:3405:ccur : 6 7 8 9 10 11 12 13 25 26 27 28 29 77 78 79 + yacc.py:3405:class : 6 7 8 9 10 11 12 13 + yacc.py:3405:colon : 18 19 20 21 22 23 24 25 26 27 28 29 35 44 + yacc.py:3405:comma : 33 37 94 + yacc.py:3405:cpar : 25 26 27 28 29 64 88 89 90 + yacc.py:3405:div : 55 58 + yacc.py:3405:dot : 59 61 62 65 + yacc.py:3405:else : 72 + yacc.py:3405:equal : 49 + yacc.py:3405:error : 5 8 9 10 11 11 12 13 17 20 21 22 23 24 26 27 28 29 42 43 57 58 61 62 78 79 80 86 87 89 90 95 + yacc.py:3405:esac : 71 + yacc.py:3405:false : 82 + yacc.py:3405:fi : 72 + yacc.py:3405:id : 18 19 21 23 24 25 27 28 29 35 44 45 75 88 89 + yacc.py:3405:if : 72 + yacc.py:3405:in : 70 + yacc.py:3405:inherits : 7 10 11 12 13 + yacc.py:3405:isvoid : 68 + yacc.py:3405:larrow : 19 22 23 24 38 45 + yacc.py:3405:less : 47 + yacc.py:3405:lesseq : 48 + yacc.py:3405:let : 70 + yacc.py:3405:loop : 73 + yacc.py:3405:minus : 52 + yacc.py:3405:new : 76 + yacc.py:3405:not : 66 + yacc.py:3405:nox : 69 + yacc.py:3405:num : 74 + yacc.py:3405:ocur : 6 7 8 9 10 11 12 13 25 26 27 28 29 77 79 80 + yacc.py:3405:of : 71 + yacc.py:3405:opar : 25 26 27 28 29 64 88 89 90 + yacc.py:3405:plus : 51 + yacc.py:3405:pool : 73 + yacc.py:3405:rarrow : 44 + yacc.py:3405:semi : 6 7 8 10 11 12 15 16 40 41 43 84 85 87 + yacc.py:3405:star : 54 57 + yacc.py:3405:string : 83 + yacc.py:3405:then : 72 + yacc.py:3405:true : 81 + yacc.py:3405:type : 6 7 7 9 10 12 13 13 18 19 20 22 24 25 26 27 29 35 44 59 61 76 + yacc.py:3405:while : 73 + yacc.py:3407: + yacc.py:3408:Nonterminals, with rules where they appear + yacc.py:3409: + yacc.py:3413:arg_list : 91 94 95 + yacc.py:3413:arg_list_empty : 92 + yacc.py:3413:args : 88 90 + yacc.py:3413:atom : 63 + yacc.py:3413:base_call : 54 55 56 68 69 + yacc.py:3413:block : 77 78 80 85 86 + yacc.py:3413:casep : 40 41 + yacc.py:3413:cases_list : 41 42 71 + yacc.py:3413:class_list : 1 3 5 + yacc.py:3413:comp : 46 47 48 49 + yacc.py:3413:def_attr : 15 + yacc.py:3413:def_class : 3 4 + yacc.py:3413:def_func : 16 + yacc.py:3413:epsilon : 14 34 96 + yacc.py:3413:expr : 19 22 23 25 26 27 28 38 44 45 64 66 70 71 72 72 72 73 73 84 85 93 94 + yacc.py:3413:factor : 59 60 62 65 + yacc.py:3413:feature_list : 6 7 8 9 10 11 12 13 15 16 17 + yacc.py:3413:formals : 25 26 28 29 + yacc.py:3413:func_call : 59 61 62 65 67 + yacc.py:3413:let_assign : 36 37 + yacc.py:3413:let_list : 37 70 + yacc.py:3413:op : 47 48 49 50 51 52 + yacc.py:3413:param : 32 33 38 39 + yacc.py:3413:param_list : 30 33 + yacc.py:3413:param_list_empty : 31 + yacc.py:3413:program : 0 + yacc.py:3413:term : 51 52 53 54 55 57 58 + yacc.py:3414: + yacc.py:3436:Generating LALR tables + yacc.py:2543:Parsing method: LALR + yacc.py:2561: + yacc.py:2562:state 0 + yacc.py:2563: + yacc.py:2565: (0) S' -> . program + yacc.py:2565: (1) program -> . class_list + yacc.py:2565: (3) class_list -> . def_class class_list + yacc.py:2565: (4) class_list -> . def_class + yacc.py:2565: (5) class_list -> . error class_list + yacc.py:2565: (6) def_class -> . class type ocur feature_list ccur semi + yacc.py:2565: (7) def_class -> . class type inherits type ocur feature_list ccur semi + yacc.py:2565: (8) def_class -> . class error ocur feature_list ccur semi + yacc.py:2565: (9) def_class -> . class type ocur feature_list ccur error + yacc.py:2565: (10) def_class -> . class error inherits type ocur feature_list ccur semi + yacc.py:2565: (11) def_class -> . class error inherits error ocur feature_list ccur semi + yacc.py:2565: (12) def_class -> . class type inherits error ocur feature_list ccur semi + yacc.py:2565: (13) def_class -> . class type inherits type ocur feature_list ccur error + yacc.py:2566: + yacc.py:2687: error shift and go to state 4 + yacc.py:2687: class shift and go to state 5 + yacc.py:2689: + yacc.py:2714: program shift and go to state 1 + yacc.py:2714: class_list shift and go to state 2 + yacc.py:2714: def_class shift and go to state 3 + yacc.py:2561: + yacc.py:2562:state 1 + yacc.py:2563: + yacc.py:2565: (0) S' -> program . + yacc.py:2566: + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 2 + yacc.py:2563: + yacc.py:2565: (1) program -> class_list . + yacc.py:2566: + yacc.py:2687: $end reduce using rule 1 (program -> class_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 3 + yacc.py:2563: + yacc.py:2565: (3) class_list -> def_class . class_list + yacc.py:2565: (4) class_list -> def_class . + yacc.py:2565: (3) class_list -> . def_class class_list + yacc.py:2565: (4) class_list -> . def_class + yacc.py:2565: (5) class_list -> . error class_list + yacc.py:2565: (6) def_class -> . class type ocur feature_list ccur semi + yacc.py:2565: (7) def_class -> . class type inherits type ocur feature_list ccur semi + yacc.py:2565: (8) def_class -> . class error ocur feature_list ccur semi + yacc.py:2565: (9) def_class -> . class type ocur feature_list ccur error + yacc.py:2565: (10) def_class -> . class error inherits type ocur feature_list ccur semi + yacc.py:2565: (11) def_class -> . class error inherits error ocur feature_list ccur semi + yacc.py:2565: (12) def_class -> . class type inherits error ocur feature_list ccur semi + yacc.py:2565: (13) def_class -> . class type inherits type ocur feature_list ccur error + yacc.py:2566: + yacc.py:2687: $end reduce using rule 4 (class_list -> def_class .) + yacc.py:2687: error shift and go to state 4 + yacc.py:2687: class shift and go to state 5 + yacc.py:2689: + yacc.py:2714: def_class shift and go to state 3 + yacc.py:2714: class_list shift and go to state 6 + yacc.py:2561: + yacc.py:2562:state 4 + yacc.py:2563: + yacc.py:2565: (5) class_list -> error . class_list + yacc.py:2565: (3) class_list -> . def_class class_list + yacc.py:2565: (4) class_list -> . def_class + yacc.py:2565: (5) class_list -> . error class_list + yacc.py:2565: (6) def_class -> . class type ocur feature_list ccur semi + yacc.py:2565: (7) def_class -> . class type inherits type ocur feature_list ccur semi + yacc.py:2565: (8) def_class -> . class error ocur feature_list ccur semi + yacc.py:2565: (9) def_class -> . class type ocur feature_list ccur error + yacc.py:2565: (10) def_class -> . class error inherits type ocur feature_list ccur semi + yacc.py:2565: (11) def_class -> . class error inherits error ocur feature_list ccur semi + yacc.py:2565: (12) def_class -> . class type inherits error ocur feature_list ccur semi + yacc.py:2565: (13) def_class -> . class type inherits type ocur feature_list ccur error + yacc.py:2566: + yacc.py:2687: error shift and go to state 4 + yacc.py:2687: class shift and go to state 5 + yacc.py:2689: + yacc.py:2714: class_list shift and go to state 7 + yacc.py:2714: def_class shift and go to state 3 + yacc.py:2561: + yacc.py:2562:state 5 + yacc.py:2563: + yacc.py:2565: (6) def_class -> class . type ocur feature_list ccur semi + yacc.py:2565: (7) def_class -> class . type inherits type ocur feature_list ccur semi + yacc.py:2565: (8) def_class -> class . error ocur feature_list ccur semi + yacc.py:2565: (9) def_class -> class . type ocur feature_list ccur error + yacc.py:2565: (10) def_class -> class . error inherits type ocur feature_list ccur semi + yacc.py:2565: (11) def_class -> class . error inherits error ocur feature_list ccur semi + yacc.py:2565: (12) def_class -> class . type inherits error ocur feature_list ccur semi + yacc.py:2565: (13) def_class -> class . type inherits type ocur feature_list ccur error + yacc.py:2566: + yacc.py:2687: type shift and go to state 8 + yacc.py:2687: error shift and go to state 9 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 6 + yacc.py:2563: + yacc.py:2565: (3) class_list -> def_class class_list . + yacc.py:2566: + yacc.py:2687: $end reduce using rule 3 (class_list -> def_class class_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 7 + yacc.py:2563: + yacc.py:2565: (5) class_list -> error class_list . + yacc.py:2566: + yacc.py:2687: $end reduce using rule 5 (class_list -> error class_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 8 + yacc.py:2563: + yacc.py:2565: (6) def_class -> class type . ocur feature_list ccur semi + yacc.py:2565: (7) def_class -> class type . inherits type ocur feature_list ccur semi + yacc.py:2565: (9) def_class -> class type . ocur feature_list ccur error + yacc.py:2565: (12) def_class -> class type . inherits error ocur feature_list ccur semi + yacc.py:2565: (13) def_class -> class type . inherits type ocur feature_list ccur error + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 10 + yacc.py:2687: inherits shift and go to state 11 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 9 + yacc.py:2563: + yacc.py:2565: (8) def_class -> class error . ocur feature_list ccur semi + yacc.py:2565: (10) def_class -> class error . inherits type ocur feature_list ccur semi + yacc.py:2565: (11) def_class -> class error . inherits error ocur feature_list ccur semi + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 12 + yacc.py:2687: inherits shift and go to state 13 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 10 + yacc.py:2563: + yacc.py:2565: (6) def_class -> class type ocur . feature_list ccur semi + yacc.py:2565: (9) def_class -> class type ocur . feature_list ccur error + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: feature_list shift and go to state 14 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 11 + yacc.py:2563: + yacc.py:2565: (7) def_class -> class type inherits . type ocur feature_list ccur semi + yacc.py:2565: (12) def_class -> class type inherits . error ocur feature_list ccur semi + yacc.py:2565: (13) def_class -> class type inherits . type ocur feature_list ccur error + yacc.py:2566: + yacc.py:2687: type shift and go to state 20 + yacc.py:2687: error shift and go to state 21 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 12 + yacc.py:2563: + yacc.py:2565: (8) def_class -> class error ocur . feature_list ccur semi + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: feature_list shift and go to state 22 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 13 + yacc.py:2563: + yacc.py:2565: (10) def_class -> class error inherits . type ocur feature_list ccur semi + yacc.py:2565: (11) def_class -> class error inherits . error ocur feature_list ccur semi + yacc.py:2566: + yacc.py:2687: type shift and go to state 24 + yacc.py:2687: error shift and go to state 23 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 14 + yacc.py:2563: + yacc.py:2565: (6) def_class -> class type ocur feature_list . ccur semi + yacc.py:2565: (9) def_class -> class type ocur feature_list . ccur error + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 25 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 15 + yacc.py:2563: + yacc.py:2565: (17) feature_list -> error . feature_list + yacc.py:2565: (20) def_attr -> error . colon type + yacc.py:2565: (22) def_attr -> error . colon type larrow expr + yacc.py:2565: (26) def_func -> error . opar formals cpar colon type ocur expr ccur + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: colon shift and go to state 27 + yacc.py:2687: opar shift and go to state 28 + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: feature_list shift and go to state 26 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 16 + yacc.py:2563: + yacc.py:2565: (14) feature_list -> epsilon . + yacc.py:2566: + yacc.py:2687: ccur reduce using rule 14 (feature_list -> epsilon .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 17 + yacc.py:2563: + yacc.py:2565: (15) feature_list -> def_attr . semi feature_list + yacc.py:2566: + yacc.py:2687: semi shift and go to state 29 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 18 + yacc.py:2563: + yacc.py:2565: (16) feature_list -> def_func . semi feature_list + yacc.py:2566: + yacc.py:2687: semi shift and go to state 30 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 19 + yacc.py:2563: + yacc.py:2565: (18) def_attr -> id . colon type + yacc.py:2565: (19) def_attr -> id . colon type larrow expr + yacc.py:2565: (21) def_attr -> id . colon error + yacc.py:2565: (23) def_attr -> id . colon error larrow expr + yacc.py:2565: (24) def_attr -> id . colon type larrow error + yacc.py:2565: (25) def_func -> id . opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> id . opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> id . opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> id . opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: colon shift and go to state 31 + yacc.py:2687: opar shift and go to state 32 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 20 + yacc.py:2563: + yacc.py:2565: (7) def_class -> class type inherits type . ocur feature_list ccur semi + yacc.py:2565: (13) def_class -> class type inherits type . ocur feature_list ccur error + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 33 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 21 + yacc.py:2563: + yacc.py:2565: (12) def_class -> class type inherits error . ocur feature_list ccur semi + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 34 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 22 + yacc.py:2563: + yacc.py:2565: (8) def_class -> class error ocur feature_list . ccur semi + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 35 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 23 + yacc.py:2563: + yacc.py:2565: (11) def_class -> class error inherits error . ocur feature_list ccur semi + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 36 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 24 + yacc.py:2563: + yacc.py:2565: (10) def_class -> class error inherits type . ocur feature_list ccur semi + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 37 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 25 + yacc.py:2563: + yacc.py:2565: (6) def_class -> class type ocur feature_list ccur . semi + yacc.py:2565: (9) def_class -> class type ocur feature_list ccur . error + yacc.py:2566: + yacc.py:2687: semi shift and go to state 38 + yacc.py:2687: error shift and go to state 39 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 26 + yacc.py:2563: + yacc.py:2565: (17) feature_list -> error feature_list . + yacc.py:2566: + yacc.py:2687: ccur reduce using rule 17 (feature_list -> error feature_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 27 + yacc.py:2563: + yacc.py:2565: (20) def_attr -> error colon . type + yacc.py:2565: (22) def_attr -> error colon . type larrow expr + yacc.py:2566: + yacc.py:2687: type shift and go to state 40 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 28 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar . formals cpar colon type ocur expr ccur + yacc.py:2565: (30) formals -> . param_list + yacc.py:2565: (31) formals -> . param_list_empty + yacc.py:2565: (32) param_list -> . param + yacc.py:2565: (33) param_list -> . param comma param_list + yacc.py:2565: (34) param_list_empty -> . epsilon + yacc.py:2565: (35) param -> . id colon type + yacc.py:2565: (2) epsilon -> . + yacc.py:2566: + yacc.py:2687: id shift and go to state 46 + yacc.py:2687: cpar reduce using rule 2 (epsilon -> .) + yacc.py:2689: + yacc.py:2714: formals shift and go to state 41 + yacc.py:2714: param_list shift and go to state 42 + yacc.py:2714: param_list_empty shift and go to state 43 + yacc.py:2714: param shift and go to state 44 + yacc.py:2714: epsilon shift and go to state 45 + yacc.py:2561: + yacc.py:2562:state 29 + yacc.py:2563: + yacc.py:2565: (15) feature_list -> def_attr semi . feature_list + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: feature_list shift and go to state 47 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 30 + yacc.py:2563: + yacc.py:2565: (16) feature_list -> def_func semi . feature_list + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2714: feature_list shift and go to state 48 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2561: + yacc.py:2562:state 31 + yacc.py:2563: + yacc.py:2565: (18) def_attr -> id colon . type + yacc.py:2565: (19) def_attr -> id colon . type larrow expr + yacc.py:2565: (21) def_attr -> id colon . error + yacc.py:2565: (23) def_attr -> id colon . error larrow expr + yacc.py:2565: (24) def_attr -> id colon . type larrow error + yacc.py:2566: + yacc.py:2687: type shift and go to state 49 + yacc.py:2687: error shift and go to state 50 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 32 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar . formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> id opar . error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> id opar . formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> id opar . formals cpar colon type ocur error ccur + yacc.py:2565: (30) formals -> . param_list + yacc.py:2565: (31) formals -> . param_list_empty + yacc.py:2565: (32) param_list -> . param + yacc.py:2565: (33) param_list -> . param comma param_list + yacc.py:2565: (34) param_list_empty -> . epsilon + yacc.py:2565: (35) param -> . id colon type + yacc.py:2565: (2) epsilon -> . + yacc.py:2566: + yacc.py:2687: error shift and go to state 52 + yacc.py:2687: id shift and go to state 46 + yacc.py:2687: cpar reduce using rule 2 (epsilon -> .) + yacc.py:2689: + yacc.py:2714: formals shift and go to state 51 + yacc.py:2714: param_list shift and go to state 42 + yacc.py:2714: param_list_empty shift and go to state 43 + yacc.py:2714: param shift and go to state 44 + yacc.py:2714: epsilon shift and go to state 45 + yacc.py:2561: + yacc.py:2562:state 33 + yacc.py:2563: + yacc.py:2565: (7) def_class -> class type inherits type ocur . feature_list ccur semi + yacc.py:2565: (13) def_class -> class type inherits type ocur . feature_list ccur error + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: feature_list shift and go to state 53 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 34 + yacc.py:2563: + yacc.py:2565: (12) def_class -> class type inherits error ocur . feature_list ccur semi + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: feature_list shift and go to state 54 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 35 + yacc.py:2563: + yacc.py:2565: (8) def_class -> class error ocur feature_list ccur . semi + yacc.py:2566: + yacc.py:2687: semi shift and go to state 55 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 36 + yacc.py:2563: + yacc.py:2565: (11) def_class -> class error inherits error ocur . feature_list ccur semi + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: feature_list shift and go to state 56 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 37 + yacc.py:2563: + yacc.py:2565: (10) def_class -> class error inherits type ocur . feature_list ccur semi + yacc.py:2565: (14) feature_list -> . epsilon + yacc.py:2565: (15) feature_list -> . def_attr semi feature_list + yacc.py:2565: (16) feature_list -> . def_func semi feature_list + yacc.py:2565: (17) feature_list -> . error feature_list + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (18) def_attr -> . id colon type + yacc.py:2565: (19) def_attr -> . id colon type larrow expr + yacc.py:2565: (20) def_attr -> . error colon type + yacc.py:2565: (21) def_attr -> . id colon error + yacc.py:2565: (22) def_attr -> . error colon type larrow expr + yacc.py:2565: (23) def_attr -> . id colon error larrow expr + yacc.py:2565: (24) def_attr -> . id colon type larrow error + yacc.py:2565: (25) def_func -> . id opar formals cpar colon type ocur expr ccur + yacc.py:2565: (26) def_func -> . error opar formals cpar colon type ocur expr ccur + yacc.py:2565: (27) def_func -> . id opar error cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> . id opar formals cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> . id opar formals cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: error shift and go to state 15 + yacc.py:2687: ccur reduce using rule 2 (epsilon -> .) + yacc.py:2687: id shift and go to state 19 + yacc.py:2689: + yacc.py:2714: feature_list shift and go to state 57 + yacc.py:2714: epsilon shift and go to state 16 + yacc.py:2714: def_attr shift and go to state 17 + yacc.py:2714: def_func shift and go to state 18 + yacc.py:2561: + yacc.py:2562:state 38 + yacc.py:2563: + yacc.py:2565: (6) def_class -> class type ocur feature_list ccur semi . + yacc.py:2566: + yacc.py:2687: error reduce using rule 6 (def_class -> class type ocur feature_list ccur semi .) + yacc.py:2687: class reduce using rule 6 (def_class -> class type ocur feature_list ccur semi .) + yacc.py:2687: $end reduce using rule 6 (def_class -> class type ocur feature_list ccur semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 39 + yacc.py:2563: + yacc.py:2565: (9) def_class -> class type ocur feature_list ccur error . + yacc.py:2566: + yacc.py:2687: error reduce using rule 9 (def_class -> class type ocur feature_list ccur error .) + yacc.py:2687: class reduce using rule 9 (def_class -> class type ocur feature_list ccur error .) + yacc.py:2687: $end reduce using rule 9 (def_class -> class type ocur feature_list ccur error .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 40 + yacc.py:2563: + yacc.py:2565: (20) def_attr -> error colon type . + yacc.py:2565: (22) def_attr -> error colon type . larrow expr + yacc.py:2566: + yacc.py:2687: semi reduce using rule 20 (def_attr -> error colon type .) + yacc.py:2687: larrow shift and go to state 58 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 41 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar formals . cpar colon type ocur expr ccur + yacc.py:2566: + yacc.py:2687: cpar shift and go to state 59 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 42 + yacc.py:2563: + yacc.py:2565: (30) formals -> param_list . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 30 (formals -> param_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 43 + yacc.py:2563: + yacc.py:2565: (31) formals -> param_list_empty . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 31 (formals -> param_list_empty .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 44 + yacc.py:2563: + yacc.py:2565: (32) param_list -> param . + yacc.py:2565: (33) param_list -> param . comma param_list + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 32 (param_list -> param .) + yacc.py:2687: comma shift and go to state 60 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 45 + yacc.py:2563: + yacc.py:2565: (34) param_list_empty -> epsilon . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 34 (param_list_empty -> epsilon .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 46 + yacc.py:2563: + yacc.py:2565: (35) param -> id . colon type + yacc.py:2566: + yacc.py:2687: colon shift and go to state 61 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 47 + yacc.py:2563: + yacc.py:2565: (15) feature_list -> def_attr semi feature_list . + yacc.py:2566: + yacc.py:2687: ccur reduce using rule 15 (feature_list -> def_attr semi feature_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 48 + yacc.py:2563: + yacc.py:2565: (16) feature_list -> def_func semi feature_list . + yacc.py:2566: + yacc.py:2687: ccur reduce using rule 16 (feature_list -> def_func semi feature_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 49 + yacc.py:2563: + yacc.py:2565: (18) def_attr -> id colon type . + yacc.py:2565: (19) def_attr -> id colon type . larrow expr + yacc.py:2565: (24) def_attr -> id colon type . larrow error + yacc.py:2566: + yacc.py:2687: semi reduce using rule 18 (def_attr -> id colon type .) + yacc.py:2687: larrow shift and go to state 62 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 50 + yacc.py:2563: + yacc.py:2565: (21) def_attr -> id colon error . + yacc.py:2565: (23) def_attr -> id colon error . larrow expr + yacc.py:2566: + yacc.py:2687: semi reduce using rule 21 (def_attr -> id colon error .) + yacc.py:2687: larrow shift and go to state 63 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 51 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar formals . cpar colon type ocur expr ccur + yacc.py:2565: (28) def_func -> id opar formals . cpar colon error ocur expr ccur + yacc.py:2565: (29) def_func -> id opar formals . cpar colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: cpar shift and go to state 64 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 52 + yacc.py:2563: + yacc.py:2565: (27) def_func -> id opar error . cpar colon type ocur expr ccur + yacc.py:2566: + yacc.py:2687: cpar shift and go to state 65 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 53 + yacc.py:2563: + yacc.py:2565: (7) def_class -> class type inherits type ocur feature_list . ccur semi + yacc.py:2565: (13) def_class -> class type inherits type ocur feature_list . ccur error + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 66 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 54 + yacc.py:2563: + yacc.py:2565: (12) def_class -> class type inherits error ocur feature_list . ccur semi + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 67 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 55 + yacc.py:2563: + yacc.py:2565: (8) def_class -> class error ocur feature_list ccur semi . + yacc.py:2566: + yacc.py:2687: error reduce using rule 8 (def_class -> class error ocur feature_list ccur semi .) + yacc.py:2687: class reduce using rule 8 (def_class -> class error ocur feature_list ccur semi .) + yacc.py:2687: $end reduce using rule 8 (def_class -> class error ocur feature_list ccur semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 56 + yacc.py:2563: + yacc.py:2565: (11) def_class -> class error inherits error ocur feature_list . ccur semi + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 68 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 57 + yacc.py:2563: + yacc.py:2565: (10) def_class -> class error inherits type ocur feature_list . ccur semi + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 69 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 58 + yacc.py:2563: + yacc.py:2565: (22) def_attr -> error colon type larrow . expr + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 71 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 59 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar formals cpar . colon type ocur expr ccur + yacc.py:2566: + yacc.py:2687: colon shift and go to state 94 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 60 + yacc.py:2563: + yacc.py:2565: (33) param_list -> param comma . param_list + yacc.py:2565: (32) param_list -> . param + yacc.py:2565: (33) param_list -> . param comma param_list + yacc.py:2565: (35) param -> . id colon type + yacc.py:2566: + yacc.py:2687: id shift and go to state 46 + yacc.py:2689: + yacc.py:2714: param shift and go to state 44 + yacc.py:2714: param_list shift and go to state 95 + yacc.py:2561: + yacc.py:2562:state 61 + yacc.py:2563: + yacc.py:2565: (35) param -> id colon . type + yacc.py:2566: + yacc.py:2687: type shift and go to state 96 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 62 + yacc.py:2563: + yacc.py:2565: (19) def_attr -> id colon type larrow . expr + yacc.py:2565: (24) def_attr -> id colon type larrow . error + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 98 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 97 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 63 + yacc.py:2563: + yacc.py:2565: (23) def_attr -> id colon error larrow . expr + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 99 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 64 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar formals cpar . colon type ocur expr ccur + yacc.py:2565: (28) def_func -> id opar formals cpar . colon error ocur expr ccur + yacc.py:2565: (29) def_func -> id opar formals cpar . colon type ocur error ccur + yacc.py:2566: + yacc.py:2687: colon shift and go to state 100 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 65 + yacc.py:2563: + yacc.py:2565: (27) def_func -> id opar error cpar . colon type ocur expr ccur + yacc.py:2566: + yacc.py:2687: colon shift and go to state 101 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 66 + yacc.py:2563: + yacc.py:2565: (7) def_class -> class type inherits type ocur feature_list ccur . semi + yacc.py:2565: (13) def_class -> class type inherits type ocur feature_list ccur . error + yacc.py:2566: + yacc.py:2687: semi shift and go to state 102 + yacc.py:2687: error shift and go to state 103 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 67 + yacc.py:2563: + yacc.py:2565: (12) def_class -> class type inherits error ocur feature_list ccur . semi + yacc.py:2566: + yacc.py:2687: semi shift and go to state 104 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 68 + yacc.py:2563: + yacc.py:2565: (11) def_class -> class error inherits error ocur feature_list ccur . semi + yacc.py:2566: + yacc.py:2687: semi shift and go to state 105 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 69 + yacc.py:2563: + yacc.py:2565: (10) def_class -> class error inherits type ocur feature_list ccur . semi + yacc.py:2566: + yacc.py:2687: semi shift and go to state 106 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 70 + yacc.py:2563: + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: block shift and go to state 109 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 71 + yacc.py:2563: + yacc.py:2565: (22) def_attr -> error colon type larrow expr . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 22 (def_attr -> error colon type larrow expr .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 72 + yacc.py:2563: + yacc.py:2565: (45) expr -> id . larrow expr + yacc.py:2565: (75) atom -> id . + yacc.py:2565: (88) func_call -> id . opar args cpar + yacc.py:2565: (89) func_call -> id . opar error cpar + yacc.py:2566: + yacc.py:2687: larrow shift and go to state 112 + yacc.py:2687: arroba reduce using rule 75 (atom -> id .) + yacc.py:2687: dot reduce using rule 75 (atom -> id .) + yacc.py:2687: star reduce using rule 75 (atom -> id .) + yacc.py:2687: div reduce using rule 75 (atom -> id .) + yacc.py:2687: plus reduce using rule 75 (atom -> id .) + yacc.py:2687: minus reduce using rule 75 (atom -> id .) + yacc.py:2687: less reduce using rule 75 (atom -> id .) + yacc.py:2687: lesseq reduce using rule 75 (atom -> id .) + yacc.py:2687: equal reduce using rule 75 (atom -> id .) + yacc.py:2687: semi reduce using rule 75 (atom -> id .) + yacc.py:2687: cpar reduce using rule 75 (atom -> id .) + yacc.py:2687: of reduce using rule 75 (atom -> id .) + yacc.py:2687: then reduce using rule 75 (atom -> id .) + yacc.py:2687: loop reduce using rule 75 (atom -> id .) + yacc.py:2687: comma reduce using rule 75 (atom -> id .) + yacc.py:2687: in reduce using rule 75 (atom -> id .) + yacc.py:2687: else reduce using rule 75 (atom -> id .) + yacc.py:2687: pool reduce using rule 75 (atom -> id .) + yacc.py:2687: ccur reduce using rule 75 (atom -> id .) + yacc.py:2687: fi reduce using rule 75 (atom -> id .) + yacc.py:2687: opar shift and go to state 113 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 73 + yacc.py:2563: + yacc.py:2565: (46) expr -> comp . + yacc.py:2565: (47) comp -> comp . less op + yacc.py:2565: (48) comp -> comp . lesseq op + yacc.py:2565: (49) comp -> comp . equal op + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for less resolved as shift + yacc.py:2666: ! shift/reduce conflict for lesseq resolved as shift + yacc.py:2666: ! shift/reduce conflict for equal resolved as shift + yacc.py:2687: semi reduce using rule 46 (expr -> comp .) + yacc.py:2687: cpar reduce using rule 46 (expr -> comp .) + yacc.py:2687: arroba reduce using rule 46 (expr -> comp .) + yacc.py:2687: dot reduce using rule 46 (expr -> comp .) + yacc.py:2687: star reduce using rule 46 (expr -> comp .) + yacc.py:2687: div reduce using rule 46 (expr -> comp .) + yacc.py:2687: plus reduce using rule 46 (expr -> comp .) + yacc.py:2687: minus reduce using rule 46 (expr -> comp .) + yacc.py:2687: of reduce using rule 46 (expr -> comp .) + yacc.py:2687: then reduce using rule 46 (expr -> comp .) + yacc.py:2687: loop reduce using rule 46 (expr -> comp .) + yacc.py:2687: comma reduce using rule 46 (expr -> comp .) + yacc.py:2687: in reduce using rule 46 (expr -> comp .) + yacc.py:2687: else reduce using rule 46 (expr -> comp .) + yacc.py:2687: pool reduce using rule 46 (expr -> comp .) + yacc.py:2687: ccur reduce using rule 46 (expr -> comp .) + yacc.py:2687: fi reduce using rule 46 (expr -> comp .) + yacc.py:2687: less shift and go to state 114 + yacc.py:2687: lesseq shift and go to state 115 + yacc.py:2687: equal shift and go to state 116 + yacc.py:2689: + yacc.py:2696: ! less [ reduce using rule 46 (expr -> comp .) ] + yacc.py:2696: ! lesseq [ reduce using rule 46 (expr -> comp .) ] + yacc.py:2696: ! equal [ reduce using rule 46 (expr -> comp .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 74 + yacc.py:2563: + yacc.py:2565: (50) comp -> op . + yacc.py:2565: (51) op -> op . plus term + yacc.py:2565: (52) op -> op . minus term + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for plus resolved as shift + yacc.py:2666: ! shift/reduce conflict for minus resolved as shift + yacc.py:2687: less reduce using rule 50 (comp -> op .) + yacc.py:2687: lesseq reduce using rule 50 (comp -> op .) + yacc.py:2687: equal reduce using rule 50 (comp -> op .) + yacc.py:2687: semi reduce using rule 50 (comp -> op .) + yacc.py:2687: cpar reduce using rule 50 (comp -> op .) + yacc.py:2687: arroba reduce using rule 50 (comp -> op .) + yacc.py:2687: dot reduce using rule 50 (comp -> op .) + yacc.py:2687: star reduce using rule 50 (comp -> op .) + yacc.py:2687: div reduce using rule 50 (comp -> op .) + yacc.py:2687: of reduce using rule 50 (comp -> op .) + yacc.py:2687: then reduce using rule 50 (comp -> op .) + yacc.py:2687: loop reduce using rule 50 (comp -> op .) + yacc.py:2687: comma reduce using rule 50 (comp -> op .) + yacc.py:2687: in reduce using rule 50 (comp -> op .) + yacc.py:2687: else reduce using rule 50 (comp -> op .) + yacc.py:2687: pool reduce using rule 50 (comp -> op .) + yacc.py:2687: ccur reduce using rule 50 (comp -> op .) + yacc.py:2687: fi reduce using rule 50 (comp -> op .) + yacc.py:2687: plus shift and go to state 117 + yacc.py:2687: minus shift and go to state 118 + yacc.py:2689: + yacc.py:2696: ! plus [ reduce using rule 50 (comp -> op .) ] + yacc.py:2696: ! minus [ reduce using rule 50 (comp -> op .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 75 + yacc.py:2563: + yacc.py:2565: (53) op -> term . + yacc.py:2565: (54) term -> term . star base_call + yacc.py:2565: (55) term -> term . div base_call + yacc.py:2565: (57) term -> term . star error + yacc.py:2565: (58) term -> term . div error + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for star resolved as shift + yacc.py:2666: ! shift/reduce conflict for div resolved as shift + yacc.py:2687: plus reduce using rule 53 (op -> term .) + yacc.py:2687: minus reduce using rule 53 (op -> term .) + yacc.py:2687: less reduce using rule 53 (op -> term .) + yacc.py:2687: lesseq reduce using rule 53 (op -> term .) + yacc.py:2687: equal reduce using rule 53 (op -> term .) + yacc.py:2687: semi reduce using rule 53 (op -> term .) + yacc.py:2687: cpar reduce using rule 53 (op -> term .) + yacc.py:2687: arroba reduce using rule 53 (op -> term .) + yacc.py:2687: dot reduce using rule 53 (op -> term .) + yacc.py:2687: of reduce using rule 53 (op -> term .) + yacc.py:2687: then reduce using rule 53 (op -> term .) + yacc.py:2687: loop reduce using rule 53 (op -> term .) + yacc.py:2687: comma reduce using rule 53 (op -> term .) + yacc.py:2687: in reduce using rule 53 (op -> term .) + yacc.py:2687: else reduce using rule 53 (op -> term .) + yacc.py:2687: pool reduce using rule 53 (op -> term .) + yacc.py:2687: ccur reduce using rule 53 (op -> term .) + yacc.py:2687: fi reduce using rule 53 (op -> term .) + yacc.py:2687: star shift and go to state 119 + yacc.py:2687: div shift and go to state 120 + yacc.py:2689: + yacc.py:2696: ! star [ reduce using rule 53 (op -> term .) ] + yacc.py:2696: ! div [ reduce using rule 53 (op -> term .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 76 + yacc.py:2563: + yacc.py:2565: (56) term -> base_call . + yacc.py:2566: + yacc.py:2687: star reduce using rule 56 (term -> base_call .) + yacc.py:2687: div reduce using rule 56 (term -> base_call .) + yacc.py:2687: plus reduce using rule 56 (term -> base_call .) + yacc.py:2687: minus reduce using rule 56 (term -> base_call .) + yacc.py:2687: less reduce using rule 56 (term -> base_call .) + yacc.py:2687: lesseq reduce using rule 56 (term -> base_call .) + yacc.py:2687: equal reduce using rule 56 (term -> base_call .) + yacc.py:2687: semi reduce using rule 56 (term -> base_call .) + yacc.py:2687: cpar reduce using rule 56 (term -> base_call .) + yacc.py:2687: arroba reduce using rule 56 (term -> base_call .) + yacc.py:2687: dot reduce using rule 56 (term -> base_call .) + yacc.py:2687: of reduce using rule 56 (term -> base_call .) + yacc.py:2687: then reduce using rule 56 (term -> base_call .) + yacc.py:2687: loop reduce using rule 56 (term -> base_call .) + yacc.py:2687: comma reduce using rule 56 (term -> base_call .) + yacc.py:2687: in reduce using rule 56 (term -> base_call .) + yacc.py:2687: else reduce using rule 56 (term -> base_call .) + yacc.py:2687: pool reduce using rule 56 (term -> base_call .) + yacc.py:2687: ccur reduce using rule 56 (term -> base_call .) + yacc.py:2687: fi reduce using rule 56 (term -> base_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 77 + yacc.py:2563: + yacc.py:2565: (59) base_call -> factor . arroba type dot func_call + yacc.py:2565: (60) base_call -> factor . + yacc.py:2565: (62) base_call -> factor . arroba error dot func_call + yacc.py:2565: (65) factor -> factor . dot func_call + yacc.py:2566: + yacc.py:2609: ! shift/reduce conflict for arroba resolved as shift + yacc.py:2666: ! shift/reduce conflict for dot resolved as shift + yacc.py:2687: arroba shift and go to state 121 + yacc.py:2687: star reduce using rule 60 (base_call -> factor .) + yacc.py:2687: div reduce using rule 60 (base_call -> factor .) + yacc.py:2687: plus reduce using rule 60 (base_call -> factor .) + yacc.py:2687: minus reduce using rule 60 (base_call -> factor .) + yacc.py:2687: less reduce using rule 60 (base_call -> factor .) + yacc.py:2687: lesseq reduce using rule 60 (base_call -> factor .) + yacc.py:2687: equal reduce using rule 60 (base_call -> factor .) + yacc.py:2687: semi reduce using rule 60 (base_call -> factor .) + yacc.py:2687: cpar reduce using rule 60 (base_call -> factor .) + yacc.py:2687: of reduce using rule 60 (base_call -> factor .) + yacc.py:2687: then reduce using rule 60 (base_call -> factor .) + yacc.py:2687: loop reduce using rule 60 (base_call -> factor .) + yacc.py:2687: comma reduce using rule 60 (base_call -> factor .) + yacc.py:2687: in reduce using rule 60 (base_call -> factor .) + yacc.py:2687: else reduce using rule 60 (base_call -> factor .) + yacc.py:2687: pool reduce using rule 60 (base_call -> factor .) + yacc.py:2687: ccur reduce using rule 60 (base_call -> factor .) + yacc.py:2687: fi reduce using rule 60 (base_call -> factor .) + yacc.py:2687: dot shift and go to state 122 + yacc.py:2689: + yacc.py:2696: ! arroba [ reduce using rule 60 (base_call -> factor .) ] + yacc.py:2696: ! dot [ reduce using rule 60 (base_call -> factor .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 78 + yacc.py:2563: + yacc.py:2565: (67) factor -> func_call . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 67 (factor -> func_call .) + yacc.py:2687: dot reduce using rule 67 (factor -> func_call .) + yacc.py:2687: star reduce using rule 67 (factor -> func_call .) + yacc.py:2687: div reduce using rule 67 (factor -> func_call .) + yacc.py:2687: plus reduce using rule 67 (factor -> func_call .) + yacc.py:2687: minus reduce using rule 67 (factor -> func_call .) + yacc.py:2687: less reduce using rule 67 (factor -> func_call .) + yacc.py:2687: lesseq reduce using rule 67 (factor -> func_call .) + yacc.py:2687: equal reduce using rule 67 (factor -> func_call .) + yacc.py:2687: semi reduce using rule 67 (factor -> func_call .) + yacc.py:2687: cpar reduce using rule 67 (factor -> func_call .) + yacc.py:2687: of reduce using rule 67 (factor -> func_call .) + yacc.py:2687: then reduce using rule 67 (factor -> func_call .) + yacc.py:2687: loop reduce using rule 67 (factor -> func_call .) + yacc.py:2687: comma reduce using rule 67 (factor -> func_call .) + yacc.py:2687: in reduce using rule 67 (factor -> func_call .) + yacc.py:2687: else reduce using rule 67 (factor -> func_call .) + yacc.py:2687: pool reduce using rule 67 (factor -> func_call .) + yacc.py:2687: ccur reduce using rule 67 (factor -> func_call .) + yacc.py:2687: fi reduce using rule 67 (factor -> func_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 79 + yacc.py:2563: + yacc.py:2565: (63) factor -> atom . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 63 (factor -> atom .) + yacc.py:2687: dot reduce using rule 63 (factor -> atom .) + yacc.py:2687: star reduce using rule 63 (factor -> atom .) + yacc.py:2687: div reduce using rule 63 (factor -> atom .) + yacc.py:2687: plus reduce using rule 63 (factor -> atom .) + yacc.py:2687: minus reduce using rule 63 (factor -> atom .) + yacc.py:2687: less reduce using rule 63 (factor -> atom .) + yacc.py:2687: lesseq reduce using rule 63 (factor -> atom .) + yacc.py:2687: equal reduce using rule 63 (factor -> atom .) + yacc.py:2687: semi reduce using rule 63 (factor -> atom .) + yacc.py:2687: cpar reduce using rule 63 (factor -> atom .) + yacc.py:2687: of reduce using rule 63 (factor -> atom .) + yacc.py:2687: then reduce using rule 63 (factor -> atom .) + yacc.py:2687: loop reduce using rule 63 (factor -> atom .) + yacc.py:2687: comma reduce using rule 63 (factor -> atom .) + yacc.py:2687: in reduce using rule 63 (factor -> atom .) + yacc.py:2687: else reduce using rule 63 (factor -> atom .) + yacc.py:2687: pool reduce using rule 63 (factor -> atom .) + yacc.py:2687: ccur reduce using rule 63 (factor -> atom .) + yacc.py:2687: fi reduce using rule 63 (factor -> atom .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 80 + yacc.py:2563: + yacc.py:2565: (64) factor -> opar . expr cpar + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 123 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 81 + yacc.py:2563: + yacc.py:2565: (66) factor -> not . expr + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 124 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 82 + yacc.py:2563: + yacc.py:2565: (68) factor -> isvoid . base_call + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: base_call shift and go to state 125 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 83 + yacc.py:2563: + yacc.py:2565: (69) factor -> nox . base_call + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: base_call shift and go to state 127 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 84 + yacc.py:2563: + yacc.py:2565: (70) factor -> let . let_list in expr + yacc.py:2565: (36) let_list -> . let_assign + yacc.py:2565: (37) let_list -> . let_assign comma let_list + yacc.py:2565: (38) let_assign -> . param larrow expr + yacc.py:2565: (39) let_assign -> . param + yacc.py:2565: (35) param -> . id colon type + yacc.py:2566: + yacc.py:2687: id shift and go to state 46 + yacc.py:2689: + yacc.py:2714: let_list shift and go to state 128 + yacc.py:2714: let_assign shift and go to state 129 + yacc.py:2714: param shift and go to state 130 + yacc.py:2561: + yacc.py:2562:state 85 + yacc.py:2563: + yacc.py:2565: (71) factor -> case . expr of cases_list esac + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 131 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 86 + yacc.py:2563: + yacc.py:2565: (72) factor -> if . expr then expr else expr fi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 132 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 87 + yacc.py:2563: + yacc.py:2565: (73) factor -> while . expr loop expr pool + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 133 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 88 + yacc.py:2563: + yacc.py:2565: (74) atom -> num . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 74 (atom -> num .) + yacc.py:2687: dot reduce using rule 74 (atom -> num .) + yacc.py:2687: star reduce using rule 74 (atom -> num .) + yacc.py:2687: div reduce using rule 74 (atom -> num .) + yacc.py:2687: plus reduce using rule 74 (atom -> num .) + yacc.py:2687: minus reduce using rule 74 (atom -> num .) + yacc.py:2687: less reduce using rule 74 (atom -> num .) + yacc.py:2687: lesseq reduce using rule 74 (atom -> num .) + yacc.py:2687: equal reduce using rule 74 (atom -> num .) + yacc.py:2687: semi reduce using rule 74 (atom -> num .) + yacc.py:2687: cpar reduce using rule 74 (atom -> num .) + yacc.py:2687: of reduce using rule 74 (atom -> num .) + yacc.py:2687: then reduce using rule 74 (atom -> num .) + yacc.py:2687: loop reduce using rule 74 (atom -> num .) + yacc.py:2687: comma reduce using rule 74 (atom -> num .) + yacc.py:2687: in reduce using rule 74 (atom -> num .) + yacc.py:2687: else reduce using rule 74 (atom -> num .) + yacc.py:2687: pool reduce using rule 74 (atom -> num .) + yacc.py:2687: ccur reduce using rule 74 (atom -> num .) + yacc.py:2687: fi reduce using rule 74 (atom -> num .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 89 + yacc.py:2563: + yacc.py:2565: (76) atom -> new . type + yacc.py:2566: + yacc.py:2687: type shift and go to state 134 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 90 + yacc.py:2563: + yacc.py:2565: (77) atom -> ocur . block ccur + yacc.py:2565: (79) atom -> ocur . error ccur + yacc.py:2565: (80) atom -> ocur . block error + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 136 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: block shift and go to state 135 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 91 + yacc.py:2563: + yacc.py:2565: (81) atom -> true . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 81 (atom -> true .) + yacc.py:2687: dot reduce using rule 81 (atom -> true .) + yacc.py:2687: star reduce using rule 81 (atom -> true .) + yacc.py:2687: div reduce using rule 81 (atom -> true .) + yacc.py:2687: plus reduce using rule 81 (atom -> true .) + yacc.py:2687: minus reduce using rule 81 (atom -> true .) + yacc.py:2687: less reduce using rule 81 (atom -> true .) + yacc.py:2687: lesseq reduce using rule 81 (atom -> true .) + yacc.py:2687: equal reduce using rule 81 (atom -> true .) + yacc.py:2687: semi reduce using rule 81 (atom -> true .) + yacc.py:2687: cpar reduce using rule 81 (atom -> true .) + yacc.py:2687: of reduce using rule 81 (atom -> true .) + yacc.py:2687: then reduce using rule 81 (atom -> true .) + yacc.py:2687: loop reduce using rule 81 (atom -> true .) + yacc.py:2687: comma reduce using rule 81 (atom -> true .) + yacc.py:2687: in reduce using rule 81 (atom -> true .) + yacc.py:2687: else reduce using rule 81 (atom -> true .) + yacc.py:2687: pool reduce using rule 81 (atom -> true .) + yacc.py:2687: ccur reduce using rule 81 (atom -> true .) + yacc.py:2687: fi reduce using rule 81 (atom -> true .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 92 + yacc.py:2563: + yacc.py:2565: (82) atom -> false . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 82 (atom -> false .) + yacc.py:2687: dot reduce using rule 82 (atom -> false .) + yacc.py:2687: star reduce using rule 82 (atom -> false .) + yacc.py:2687: div reduce using rule 82 (atom -> false .) + yacc.py:2687: plus reduce using rule 82 (atom -> false .) + yacc.py:2687: minus reduce using rule 82 (atom -> false .) + yacc.py:2687: less reduce using rule 82 (atom -> false .) + yacc.py:2687: lesseq reduce using rule 82 (atom -> false .) + yacc.py:2687: equal reduce using rule 82 (atom -> false .) + yacc.py:2687: semi reduce using rule 82 (atom -> false .) + yacc.py:2687: cpar reduce using rule 82 (atom -> false .) + yacc.py:2687: of reduce using rule 82 (atom -> false .) + yacc.py:2687: then reduce using rule 82 (atom -> false .) + yacc.py:2687: loop reduce using rule 82 (atom -> false .) + yacc.py:2687: comma reduce using rule 82 (atom -> false .) + yacc.py:2687: in reduce using rule 82 (atom -> false .) + yacc.py:2687: else reduce using rule 82 (atom -> false .) + yacc.py:2687: pool reduce using rule 82 (atom -> false .) + yacc.py:2687: ccur reduce using rule 82 (atom -> false .) + yacc.py:2687: fi reduce using rule 82 (atom -> false .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 93 + yacc.py:2563: + yacc.py:2565: (83) atom -> string . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 83 (atom -> string .) + yacc.py:2687: dot reduce using rule 83 (atom -> string .) + yacc.py:2687: star reduce using rule 83 (atom -> string .) + yacc.py:2687: div reduce using rule 83 (atom -> string .) + yacc.py:2687: plus reduce using rule 83 (atom -> string .) + yacc.py:2687: minus reduce using rule 83 (atom -> string .) + yacc.py:2687: less reduce using rule 83 (atom -> string .) + yacc.py:2687: lesseq reduce using rule 83 (atom -> string .) + yacc.py:2687: equal reduce using rule 83 (atom -> string .) + yacc.py:2687: semi reduce using rule 83 (atom -> string .) + yacc.py:2687: cpar reduce using rule 83 (atom -> string .) + yacc.py:2687: of reduce using rule 83 (atom -> string .) + yacc.py:2687: then reduce using rule 83 (atom -> string .) + yacc.py:2687: loop reduce using rule 83 (atom -> string .) + yacc.py:2687: comma reduce using rule 83 (atom -> string .) + yacc.py:2687: in reduce using rule 83 (atom -> string .) + yacc.py:2687: else reduce using rule 83 (atom -> string .) + yacc.py:2687: pool reduce using rule 83 (atom -> string .) + yacc.py:2687: ccur reduce using rule 83 (atom -> string .) + yacc.py:2687: fi reduce using rule 83 (atom -> string .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 94 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar formals cpar colon . type ocur expr ccur + yacc.py:2566: + yacc.py:2687: type shift and go to state 137 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 95 + yacc.py:2563: + yacc.py:2565: (33) param_list -> param comma param_list . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 33 (param_list -> param comma param_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 96 + yacc.py:2563: + yacc.py:2565: (35) param -> id colon type . + yacc.py:2566: + yacc.py:2687: comma reduce using rule 35 (param -> id colon type .) + yacc.py:2687: cpar reduce using rule 35 (param -> id colon type .) + yacc.py:2687: larrow reduce using rule 35 (param -> id colon type .) + yacc.py:2687: in reduce using rule 35 (param -> id colon type .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 97 + yacc.py:2563: + yacc.py:2565: (19) def_attr -> id colon type larrow expr . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 19 (def_attr -> id colon type larrow expr .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 98 + yacc.py:2563: + yacc.py:2565: (24) def_attr -> id colon type larrow error . + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: semi reduce using rule 24 (def_attr -> id colon type larrow error .) + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: block shift and go to state 109 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 99 + yacc.py:2563: + yacc.py:2565: (23) def_attr -> id colon error larrow expr . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 23 (def_attr -> id colon error larrow expr .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 100 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar formals cpar colon . type ocur expr ccur + yacc.py:2565: (28) def_func -> id opar formals cpar colon . error ocur expr ccur + yacc.py:2565: (29) def_func -> id opar formals cpar colon . type ocur error ccur + yacc.py:2566: + yacc.py:2687: type shift and go to state 138 + yacc.py:2687: error shift and go to state 139 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 101 + yacc.py:2563: + yacc.py:2565: (27) def_func -> id opar error cpar colon . type ocur expr ccur + yacc.py:2566: + yacc.py:2687: type shift and go to state 140 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 102 + yacc.py:2563: + yacc.py:2565: (7) def_class -> class type inherits type ocur feature_list ccur semi . + yacc.py:2566: + yacc.py:2687: error reduce using rule 7 (def_class -> class type inherits type ocur feature_list ccur semi .) + yacc.py:2687: class reduce using rule 7 (def_class -> class type inherits type ocur feature_list ccur semi .) + yacc.py:2687: $end reduce using rule 7 (def_class -> class type inherits type ocur feature_list ccur semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 103 + yacc.py:2563: + yacc.py:2565: (13) def_class -> class type inherits type ocur feature_list ccur error . + yacc.py:2566: + yacc.py:2687: error reduce using rule 13 (def_class -> class type inherits type ocur feature_list ccur error .) + yacc.py:2687: class reduce using rule 13 (def_class -> class type inherits type ocur feature_list ccur error .) + yacc.py:2687: $end reduce using rule 13 (def_class -> class type inherits type ocur feature_list ccur error .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 104 + yacc.py:2563: + yacc.py:2565: (12) def_class -> class type inherits error ocur feature_list ccur semi . + yacc.py:2566: + yacc.py:2687: error reduce using rule 12 (def_class -> class type inherits error ocur feature_list ccur semi .) + yacc.py:2687: class reduce using rule 12 (def_class -> class type inherits error ocur feature_list ccur semi .) + yacc.py:2687: $end reduce using rule 12 (def_class -> class type inherits error ocur feature_list ccur semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 105 + yacc.py:2563: + yacc.py:2565: (11) def_class -> class error inherits error ocur feature_list ccur semi . + yacc.py:2566: + yacc.py:2687: error reduce using rule 11 (def_class -> class error inherits error ocur feature_list ccur semi .) + yacc.py:2687: class reduce using rule 11 (def_class -> class error inherits error ocur feature_list ccur semi .) + yacc.py:2687: $end reduce using rule 11 (def_class -> class error inherits error ocur feature_list ccur semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 106 + yacc.py:2563: + yacc.py:2565: (10) def_class -> class error inherits type ocur feature_list ccur semi . + yacc.py:2566: + yacc.py:2687: error reduce using rule 10 (def_class -> class error inherits type ocur feature_list ccur semi .) + yacc.py:2687: class reduce using rule 10 (def_class -> class error inherits type ocur feature_list ccur semi .) + yacc.py:2687: $end reduce using rule 10 (def_class -> class error inherits type ocur feature_list ccur semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 107 + yacc.py:2563: + yacc.py:2565: (86) block -> error . block + yacc.py:2565: (87) block -> error . semi + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: semi shift and go to state 142 + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: block shift and go to state 141 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 108 + yacc.py:2563: + yacc.py:2565: (61) base_call -> error arroba . type dot func_call + yacc.py:2566: + yacc.py:2687: type shift and go to state 143 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 109 + yacc.py:2563: + yacc.py:2565: (78) atom -> error block . ccur + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 144 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 110 + yacc.py:2563: + yacc.py:2565: (90) func_call -> error opar . args cpar + yacc.py:2565: (64) factor -> opar . expr cpar + yacc.py:2565: (91) args -> . arg_list + yacc.py:2565: (92) args -> . arg_list_empty + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (93) arg_list -> . expr + yacc.py:2565: (94) arg_list -> . expr comma arg_list + yacc.py:2565: (95) arg_list -> . error arg_list + yacc.py:2565: (96) arg_list_empty -> . epsilon + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 145 + yacc.py:2687: cpar reduce using rule 2 (epsilon -> .) + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: args shift and go to state 146 + yacc.py:2714: expr shift and go to state 147 + yacc.py:2714: arg_list shift and go to state 148 + yacc.py:2714: arg_list_empty shift and go to state 149 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: epsilon shift and go to state 150 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 111 + yacc.py:2563: + yacc.py:2565: (84) block -> expr . semi + yacc.py:2565: (85) block -> expr . semi block + yacc.py:2566: + yacc.py:2687: semi shift and go to state 151 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 112 + yacc.py:2563: + yacc.py:2565: (45) expr -> id larrow . expr + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 152 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 113 + yacc.py:2563: + yacc.py:2565: (88) func_call -> id opar . args cpar + yacc.py:2565: (89) func_call -> id opar . error cpar + yacc.py:2565: (91) args -> . arg_list + yacc.py:2565: (92) args -> . arg_list_empty + yacc.py:2565: (93) arg_list -> . expr + yacc.py:2565: (94) arg_list -> . expr comma arg_list + yacc.py:2565: (95) arg_list -> . error arg_list + yacc.py:2565: (96) arg_list_empty -> . epsilon + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 154 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: cpar reduce using rule 2 (epsilon -> .) + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: args shift and go to state 153 + yacc.py:2714: arg_list shift and go to state 148 + yacc.py:2714: arg_list_empty shift and go to state 149 + yacc.py:2714: expr shift and go to state 155 + yacc.py:2714: epsilon shift and go to state 150 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 114 + yacc.py:2563: + yacc.py:2565: (47) comp -> comp less . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: op shift and go to state 156 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 115 + yacc.py:2563: + yacc.py:2565: (48) comp -> comp lesseq . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: op shift and go to state 157 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 116 + yacc.py:2563: + yacc.py:2565: (49) comp -> comp equal . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: op shift and go to state 158 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 117 + yacc.py:2563: + yacc.py:2565: (51) op -> op plus . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: term shift and go to state 159 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 118 + yacc.py:2563: + yacc.py:2565: (52) op -> op minus . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: term shift and go to state 160 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 119 + yacc.py:2563: + yacc.py:2565: (54) term -> term star . base_call + yacc.py:2565: (57) term -> term star . error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 162 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: base_call shift and go to state 161 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 120 + yacc.py:2563: + yacc.py:2565: (55) term -> term div . base_call + yacc.py:2565: (58) term -> term div . error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 164 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: id shift and go to state 126 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: base_call shift and go to state 163 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 121 + yacc.py:2563: + yacc.py:2565: (59) base_call -> factor arroba . type dot func_call + yacc.py:2565: (62) base_call -> factor arroba . error dot func_call + yacc.py:2566: + yacc.py:2687: type shift and go to state 165 + yacc.py:2687: error shift and go to state 166 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 122 + yacc.py:2563: + yacc.py:2565: (65) factor -> factor dot . func_call + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 168 + yacc.py:2687: error shift and go to state 169 + yacc.py:2689: + yacc.py:2714: func_call shift and go to state 167 + yacc.py:2561: + yacc.py:2562:state 123 + yacc.py:2563: + yacc.py:2565: (64) factor -> opar expr . cpar + yacc.py:2566: + yacc.py:2687: cpar shift and go to state 170 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 124 + yacc.py:2563: + yacc.py:2565: (66) factor -> not expr . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 66 (factor -> not expr .) + yacc.py:2687: dot reduce using rule 66 (factor -> not expr .) + yacc.py:2687: star reduce using rule 66 (factor -> not expr .) + yacc.py:2687: div reduce using rule 66 (factor -> not expr .) + yacc.py:2687: plus reduce using rule 66 (factor -> not expr .) + yacc.py:2687: minus reduce using rule 66 (factor -> not expr .) + yacc.py:2687: less reduce using rule 66 (factor -> not expr .) + yacc.py:2687: lesseq reduce using rule 66 (factor -> not expr .) + yacc.py:2687: equal reduce using rule 66 (factor -> not expr .) + yacc.py:2687: semi reduce using rule 66 (factor -> not expr .) + yacc.py:2687: cpar reduce using rule 66 (factor -> not expr .) + yacc.py:2687: of reduce using rule 66 (factor -> not expr .) + yacc.py:2687: then reduce using rule 66 (factor -> not expr .) + yacc.py:2687: loop reduce using rule 66 (factor -> not expr .) + yacc.py:2687: comma reduce using rule 66 (factor -> not expr .) + yacc.py:2687: in reduce using rule 66 (factor -> not expr .) + yacc.py:2687: else reduce using rule 66 (factor -> not expr .) + yacc.py:2687: pool reduce using rule 66 (factor -> not expr .) + yacc.py:2687: ccur reduce using rule 66 (factor -> not expr .) + yacc.py:2687: fi reduce using rule 66 (factor -> not expr .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 125 + yacc.py:2563: + yacc.py:2565: (68) factor -> isvoid base_call . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: dot reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: star reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: div reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: plus reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: minus reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: less reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: lesseq reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: equal reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: semi reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: cpar reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: of reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: then reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: loop reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: comma reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: in reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: else reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: pool reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: ccur reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2687: fi reduce using rule 68 (factor -> isvoid base_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 126 + yacc.py:2563: + yacc.py:2565: (75) atom -> id . + yacc.py:2565: (88) func_call -> id . opar args cpar + yacc.py:2565: (89) func_call -> id . opar error cpar + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 75 (atom -> id .) + yacc.py:2687: dot reduce using rule 75 (atom -> id .) + yacc.py:2687: star reduce using rule 75 (atom -> id .) + yacc.py:2687: div reduce using rule 75 (atom -> id .) + yacc.py:2687: plus reduce using rule 75 (atom -> id .) + yacc.py:2687: minus reduce using rule 75 (atom -> id .) + yacc.py:2687: less reduce using rule 75 (atom -> id .) + yacc.py:2687: lesseq reduce using rule 75 (atom -> id .) + yacc.py:2687: equal reduce using rule 75 (atom -> id .) + yacc.py:2687: semi reduce using rule 75 (atom -> id .) + yacc.py:2687: cpar reduce using rule 75 (atom -> id .) + yacc.py:2687: of reduce using rule 75 (atom -> id .) + yacc.py:2687: then reduce using rule 75 (atom -> id .) + yacc.py:2687: loop reduce using rule 75 (atom -> id .) + yacc.py:2687: comma reduce using rule 75 (atom -> id .) + yacc.py:2687: in reduce using rule 75 (atom -> id .) + yacc.py:2687: else reduce using rule 75 (atom -> id .) + yacc.py:2687: pool reduce using rule 75 (atom -> id .) + yacc.py:2687: ccur reduce using rule 75 (atom -> id .) + yacc.py:2687: fi reduce using rule 75 (atom -> id .) + yacc.py:2687: opar shift and go to state 113 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 127 + yacc.py:2563: + yacc.py:2565: (69) factor -> nox base_call . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: dot reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: star reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: div reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: plus reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: minus reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: less reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: lesseq reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: equal reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: semi reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: cpar reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: of reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: then reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: loop reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: comma reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: in reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: else reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: pool reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: ccur reduce using rule 69 (factor -> nox base_call .) + yacc.py:2687: fi reduce using rule 69 (factor -> nox base_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 128 + yacc.py:2563: + yacc.py:2565: (70) factor -> let let_list . in expr + yacc.py:2566: + yacc.py:2687: in shift and go to state 171 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 129 + yacc.py:2563: + yacc.py:2565: (36) let_list -> let_assign . + yacc.py:2565: (37) let_list -> let_assign . comma let_list + yacc.py:2566: + yacc.py:2687: in reduce using rule 36 (let_list -> let_assign .) + yacc.py:2687: comma shift and go to state 172 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 130 + yacc.py:2563: + yacc.py:2565: (38) let_assign -> param . larrow expr + yacc.py:2565: (39) let_assign -> param . + yacc.py:2566: + yacc.py:2687: larrow shift and go to state 173 + yacc.py:2687: comma reduce using rule 39 (let_assign -> param .) + yacc.py:2687: in reduce using rule 39 (let_assign -> param .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 131 + yacc.py:2563: + yacc.py:2565: (71) factor -> case expr . of cases_list esac + yacc.py:2566: + yacc.py:2687: of shift and go to state 174 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 132 + yacc.py:2563: + yacc.py:2565: (72) factor -> if expr . then expr else expr fi + yacc.py:2566: + yacc.py:2687: then shift and go to state 175 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 133 + yacc.py:2563: + yacc.py:2565: (73) factor -> while expr . loop expr pool + yacc.py:2566: + yacc.py:2687: loop shift and go to state 176 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 134 + yacc.py:2563: + yacc.py:2565: (76) atom -> new type . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 76 (atom -> new type .) + yacc.py:2687: dot reduce using rule 76 (atom -> new type .) + yacc.py:2687: star reduce using rule 76 (atom -> new type .) + yacc.py:2687: div reduce using rule 76 (atom -> new type .) + yacc.py:2687: plus reduce using rule 76 (atom -> new type .) + yacc.py:2687: minus reduce using rule 76 (atom -> new type .) + yacc.py:2687: less reduce using rule 76 (atom -> new type .) + yacc.py:2687: lesseq reduce using rule 76 (atom -> new type .) + yacc.py:2687: equal reduce using rule 76 (atom -> new type .) + yacc.py:2687: semi reduce using rule 76 (atom -> new type .) + yacc.py:2687: cpar reduce using rule 76 (atom -> new type .) + yacc.py:2687: of reduce using rule 76 (atom -> new type .) + yacc.py:2687: then reduce using rule 76 (atom -> new type .) + yacc.py:2687: loop reduce using rule 76 (atom -> new type .) + yacc.py:2687: comma reduce using rule 76 (atom -> new type .) + yacc.py:2687: in reduce using rule 76 (atom -> new type .) + yacc.py:2687: else reduce using rule 76 (atom -> new type .) + yacc.py:2687: pool reduce using rule 76 (atom -> new type .) + yacc.py:2687: ccur reduce using rule 76 (atom -> new type .) + yacc.py:2687: fi reduce using rule 76 (atom -> new type .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 135 + yacc.py:2563: + yacc.py:2565: (77) atom -> ocur block . ccur + yacc.py:2565: (80) atom -> ocur block . error + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 177 + yacc.py:2687: error shift and go to state 178 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 136 + yacc.py:2563: + yacc.py:2565: (79) atom -> ocur error . ccur + yacc.py:2565: (86) block -> error . block + yacc.py:2565: (87) block -> error . semi + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 179 + yacc.py:2687: semi shift and go to state 142 + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: block shift and go to state 141 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 137 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar formals cpar colon type . ocur expr ccur + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 180 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 138 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar formals cpar colon type . ocur expr ccur + yacc.py:2565: (29) def_func -> id opar formals cpar colon type . ocur error ccur + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 181 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 139 + yacc.py:2563: + yacc.py:2565: (28) def_func -> id opar formals cpar colon error . ocur expr ccur + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 182 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 140 + yacc.py:2563: + yacc.py:2565: (27) def_func -> id opar error cpar colon type . ocur expr ccur + yacc.py:2566: + yacc.py:2687: ocur shift and go to state 183 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 141 + yacc.py:2563: + yacc.py:2565: (86) block -> error block . + yacc.py:2565: (78) atom -> error block . ccur + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for ccur resolved as shift + yacc.py:2687: error reduce using rule 86 (block -> error block .) + yacc.py:2687: ccur shift and go to state 144 + yacc.py:2689: + yacc.py:2696: ! ccur [ reduce using rule 86 (block -> error block .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 142 + yacc.py:2563: + yacc.py:2565: (87) block -> error semi . + yacc.py:2566: + yacc.py:2687: ccur reduce using rule 87 (block -> error semi .) + yacc.py:2687: error reduce using rule 87 (block -> error semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 143 + yacc.py:2563: + yacc.py:2565: (61) base_call -> error arroba type . dot func_call + yacc.py:2566: + yacc.py:2687: dot shift and go to state 184 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 144 + yacc.py:2563: + yacc.py:2565: (78) atom -> error block ccur . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: dot reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: star reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: div reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: plus reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: minus reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: less reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: lesseq reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: equal reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: semi reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: cpar reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: of reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: then reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: loop reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: comma reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: in reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: else reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: pool reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: ccur reduce using rule 78 (atom -> error block ccur .) + yacc.py:2687: fi reduce using rule 78 (atom -> error block ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 145 + yacc.py:2563: + yacc.py:2565: (95) arg_list -> error . arg_list + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (93) arg_list -> . expr + yacc.py:2565: (94) arg_list -> . expr comma arg_list + yacc.py:2565: (95) arg_list -> . error arg_list + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 185 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: arg_list shift and go to state 186 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: block shift and go to state 109 + yacc.py:2714: expr shift and go to state 187 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 146 + yacc.py:2563: + yacc.py:2565: (90) func_call -> error opar args . cpar + yacc.py:2566: + yacc.py:2687: cpar shift and go to state 188 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 147 + yacc.py:2563: + yacc.py:2565: (64) factor -> opar expr . cpar + yacc.py:2565: (93) arg_list -> expr . + yacc.py:2565: (94) arg_list -> expr . comma arg_list + yacc.py:2566: + yacc.py:2609: ! shift/reduce conflict for cpar resolved as shift + yacc.py:2687: cpar shift and go to state 170 + yacc.py:2687: comma shift and go to state 189 + yacc.py:2689: + yacc.py:2696: ! cpar [ reduce using rule 93 (arg_list -> expr .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 148 + yacc.py:2563: + yacc.py:2565: (91) args -> arg_list . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 91 (args -> arg_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 149 + yacc.py:2563: + yacc.py:2565: (92) args -> arg_list_empty . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 92 (args -> arg_list_empty .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 150 + yacc.py:2563: + yacc.py:2565: (96) arg_list_empty -> epsilon . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 96 (arg_list_empty -> epsilon .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 151 + yacc.py:2563: + yacc.py:2565: (84) block -> expr semi . + yacc.py:2565: (85) block -> expr semi . block + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for error resolved as shift + yacc.py:2687: ccur reduce using rule 84 (block -> expr semi .) + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2696: ! error [ reduce using rule 84 (block -> expr semi .) ] + yacc.py:2700: + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: block shift and go to state 190 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 152 + yacc.py:2563: + yacc.py:2565: (45) expr -> id larrow expr . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: cpar reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: arroba reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: dot reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: star reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: div reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: plus reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: minus reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: less reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: lesseq reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: equal reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: of reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: then reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: loop reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: comma reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: in reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: else reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: pool reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: ccur reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2687: fi reduce using rule 45 (expr -> id larrow expr .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 153 + yacc.py:2563: + yacc.py:2565: (88) func_call -> id opar args . cpar + yacc.py:2566: + yacc.py:2687: cpar shift and go to state 191 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 154 + yacc.py:2563: + yacc.py:2565: (89) func_call -> id opar error . cpar + yacc.py:2565: (95) arg_list -> error . arg_list + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (93) arg_list -> . expr + yacc.py:2565: (94) arg_list -> . expr comma arg_list + yacc.py:2565: (95) arg_list -> . error arg_list + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: cpar shift and go to state 192 + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 185 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: arg_list shift and go to state 186 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: block shift and go to state 109 + yacc.py:2714: expr shift and go to state 187 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 155 + yacc.py:2563: + yacc.py:2565: (93) arg_list -> expr . + yacc.py:2565: (94) arg_list -> expr . comma arg_list + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 93 (arg_list -> expr .) + yacc.py:2687: comma shift and go to state 189 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 156 + yacc.py:2563: + yacc.py:2565: (47) comp -> comp less op . + yacc.py:2565: (51) op -> op . plus term + yacc.py:2565: (52) op -> op . minus term + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for plus resolved as shift + yacc.py:2666: ! shift/reduce conflict for minus resolved as shift + yacc.py:2687: less reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: lesseq reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: equal reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: semi reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: cpar reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: arroba reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: dot reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: star reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: div reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: of reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: then reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: loop reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: comma reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: in reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: else reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: pool reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: ccur reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: fi reduce using rule 47 (comp -> comp less op .) + yacc.py:2687: plus shift and go to state 117 + yacc.py:2687: minus shift and go to state 118 + yacc.py:2689: + yacc.py:2696: ! plus [ reduce using rule 47 (comp -> comp less op .) ] + yacc.py:2696: ! minus [ reduce using rule 47 (comp -> comp less op .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 157 + yacc.py:2563: + yacc.py:2565: (48) comp -> comp lesseq op . + yacc.py:2565: (51) op -> op . plus term + yacc.py:2565: (52) op -> op . minus term + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for plus resolved as shift + yacc.py:2666: ! shift/reduce conflict for minus resolved as shift + yacc.py:2687: less reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: lesseq reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: equal reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: semi reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: cpar reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: arroba reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: dot reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: star reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: div reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: of reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: then reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: loop reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: comma reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: in reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: else reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: pool reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: ccur reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: fi reduce using rule 48 (comp -> comp lesseq op .) + yacc.py:2687: plus shift and go to state 117 + yacc.py:2687: minus shift and go to state 118 + yacc.py:2689: + yacc.py:2696: ! plus [ reduce using rule 48 (comp -> comp lesseq op .) ] + yacc.py:2696: ! minus [ reduce using rule 48 (comp -> comp lesseq op .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 158 + yacc.py:2563: + yacc.py:2565: (49) comp -> comp equal op . + yacc.py:2565: (51) op -> op . plus term + yacc.py:2565: (52) op -> op . minus term + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for plus resolved as shift + yacc.py:2666: ! shift/reduce conflict for minus resolved as shift + yacc.py:2687: less reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: lesseq reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: equal reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: semi reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: cpar reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: arroba reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: dot reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: star reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: div reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: of reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: then reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: loop reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: comma reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: in reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: else reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: pool reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: ccur reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: fi reduce using rule 49 (comp -> comp equal op .) + yacc.py:2687: plus shift and go to state 117 + yacc.py:2687: minus shift and go to state 118 + yacc.py:2689: + yacc.py:2696: ! plus [ reduce using rule 49 (comp -> comp equal op .) ] + yacc.py:2696: ! minus [ reduce using rule 49 (comp -> comp equal op .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 159 + yacc.py:2563: + yacc.py:2565: (51) op -> op plus term . + yacc.py:2565: (54) term -> term . star base_call + yacc.py:2565: (55) term -> term . div base_call + yacc.py:2565: (57) term -> term . star error + yacc.py:2565: (58) term -> term . div error + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for star resolved as shift + yacc.py:2666: ! shift/reduce conflict for div resolved as shift + yacc.py:2687: plus reduce using rule 51 (op -> op plus term .) + yacc.py:2687: minus reduce using rule 51 (op -> op plus term .) + yacc.py:2687: less reduce using rule 51 (op -> op plus term .) + yacc.py:2687: lesseq reduce using rule 51 (op -> op plus term .) + yacc.py:2687: equal reduce using rule 51 (op -> op plus term .) + yacc.py:2687: semi reduce using rule 51 (op -> op plus term .) + yacc.py:2687: cpar reduce using rule 51 (op -> op plus term .) + yacc.py:2687: arroba reduce using rule 51 (op -> op plus term .) + yacc.py:2687: dot reduce using rule 51 (op -> op plus term .) + yacc.py:2687: of reduce using rule 51 (op -> op plus term .) + yacc.py:2687: then reduce using rule 51 (op -> op plus term .) + yacc.py:2687: loop reduce using rule 51 (op -> op plus term .) + yacc.py:2687: comma reduce using rule 51 (op -> op plus term .) + yacc.py:2687: in reduce using rule 51 (op -> op plus term .) + yacc.py:2687: else reduce using rule 51 (op -> op plus term .) + yacc.py:2687: pool reduce using rule 51 (op -> op plus term .) + yacc.py:2687: ccur reduce using rule 51 (op -> op plus term .) + yacc.py:2687: fi reduce using rule 51 (op -> op plus term .) + yacc.py:2687: star shift and go to state 119 + yacc.py:2687: div shift and go to state 120 + yacc.py:2689: + yacc.py:2696: ! star [ reduce using rule 51 (op -> op plus term .) ] + yacc.py:2696: ! div [ reduce using rule 51 (op -> op plus term .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 160 + yacc.py:2563: + yacc.py:2565: (52) op -> op minus term . + yacc.py:2565: (54) term -> term . star base_call + yacc.py:2565: (55) term -> term . div base_call + yacc.py:2565: (57) term -> term . star error + yacc.py:2565: (58) term -> term . div error + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for star resolved as shift + yacc.py:2666: ! shift/reduce conflict for div resolved as shift + yacc.py:2687: plus reduce using rule 52 (op -> op minus term .) + yacc.py:2687: minus reduce using rule 52 (op -> op minus term .) + yacc.py:2687: less reduce using rule 52 (op -> op minus term .) + yacc.py:2687: lesseq reduce using rule 52 (op -> op minus term .) + yacc.py:2687: equal reduce using rule 52 (op -> op minus term .) + yacc.py:2687: semi reduce using rule 52 (op -> op minus term .) + yacc.py:2687: cpar reduce using rule 52 (op -> op minus term .) + yacc.py:2687: arroba reduce using rule 52 (op -> op minus term .) + yacc.py:2687: dot reduce using rule 52 (op -> op minus term .) + yacc.py:2687: of reduce using rule 52 (op -> op minus term .) + yacc.py:2687: then reduce using rule 52 (op -> op minus term .) + yacc.py:2687: loop reduce using rule 52 (op -> op minus term .) + yacc.py:2687: comma reduce using rule 52 (op -> op minus term .) + yacc.py:2687: in reduce using rule 52 (op -> op minus term .) + yacc.py:2687: else reduce using rule 52 (op -> op minus term .) + yacc.py:2687: pool reduce using rule 52 (op -> op minus term .) + yacc.py:2687: ccur reduce using rule 52 (op -> op minus term .) + yacc.py:2687: fi reduce using rule 52 (op -> op minus term .) + yacc.py:2687: star shift and go to state 119 + yacc.py:2687: div shift and go to state 120 + yacc.py:2689: + yacc.py:2696: ! star [ reduce using rule 52 (op -> op minus term .) ] + yacc.py:2696: ! div [ reduce using rule 52 (op -> op minus term .) ] + yacc.py:2700: + yacc.py:2561: + yacc.py:2562:state 161 + yacc.py:2563: + yacc.py:2565: (54) term -> term star base_call . + yacc.py:2566: + yacc.py:2687: star reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: div reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: plus reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: minus reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: less reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: lesseq reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: equal reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: semi reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: cpar reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: arroba reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: dot reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: of reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: then reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: loop reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: comma reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: in reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: else reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: pool reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: ccur reduce using rule 54 (term -> term star base_call .) + yacc.py:2687: fi reduce using rule 54 (term -> term star base_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 162 + yacc.py:2563: + yacc.py:2565: (57) term -> term star error . + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for arroba resolved as shift + yacc.py:2687: star reduce using rule 57 (term -> term star error .) + yacc.py:2687: div reduce using rule 57 (term -> term star error .) + yacc.py:2687: plus reduce using rule 57 (term -> term star error .) + yacc.py:2687: minus reduce using rule 57 (term -> term star error .) + yacc.py:2687: less reduce using rule 57 (term -> term star error .) + yacc.py:2687: lesseq reduce using rule 57 (term -> term star error .) + yacc.py:2687: equal reduce using rule 57 (term -> term star error .) + yacc.py:2687: semi reduce using rule 57 (term -> term star error .) + yacc.py:2687: cpar reduce using rule 57 (term -> term star error .) + yacc.py:2687: dot reduce using rule 57 (term -> term star error .) + yacc.py:2687: of reduce using rule 57 (term -> term star error .) + yacc.py:2687: then reduce using rule 57 (term -> term star error .) + yacc.py:2687: loop reduce using rule 57 (term -> term star error .) + yacc.py:2687: comma reduce using rule 57 (term -> term star error .) + yacc.py:2687: in reduce using rule 57 (term -> term star error .) + yacc.py:2687: else reduce using rule 57 (term -> term star error .) + yacc.py:2687: pool reduce using rule 57 (term -> term star error .) + yacc.py:2687: ccur reduce using rule 57 (term -> term star error .) + yacc.py:2687: fi reduce using rule 57 (term -> term star error .) + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2696: ! arroba [ reduce using rule 57 (term -> term star error .) ] + yacc.py:2700: + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: block shift and go to state 109 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 163 + yacc.py:2563: + yacc.py:2565: (55) term -> term div base_call . + yacc.py:2566: + yacc.py:2687: star reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: div reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: plus reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: minus reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: less reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: lesseq reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: equal reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: semi reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: cpar reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: arroba reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: dot reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: of reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: then reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: loop reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: comma reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: in reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: else reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: pool reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: ccur reduce using rule 55 (term -> term div base_call .) + yacc.py:2687: fi reduce using rule 55 (term -> term div base_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 164 + yacc.py:2563: + yacc.py:2565: (58) term -> term div error . + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2666: ! shift/reduce conflict for arroba resolved as shift + yacc.py:2687: star reduce using rule 58 (term -> term div error .) + yacc.py:2687: div reduce using rule 58 (term -> term div error .) + yacc.py:2687: plus reduce using rule 58 (term -> term div error .) + yacc.py:2687: minus reduce using rule 58 (term -> term div error .) + yacc.py:2687: less reduce using rule 58 (term -> term div error .) + yacc.py:2687: lesseq reduce using rule 58 (term -> term div error .) + yacc.py:2687: equal reduce using rule 58 (term -> term div error .) + yacc.py:2687: semi reduce using rule 58 (term -> term div error .) + yacc.py:2687: cpar reduce using rule 58 (term -> term div error .) + yacc.py:2687: dot reduce using rule 58 (term -> term div error .) + yacc.py:2687: of reduce using rule 58 (term -> term div error .) + yacc.py:2687: then reduce using rule 58 (term -> term div error .) + yacc.py:2687: loop reduce using rule 58 (term -> term div error .) + yacc.py:2687: comma reduce using rule 58 (term -> term div error .) + yacc.py:2687: in reduce using rule 58 (term -> term div error .) + yacc.py:2687: else reduce using rule 58 (term -> term div error .) + yacc.py:2687: pool reduce using rule 58 (term -> term div error .) + yacc.py:2687: ccur reduce using rule 58 (term -> term div error .) + yacc.py:2687: fi reduce using rule 58 (term -> term div error .) + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2696: ! arroba [ reduce using rule 58 (term -> term div error .) ] + yacc.py:2700: + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: block shift and go to state 109 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 165 + yacc.py:2563: + yacc.py:2565: (59) base_call -> factor arroba type . dot func_call + yacc.py:2566: + yacc.py:2687: dot shift and go to state 193 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 166 + yacc.py:2563: + yacc.py:2565: (62) base_call -> factor arroba error . dot func_call + yacc.py:2566: + yacc.py:2687: dot shift and go to state 194 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 167 + yacc.py:2563: + yacc.py:2565: (65) factor -> factor dot func_call . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: dot reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: star reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: div reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: plus reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: minus reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: less reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: lesseq reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: equal reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: semi reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: cpar reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: of reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: then reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: loop reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: comma reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: in reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: else reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: pool reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: ccur reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2687: fi reduce using rule 65 (factor -> factor dot func_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 168 + yacc.py:2563: + yacc.py:2565: (88) func_call -> id . opar args cpar + yacc.py:2565: (89) func_call -> id . opar error cpar + yacc.py:2566: + yacc.py:2687: opar shift and go to state 113 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 169 + yacc.py:2563: + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2566: + yacc.py:2687: opar shift and go to state 195 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 170 + yacc.py:2563: + yacc.py:2565: (64) factor -> opar expr cpar . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: dot reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: star reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: div reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: plus reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: minus reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: less reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: lesseq reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: equal reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: semi reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: cpar reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: of reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: then reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: loop reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: comma reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: in reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: else reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: pool reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: ccur reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2687: fi reduce using rule 64 (factor -> opar expr cpar .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 171 + yacc.py:2563: + yacc.py:2565: (70) factor -> let let_list in . expr + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 196 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 172 + yacc.py:2563: + yacc.py:2565: (37) let_list -> let_assign comma . let_list + yacc.py:2565: (36) let_list -> . let_assign + yacc.py:2565: (37) let_list -> . let_assign comma let_list + yacc.py:2565: (38) let_assign -> . param larrow expr + yacc.py:2565: (39) let_assign -> . param + yacc.py:2565: (35) param -> . id colon type + yacc.py:2566: + yacc.py:2687: id shift and go to state 46 + yacc.py:2689: + yacc.py:2714: let_assign shift and go to state 129 + yacc.py:2714: let_list shift and go to state 197 + yacc.py:2714: param shift and go to state 130 + yacc.py:2561: + yacc.py:2562:state 173 + yacc.py:2563: + yacc.py:2565: (38) let_assign -> param larrow . expr + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 198 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 174 + yacc.py:2563: + yacc.py:2565: (71) factor -> case expr of . cases_list esac + yacc.py:2565: (40) cases_list -> . casep semi + yacc.py:2565: (41) cases_list -> . casep semi cases_list + yacc.py:2565: (42) cases_list -> . error cases_list + yacc.py:2565: (43) cases_list -> . error semi + yacc.py:2565: (44) casep -> . id colon type rarrow expr + yacc.py:2566: + yacc.py:2687: error shift and go to state 201 + yacc.py:2687: id shift and go to state 202 + yacc.py:2689: + yacc.py:2714: cases_list shift and go to state 199 + yacc.py:2714: casep shift and go to state 200 + yacc.py:2561: + yacc.py:2562:state 175 + yacc.py:2563: + yacc.py:2565: (72) factor -> if expr then . expr else expr fi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 203 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 176 + yacc.py:2563: + yacc.py:2565: (73) factor -> while expr loop . expr pool + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 204 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 177 + yacc.py:2563: + yacc.py:2565: (77) atom -> ocur block ccur . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: dot reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: star reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: div reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: plus reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: minus reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: less reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: lesseq reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: equal reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: semi reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: cpar reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: of reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: then reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: loop reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: comma reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: in reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: else reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: pool reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: ccur reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2687: fi reduce using rule 77 (atom -> ocur block ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 178 + yacc.py:2563: + yacc.py:2565: (80) atom -> ocur block error . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: dot reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: star reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: div reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: plus reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: minus reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: less reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: lesseq reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: equal reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: semi reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: cpar reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: of reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: then reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: loop reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: comma reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: in reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: else reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: pool reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: ccur reduce using rule 80 (atom -> ocur block error .) + yacc.py:2687: fi reduce using rule 80 (atom -> ocur block error .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 179 + yacc.py:2563: + yacc.py:2565: (79) atom -> ocur error ccur . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: dot reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: star reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: div reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: plus reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: minus reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: less reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: lesseq reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: equal reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: semi reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: cpar reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: of reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: then reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: loop reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: comma reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: in reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: else reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: pool reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: ccur reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2687: fi reduce using rule 79 (atom -> ocur error ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 180 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar formals cpar colon type ocur . expr ccur + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 205 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 181 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar formals cpar colon type ocur . expr ccur + yacc.py:2565: (29) def_func -> id opar formals cpar colon type ocur . error ccur + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 207 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 206 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 182 + yacc.py:2563: + yacc.py:2565: (28) def_func -> id opar formals cpar colon error ocur . expr ccur + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 208 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 183 + yacc.py:2563: + yacc.py:2565: (27) def_func -> id opar error cpar colon type ocur . expr ccur + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 209 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 184 + yacc.py:2563: + yacc.py:2565: (61) base_call -> error arroba type dot . func_call + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 168 + yacc.py:2687: error shift and go to state 169 + yacc.py:2689: + yacc.py:2714: func_call shift and go to state 210 + yacc.py:2561: + yacc.py:2562:state 185 + yacc.py:2563: + yacc.py:2565: (95) arg_list -> error . arg_list + yacc.py:2565: (86) block -> error . block + yacc.py:2565: (87) block -> error . semi + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (93) arg_list -> . expr + yacc.py:2565: (94) arg_list -> . expr comma arg_list + yacc.py:2565: (95) arg_list -> . error arg_list + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: semi shift and go to state 142 + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 185 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: arg_list shift and go to state 186 + yacc.py:2714: block shift and go to state 141 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: expr shift and go to state 187 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 186 + yacc.py:2563: + yacc.py:2565: (95) arg_list -> error arg_list . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 95 (arg_list -> error arg_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 187 + yacc.py:2563: + yacc.py:2565: (93) arg_list -> expr . + yacc.py:2565: (94) arg_list -> expr . comma arg_list + yacc.py:2565: (84) block -> expr . semi + yacc.py:2565: (85) block -> expr . semi block + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 93 (arg_list -> expr .) + yacc.py:2687: comma shift and go to state 189 + yacc.py:2687: semi shift and go to state 151 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 188 + yacc.py:2563: + yacc.py:2565: (90) func_call -> error opar args cpar . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: dot reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: star reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: div reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: plus reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: minus reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: less reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: lesseq reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: equal reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: semi reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: cpar reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: of reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: then reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: loop reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: comma reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: in reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: else reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: pool reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: ccur reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2687: fi reduce using rule 90 (func_call -> error opar args cpar .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 189 + yacc.py:2563: + yacc.py:2565: (94) arg_list -> expr comma . arg_list + yacc.py:2565: (93) arg_list -> . expr + yacc.py:2565: (94) arg_list -> . expr comma arg_list + yacc.py:2565: (95) arg_list -> . error arg_list + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 145 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 155 + yacc.py:2714: arg_list shift and go to state 211 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 190 + yacc.py:2563: + yacc.py:2565: (85) block -> expr semi block . + yacc.py:2566: + yacc.py:2687: ccur reduce using rule 85 (block -> expr semi block .) + yacc.py:2687: error reduce using rule 85 (block -> expr semi block .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 191 + yacc.py:2563: + yacc.py:2565: (88) func_call -> id opar args cpar . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: dot reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: star reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: div reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: plus reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: minus reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: less reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: lesseq reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: equal reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: semi reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: cpar reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: of reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: then reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: loop reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: comma reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: in reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: else reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: pool reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: ccur reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2687: fi reduce using rule 88 (func_call -> id opar args cpar .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 192 + yacc.py:2563: + yacc.py:2565: (89) func_call -> id opar error cpar . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: dot reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: star reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: div reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: plus reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: minus reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: less reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: lesseq reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: equal reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: semi reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: cpar reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: of reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: then reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: loop reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: comma reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: in reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: else reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: pool reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: ccur reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2687: fi reduce using rule 89 (func_call -> id opar error cpar .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 193 + yacc.py:2563: + yacc.py:2565: (59) base_call -> factor arroba type dot . func_call + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 168 + yacc.py:2687: error shift and go to state 169 + yacc.py:2689: + yacc.py:2714: func_call shift and go to state 212 + yacc.py:2561: + yacc.py:2562:state 194 + yacc.py:2563: + yacc.py:2565: (62) base_call -> factor arroba error dot . func_call + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 168 + yacc.py:2687: error shift and go to state 169 + yacc.py:2689: + yacc.py:2714: func_call shift and go to state 213 + yacc.py:2561: + yacc.py:2562:state 195 + yacc.py:2563: + yacc.py:2565: (90) func_call -> error opar . args cpar + yacc.py:2565: (91) args -> . arg_list + yacc.py:2565: (92) args -> . arg_list_empty + yacc.py:2565: (93) arg_list -> . expr + yacc.py:2565: (94) arg_list -> . expr comma arg_list + yacc.py:2565: (95) arg_list -> . error arg_list + yacc.py:2565: (96) arg_list_empty -> . epsilon + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (2) epsilon -> . + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: error shift and go to state 145 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: cpar reduce using rule 2 (epsilon -> .) + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: args shift and go to state 146 + yacc.py:2714: arg_list shift and go to state 148 + yacc.py:2714: arg_list_empty shift and go to state 149 + yacc.py:2714: expr shift and go to state 155 + yacc.py:2714: epsilon shift and go to state 150 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 196 + yacc.py:2563: + yacc.py:2565: (70) factor -> let let_list in expr . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: dot reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: star reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: div reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: plus reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: minus reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: less reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: lesseq reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: equal reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: semi reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: cpar reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: of reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: then reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: loop reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: comma reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: in reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: else reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: pool reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: ccur reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2687: fi reduce using rule 70 (factor -> let let_list in expr .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 197 + yacc.py:2563: + yacc.py:2565: (37) let_list -> let_assign comma let_list . + yacc.py:2566: + yacc.py:2687: in reduce using rule 37 (let_list -> let_assign comma let_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 198 + yacc.py:2563: + yacc.py:2565: (38) let_assign -> param larrow expr . + yacc.py:2566: + yacc.py:2687: comma reduce using rule 38 (let_assign -> param larrow expr .) + yacc.py:2687: in reduce using rule 38 (let_assign -> param larrow expr .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 199 + yacc.py:2563: + yacc.py:2565: (71) factor -> case expr of cases_list . esac + yacc.py:2566: + yacc.py:2687: esac shift and go to state 214 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 200 + yacc.py:2563: + yacc.py:2565: (40) cases_list -> casep . semi + yacc.py:2565: (41) cases_list -> casep . semi cases_list + yacc.py:2566: + yacc.py:2687: semi shift and go to state 215 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 201 + yacc.py:2563: + yacc.py:2565: (42) cases_list -> error . cases_list + yacc.py:2565: (43) cases_list -> error . semi + yacc.py:2565: (40) cases_list -> . casep semi + yacc.py:2565: (41) cases_list -> . casep semi cases_list + yacc.py:2565: (42) cases_list -> . error cases_list + yacc.py:2565: (43) cases_list -> . error semi + yacc.py:2565: (44) casep -> . id colon type rarrow expr + yacc.py:2566: + yacc.py:2687: semi shift and go to state 217 + yacc.py:2687: error shift and go to state 201 + yacc.py:2687: id shift and go to state 202 + yacc.py:2689: + yacc.py:2714: cases_list shift and go to state 216 + yacc.py:2714: casep shift and go to state 200 + yacc.py:2561: + yacc.py:2562:state 202 + yacc.py:2563: + yacc.py:2565: (44) casep -> id . colon type rarrow expr + yacc.py:2566: + yacc.py:2687: colon shift and go to state 218 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 203 + yacc.py:2563: + yacc.py:2565: (72) factor -> if expr then expr . else expr fi + yacc.py:2566: + yacc.py:2687: else shift and go to state 219 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 204 + yacc.py:2563: + yacc.py:2565: (73) factor -> while expr loop expr . pool + yacc.py:2566: + yacc.py:2687: pool shift and go to state 220 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 205 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar formals cpar colon type ocur expr . ccur + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 221 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 206 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar formals cpar colon type ocur expr . ccur + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 222 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 207 + yacc.py:2563: + yacc.py:2565: (29) def_func -> id opar formals cpar colon type ocur error . ccur + yacc.py:2565: (61) base_call -> error . arroba type dot func_call + yacc.py:2565: (78) atom -> error . block ccur + yacc.py:2565: (90) func_call -> error . opar args cpar + yacc.py:2565: (84) block -> . expr semi + yacc.py:2565: (85) block -> . expr semi block + yacc.py:2565: (86) block -> . error block + yacc.py:2565: (87) block -> . error semi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 223 + yacc.py:2687: arroba shift and go to state 108 + yacc.py:2687: opar shift and go to state 110 + yacc.py:2687: error shift and go to state 107 + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: block shift and go to state 109 + yacc.py:2714: expr shift and go to state 111 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 208 + yacc.py:2563: + yacc.py:2565: (28) def_func -> id opar formals cpar colon error ocur expr . ccur + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 224 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 209 + yacc.py:2563: + yacc.py:2565: (27) def_func -> id opar error cpar colon type ocur expr . ccur + yacc.py:2566: + yacc.py:2687: ccur shift and go to state 225 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 210 + yacc.py:2563: + yacc.py:2565: (61) base_call -> error arroba type dot func_call . + yacc.py:2566: + yacc.py:2687: star reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: div reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: plus reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: minus reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: less reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: lesseq reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: equal reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: semi reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: cpar reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: arroba reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: dot reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: of reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: then reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: loop reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: comma reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: in reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: else reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: pool reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: ccur reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2687: fi reduce using rule 61 (base_call -> error arroba type dot func_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 211 + yacc.py:2563: + yacc.py:2565: (94) arg_list -> expr comma arg_list . + yacc.py:2566: + yacc.py:2687: cpar reduce using rule 94 (arg_list -> expr comma arg_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 212 + yacc.py:2563: + yacc.py:2565: (59) base_call -> factor arroba type dot func_call . + yacc.py:2566: + yacc.py:2687: star reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: div reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: plus reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: minus reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: less reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: lesseq reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: equal reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: semi reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: cpar reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: arroba reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: dot reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: of reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: then reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: loop reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: comma reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: in reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: else reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: pool reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: ccur reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2687: fi reduce using rule 59 (base_call -> factor arroba type dot func_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 213 + yacc.py:2563: + yacc.py:2565: (62) base_call -> factor arroba error dot func_call . + yacc.py:2566: + yacc.py:2687: star reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: div reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: plus reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: minus reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: less reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: lesseq reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: equal reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: semi reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: cpar reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: arroba reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: dot reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: of reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: then reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: loop reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: comma reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: in reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: else reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: pool reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: ccur reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2687: fi reduce using rule 62 (base_call -> factor arroba error dot func_call .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 214 + yacc.py:2563: + yacc.py:2565: (71) factor -> case expr of cases_list esac . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: dot reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: star reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: div reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: plus reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: minus reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: less reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: lesseq reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: equal reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: semi reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: cpar reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: of reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: then reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: loop reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: comma reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: in reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: else reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: pool reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: ccur reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2687: fi reduce using rule 71 (factor -> case expr of cases_list esac .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 215 + yacc.py:2563: + yacc.py:2565: (40) cases_list -> casep semi . + yacc.py:2565: (41) cases_list -> casep semi . cases_list + yacc.py:2565: (40) cases_list -> . casep semi + yacc.py:2565: (41) cases_list -> . casep semi cases_list + yacc.py:2565: (42) cases_list -> . error cases_list + yacc.py:2565: (43) cases_list -> . error semi + yacc.py:2565: (44) casep -> . id colon type rarrow expr + yacc.py:2566: + yacc.py:2687: esac reduce using rule 40 (cases_list -> casep semi .) + yacc.py:2687: error shift and go to state 201 + yacc.py:2687: id shift and go to state 202 + yacc.py:2689: + yacc.py:2714: casep shift and go to state 200 + yacc.py:2714: cases_list shift and go to state 226 + yacc.py:2561: + yacc.py:2562:state 216 + yacc.py:2563: + yacc.py:2565: (42) cases_list -> error cases_list . + yacc.py:2566: + yacc.py:2687: esac reduce using rule 42 (cases_list -> error cases_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 217 + yacc.py:2563: + yacc.py:2565: (43) cases_list -> error semi . + yacc.py:2566: + yacc.py:2687: esac reduce using rule 43 (cases_list -> error semi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 218 + yacc.py:2563: + yacc.py:2565: (44) casep -> id colon . type rarrow expr + yacc.py:2566: + yacc.py:2687: type shift and go to state 227 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 219 + yacc.py:2563: + yacc.py:2565: (72) factor -> if expr then expr else . expr fi + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 228 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 220 + yacc.py:2563: + yacc.py:2565: (73) factor -> while expr loop expr pool . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: dot reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: star reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: div reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: plus reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: minus reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: less reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: lesseq reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: equal reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: semi reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: cpar reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: of reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: then reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: loop reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: comma reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: in reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: else reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: pool reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: ccur reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2687: fi reduce using rule 73 (factor -> while expr loop expr pool .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 221 + yacc.py:2563: + yacc.py:2565: (26) def_func -> error opar formals cpar colon type ocur expr ccur . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 26 (def_func -> error opar formals cpar colon type ocur expr ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 222 + yacc.py:2563: + yacc.py:2565: (25) def_func -> id opar formals cpar colon type ocur expr ccur . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 25 (def_func -> id opar formals cpar colon type ocur expr ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 223 + yacc.py:2563: + yacc.py:2565: (29) def_func -> id opar formals cpar colon type ocur error ccur . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 29 (def_func -> id opar formals cpar colon type ocur error ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 224 + yacc.py:2563: + yacc.py:2565: (28) def_func -> id opar formals cpar colon error ocur expr ccur . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 28 (def_func -> id opar formals cpar colon error ocur expr ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 225 + yacc.py:2563: + yacc.py:2565: (27) def_func -> id opar error cpar colon type ocur expr ccur . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 27 (def_func -> id opar error cpar colon type ocur expr ccur .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 226 + yacc.py:2563: + yacc.py:2565: (41) cases_list -> casep semi cases_list . + yacc.py:2566: + yacc.py:2687: esac reduce using rule 41 (cases_list -> casep semi cases_list .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 227 + yacc.py:2563: + yacc.py:2565: (44) casep -> id colon type . rarrow expr + yacc.py:2566: + yacc.py:2687: rarrow shift and go to state 229 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 228 + yacc.py:2563: + yacc.py:2565: (72) factor -> if expr then expr else expr . fi + yacc.py:2566: + yacc.py:2687: fi shift and go to state 230 + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 229 + yacc.py:2563: + yacc.py:2565: (44) casep -> id colon type rarrow . expr + yacc.py:2565: (45) expr -> . id larrow expr + yacc.py:2565: (46) expr -> . comp + yacc.py:2565: (47) comp -> . comp less op + yacc.py:2565: (48) comp -> . comp lesseq op + yacc.py:2565: (49) comp -> . comp equal op + yacc.py:2565: (50) comp -> . op + yacc.py:2565: (51) op -> . op plus term + yacc.py:2565: (52) op -> . op minus term + yacc.py:2565: (53) op -> . term + yacc.py:2565: (54) term -> . term star base_call + yacc.py:2565: (55) term -> . term div base_call + yacc.py:2565: (56) term -> . base_call + yacc.py:2565: (57) term -> . term star error + yacc.py:2565: (58) term -> . term div error + yacc.py:2565: (59) base_call -> . factor arroba type dot func_call + yacc.py:2565: (60) base_call -> . factor + yacc.py:2565: (61) base_call -> . error arroba type dot func_call + yacc.py:2565: (62) base_call -> . factor arroba error dot func_call + yacc.py:2565: (63) factor -> . atom + yacc.py:2565: (64) factor -> . opar expr cpar + yacc.py:2565: (65) factor -> . factor dot func_call + yacc.py:2565: (66) factor -> . not expr + yacc.py:2565: (67) factor -> . func_call + yacc.py:2565: (68) factor -> . isvoid base_call + yacc.py:2565: (69) factor -> . nox base_call + yacc.py:2565: (70) factor -> . let let_list in expr + yacc.py:2565: (71) factor -> . case expr of cases_list esac + yacc.py:2565: (72) factor -> . if expr then expr else expr fi + yacc.py:2565: (73) factor -> . while expr loop expr pool + yacc.py:2565: (74) atom -> . num + yacc.py:2565: (75) atom -> . id + yacc.py:2565: (76) atom -> . new type + yacc.py:2565: (77) atom -> . ocur block ccur + yacc.py:2565: (78) atom -> . error block ccur + yacc.py:2565: (79) atom -> . ocur error ccur + yacc.py:2565: (80) atom -> . ocur block error + yacc.py:2565: (81) atom -> . true + yacc.py:2565: (82) atom -> . false + yacc.py:2565: (83) atom -> . string + yacc.py:2565: (88) func_call -> . id opar args cpar + yacc.py:2565: (89) func_call -> . id opar error cpar + yacc.py:2565: (90) func_call -> . error opar args cpar + yacc.py:2566: + yacc.py:2687: id shift and go to state 72 + yacc.py:2687: error shift and go to state 70 + yacc.py:2687: opar shift and go to state 80 + yacc.py:2687: not shift and go to state 81 + yacc.py:2687: isvoid shift and go to state 82 + yacc.py:2687: nox shift and go to state 83 + yacc.py:2687: let shift and go to state 84 + yacc.py:2687: case shift and go to state 85 + yacc.py:2687: if shift and go to state 86 + yacc.py:2687: while shift and go to state 87 + yacc.py:2687: num shift and go to state 88 + yacc.py:2687: new shift and go to state 89 + yacc.py:2687: ocur shift and go to state 90 + yacc.py:2687: true shift and go to state 91 + yacc.py:2687: false shift and go to state 92 + yacc.py:2687: string shift and go to state 93 + yacc.py:2689: + yacc.py:2714: expr shift and go to state 231 + yacc.py:2714: comp shift and go to state 73 + yacc.py:2714: op shift and go to state 74 + yacc.py:2714: term shift and go to state 75 + yacc.py:2714: base_call shift and go to state 76 + yacc.py:2714: factor shift and go to state 77 + yacc.py:2714: func_call shift and go to state 78 + yacc.py:2714: atom shift and go to state 79 + yacc.py:2561: + yacc.py:2562:state 230 + yacc.py:2563: + yacc.py:2565: (72) factor -> if expr then expr else expr fi . + yacc.py:2566: + yacc.py:2687: arroba reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: dot reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: star reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: div reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: plus reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: minus reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: less reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: lesseq reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: equal reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: semi reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: cpar reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: of reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: then reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: loop reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: comma reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: in reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: else reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: pool reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: ccur reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2687: fi reduce using rule 72 (factor -> if expr then expr else expr fi .) + yacc.py:2689: + yacc.py:2561: + yacc.py:2562:state 231 + yacc.py:2563: + yacc.py:2565: (44) casep -> id colon type rarrow expr . + yacc.py:2566: + yacc.py:2687: semi reduce using rule 44 (casep -> id colon type rarrow expr .) + yacc.py:2689: + yacc.py:3447:24 shift/reduce conflicts + yacc.py:3457: + yacc.py:3458:Conflicts: + yacc.py:3459: + yacc.py:3462:shift/reduce conflict for less in state 73 resolved as shift + yacc.py:3462:shift/reduce conflict for lesseq in state 73 resolved as shift + yacc.py:3462:shift/reduce conflict for equal in state 73 resolved as shift + yacc.py:3462:shift/reduce conflict for plus in state 74 resolved as shift + yacc.py:3462:shift/reduce conflict for minus in state 74 resolved as shift + yacc.py:3462:shift/reduce conflict for star in state 75 resolved as shift + yacc.py:3462:shift/reduce conflict for div in state 75 resolved as shift + yacc.py:3462:shift/reduce conflict for arroba in state 77 resolved as shift + yacc.py:3462:shift/reduce conflict for dot in state 77 resolved as shift + yacc.py:3462:shift/reduce conflict for ccur in state 141 resolved as shift + yacc.py:3462:shift/reduce conflict for cpar in state 147 resolved as shift + yacc.py:3462:shift/reduce conflict for error in state 151 resolved as shift + yacc.py:3462:shift/reduce conflict for plus in state 156 resolved as shift + yacc.py:3462:shift/reduce conflict for minus in state 156 resolved as shift + yacc.py:3462:shift/reduce conflict for plus in state 157 resolved as shift + yacc.py:3462:shift/reduce conflict for minus in state 157 resolved as shift + yacc.py:3462:shift/reduce conflict for plus in state 158 resolved as shift + yacc.py:3462:shift/reduce conflict for minus in state 158 resolved as shift + yacc.py:3462:shift/reduce conflict for star in state 159 resolved as shift + yacc.py:3462:shift/reduce conflict for div in state 159 resolved as shift + yacc.py:3462:shift/reduce conflict for star in state 160 resolved as shift + yacc.py:3462:shift/reduce conflict for div in state 160 resolved as shift + yacc.py:3462:shift/reduce conflict for arroba in state 162 resolved as shift + yacc.py:3462:shift/reduce conflict for arroba in state 164 resolved as shift + yacc.py: 362:PLY: PARSE DEBUG START + yacc.py: 410: + yacc.py: 411:State : 0 + yacc.py: 435:Stack : . LexToken(class,'class',26,983) + yacc.py: 445:Action : Shift and goto state 5 + yacc.py: 410: + yacc.py: 411:State : 5 + yacc.py: 435:Stack : class . LexToken(type,'List',26,989) + yacc.py: 445:Action : Shift and goto state 8 + yacc.py: 410: + yacc.py: 411:State : 8 + yacc.py: 435:Stack : class type . LexToken(ocur,'{',26,994) + yacc.py: 445:Action : Shift and goto state 10 + yacc.py: 410: + yacc.py: 411:State : 10 + yacc.py: 435:Stack : class type ocur . LexToken(id,'isNil',29,1040) + yacc.py: 445:Action : Shift and goto state 19 + yacc.py: 410: + yacc.py: 411:State : 19 + yacc.py: 435:Stack : class type ocur id . LexToken(opar,'(',29,1045) + yacc.py: 445:Action : Shift and goto state 32 + yacc.py: 410: + yacc.py: 411:State : 32 + yacc.py: 435:Stack : class type ocur id opar . LexToken(cpar,')',29,1046) + yacc.py: 474:Action : Reduce rule [epsilon -> ] with [] and goto state 45 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 45 + yacc.py: 430:Defaulted state 45: Reduce using 34 + yacc.py: 435:Stack : class type ocur id opar epsilon . LexToken(cpar,')',29,1046) + yacc.py: 471:Action : Reduce rule [param_list_empty -> epsilon] with [None] and goto state 43 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 43 + yacc.py: 430:Defaulted state 43: Reduce using 31 + yacc.py: 435:Stack : class type ocur id opar param_list_empty . LexToken(cpar,')',29,1046) + yacc.py: 471:Action : Reduce rule [formals -> param_list_empty] with [[]] and goto state 51 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : class type ocur id opar formals . LexToken(cpar,')',29,1046) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : class type ocur id opar formals cpar . LexToken(colon,':',29,1048) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : class type ocur id opar formals cpar colon . LexToken(type,'Bool',29,1050) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : class type ocur id opar formals cpar colon type . LexToken(ocur,'{',29,1055) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : class type ocur id opar formals cpar colon type ocur . LexToken(true,'true',29,1057) + yacc.py: 445:Action : Shift and goto state 91 + yacc.py: 410: + yacc.py: 411:State : 91 + yacc.py: 435:Stack : class type ocur id opar formals cpar colon type ocur true . LexToken(ccur,'}',29,1062) + yacc.py: 471:Action : Reduce rule [atom -> true] with ['true'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['isNil','(',[],')',':','Bool','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 45 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 45 + yacc.py: 430:Defaulted state 45: Reduce using 34 + yacc.py: 435:Stack : class type ocur def_func semi id opar epsilon . LexToken(cpar,')',35,1254) + yacc.py: 471:Action : Reduce rule [param_list_empty -> epsilon] with [None] and goto state 43 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 43 + yacc.py: 430:Defaulted state 43: Reduce using 31 + yacc.py: 435:Stack : class type ocur def_func semi id opar param_list_empty . LexToken(cpar,')',35,1254) + yacc.py: 471:Action : Reduce rule [formals -> param_list_empty] with [[]] and goto state 51 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals . LexToken(cpar,')',35,1254) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar . LexToken(colon,':',35,1257) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon . LexToken(type,'Int',35,1259) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type . LexToken(ocur,'{',35,1263) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur . LexToken(ocur,'{',35,1265) + yacc.py: 445:Action : Shift and goto state 90 + yacc.py: 410: + yacc.py: 411:State : 90 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur . LexToken(id,'abort',35,1267) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur id . LexToken(opar,'(',35,1272) + yacc.py: 445:Action : Shift and goto state 113 + yacc.py: 410: + yacc.py: 411:State : 113 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur id opar . LexToken(cpar,')',35,1273) + yacc.py: 474:Action : Reduce rule [epsilon -> ] with [] and goto state 150 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 150 + yacc.py: 430:Defaulted state 150: Reduce using 96 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur id opar epsilon . LexToken(cpar,')',35,1273) + yacc.py: 471:Action : Reduce rule [arg_list_empty -> epsilon] with [None] and goto state 149 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 149 + yacc.py: 430:Defaulted state 149: Reduce using 92 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur id opar arg_list_empty . LexToken(cpar,')',35,1273) + yacc.py: 471:Action : Reduce rule [args -> arg_list_empty] with [[]] and goto state 153 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 153 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur id opar args . LexToken(cpar,')',35,1273) + yacc.py: 445:Action : Shift and goto state 191 + yacc.py: 410: + yacc.py: 411:State : 191 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur id opar args cpar . LexToken(semi,';',35,1274) + yacc.py: 471:Action : Reduce rule [func_call -> id opar args cpar] with ['abort','(',[],')'] and goto state 78 + yacc.py: 506:Result : ((LexToken(id,'abort',35,1267), [])) + yacc.py: 410: + yacc.py: 411:State : 78 + yacc.py: 435:Stack : class type ocur def_func semi id opar formals cpar colon type ocur ocur func_call . LexToken(semi,';',35,1274) + yacc.py: 471:Action : Reduce rule [factor -> func_call] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( num] with [0.0] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( expr semi] with [,';'] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 135 + yacc.py: 506:Result : ([ ocur block ccur] with ['{',,'}'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['head','(',[],')',':','Int','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 45 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 45 + yacc.py: 430:Defaulted state 45: Reduce using 34 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar epsilon . LexToken(cpar,')',40,1389) + yacc.py: 471:Action : Reduce rule [param_list_empty -> epsilon] with [None] and goto state 43 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 43 + yacc.py: 430:Defaulted state 43: Reduce using 31 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar param_list_empty . LexToken(cpar,')',40,1389) + yacc.py: 471:Action : Reduce rule [formals -> param_list_empty] with [[]] and goto state 51 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals . LexToken(cpar,')',40,1389) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar . LexToken(colon,':',40,1392) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon . LexToken(type,'List',40,1394) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type . LexToken(ocur,'{',40,1399) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur . LexToken(ocur,'{',40,1401) + yacc.py: 445:Action : Shift and goto state 90 + yacc.py: 410: + yacc.py: 411:State : 90 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur . LexToken(id,'abort',40,1403) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur id . LexToken(opar,'(',40,1408) + yacc.py: 445:Action : Shift and goto state 113 + yacc.py: 410: + yacc.py: 411:State : 113 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur id opar . LexToken(cpar,')',40,1409) + yacc.py: 474:Action : Reduce rule [epsilon -> ] with [] and goto state 150 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 150 + yacc.py: 430:Defaulted state 150: Reduce using 96 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur id opar epsilon . LexToken(cpar,')',40,1409) + yacc.py: 471:Action : Reduce rule [arg_list_empty -> epsilon] with [None] and goto state 149 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 149 + yacc.py: 430:Defaulted state 149: Reduce using 92 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur id opar arg_list_empty . LexToken(cpar,')',40,1409) + yacc.py: 471:Action : Reduce rule [args -> arg_list_empty] with [[]] and goto state 153 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 153 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur id opar args . LexToken(cpar,')',40,1409) + yacc.py: 445:Action : Shift and goto state 191 + yacc.py: 410: + yacc.py: 411:State : 191 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur id opar args cpar . LexToken(semi,';',40,1410) + yacc.py: 471:Action : Reduce rule [func_call -> id opar args cpar] with ['abort','(',[],')'] and goto state 78 + yacc.py: 506:Result : ((LexToken(id,'abort',40,1403), [])) + yacc.py: 410: + yacc.py: 411:State : 78 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi id opar formals cpar colon type ocur ocur func_call . LexToken(semi,';',40,1410) + yacc.py: 471:Action : Reduce rule [factor -> func_call] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( id] with ['self'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( expr semi] with [,';'] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 135 + yacc.py: 506:Result : ([ ocur block ccur] with ['{',,'}'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['tail','(',[],')',':','List','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( id colon type] with ['i',':','Int'] and goto state 44 + yacc.py: 506:Result : ((LexToken(id,'i',49,1777), LexToken(type ...) + yacc.py: 410: + yacc.py: 411:State : 44 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar param . LexToken(cpar,')',49,1784) + yacc.py: 471:Action : Reduce rule [param_list -> param] with [] and goto state 42 + yacc.py: 506:Result : ([(LexToken(id,'i',49,1777), LexToken(typ ...) + yacc.py: 410: + yacc.py: 411:State : 42 + yacc.py: 430:Defaulted state 42: Reduce using 30 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar param_list . LexToken(cpar,')',49,1784) + yacc.py: 471:Action : Reduce rule [formals -> param_list] with [] and goto state 51 + yacc.py: 506:Result : ([(LexToken(id,'i',49,1777), LexToken(typ ...) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals . LexToken(cpar,')',49,1784) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals cpar . LexToken(colon,':',49,1786) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals cpar colon . LexToken(type,'List',49,1788) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals cpar colon type . LexToken(ocur,'{',49,1793) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals cpar colon type ocur . LexToken(opar,'(',50,1801) + yacc.py: 445:Action : Shift and goto state 80 + yacc.py: 410: + yacc.py: 411:State : 80 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals cpar colon type ocur opar . LexToken(new,'new',50,1802) + yacc.py: 445:Action : Shift and goto state 89 + yacc.py: 410: + yacc.py: 411:State : 89 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals cpar colon type ocur opar new . LexToken(type,'Cons',50,1806) + yacc.py: 445:Action : Shift and goto state 134 + yacc.py: 410: + yacc.py: 411:State : 134 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi id opar formals cpar colon type ocur opar new type . LexToken(cpar,')',50,1810) + yacc.py: 471:Action : Reduce rule [atom -> new type] with ['new','Cons'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 123 + yacc.py: 506:Result : ( opar expr cpar] with ['(',,')'] and goto state 77 + yacc.py: 506:Result : ( id] with ['i'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( id] with ['self'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 211 + yacc.py: 506:Result : ([ expr comma arg_list] with [,',',] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['init','(',,')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'init',50,1812), [ factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['cons','(',,')',':','List','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 16 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 16 + yacc.py: 430:Defaulted state 16: Reduce using 14 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi def_func semi epsilon . LexToken(ccur,'}',53,1833) + yacc.py: 471:Action : Reduce rule [feature_list -> epsilon] with [None] and goto state 48 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 48 + yacc.py: 430:Defaulted state 48: Reduce using 16 + yacc.py: 435:Stack : class type ocur def_func semi def_func semi def_func semi def_func semi feature_list . LexToken(ccur,'}',53,1833) + yacc.py: 471:Action : Reduce rule [feature_list -> def_func semi feature_list] with [,';',[]] and goto state 48 + yacc.py: 506:Result : ([ def_func semi feature_list] with [,';',] and goto state 48 + yacc.py: 506:Result : ([ def_func semi feature_list] with [,';',] and goto state 48 + yacc.py: 506:Result : ([ def_func semi feature_list] with [,';',] and goto state 14 + yacc.py: 506:Result : ([ class type ocur feature_list ccur semi] with ['class','List','{',,'}',';'] and goto state 3 + yacc.py: 506:Result : ( id colon type] with ['car',':','Int'] and goto state 17 + yacc.py: 506:Result : ( id colon type] with ['cdr',':','List'] and goto state 17 + yacc.py: 506:Result : ( ] with [] and goto state 45 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 45 + yacc.py: 430:Defaulted state 45: Reduce using 34 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar epsilon . LexToken(cpar,')',76,2482) + yacc.py: 471:Action : Reduce rule [param_list_empty -> epsilon] with [None] and goto state 43 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 43 + yacc.py: 430:Defaulted state 43: Reduce using 31 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar param_list_empty . LexToken(cpar,')',76,2482) + yacc.py: 471:Action : Reduce rule [formals -> param_list_empty] with [[]] and goto state 51 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar formals . LexToken(cpar,')',76,2482) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar formals cpar . LexToken(colon,':',76,2484) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar formals cpar colon . LexToken(type,'Bool',76,2486) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar formals cpar colon type . LexToken(ocur,'{',76,2491) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar formals cpar colon type ocur . LexToken(false,'false',76,2493) + yacc.py: 445:Action : Shift and goto state 92 + yacc.py: 410: + yacc.py: 411:State : 92 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi id opar formals cpar colon type ocur false . LexToken(ccur,'}',76,2499) + yacc.py: 471:Action : Reduce rule [atom -> false] with ['false'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['isNil','(',[],')',':','Bool','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 45 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 45 + yacc.py: 430:Defaulted state 45: Reduce using 34 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar epsilon . LexToken(cpar,')',78,2511) + yacc.py: 471:Action : Reduce rule [param_list_empty -> epsilon] with [None] and goto state 43 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 43 + yacc.py: 430:Defaulted state 43: Reduce using 31 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar param_list_empty . LexToken(cpar,')',78,2511) + yacc.py: 471:Action : Reduce rule [formals -> param_list_empty] with [[]] and goto state 51 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar formals . LexToken(cpar,')',78,2511) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar formals cpar . LexToken(colon,':',78,2514) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar formals cpar colon . LexToken(type,'Int',78,2516) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar formals cpar colon type . LexToken(ocur,'{',78,2520) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar formals cpar colon type ocur . LexToken(id,'car',78,2522) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi id opar formals cpar colon type ocur id . LexToken(ccur,'}',78,2526) + yacc.py: 471:Action : Reduce rule [atom -> id] with ['car'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['head','(',[],')',':','Int','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 45 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 45 + yacc.py: 430:Defaulted state 45: Reduce using 34 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar epsilon . LexToken(cpar,')',80,2538) + yacc.py: 471:Action : Reduce rule [param_list_empty -> epsilon] with [None] and goto state 43 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 43 + yacc.py: 430:Defaulted state 43: Reduce using 31 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar param_list_empty . LexToken(cpar,')',80,2538) + yacc.py: 471:Action : Reduce rule [formals -> param_list_empty] with [[]] and goto state 51 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar formals . LexToken(cpar,')',80,2538) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar formals cpar . LexToken(colon,':',80,2541) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar formals cpar colon . LexToken(type,'List',80,2543) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar formals cpar colon type . LexToken(ocur,'{',80,2548) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar formals cpar colon type ocur . LexToken(id,'cdr',80,2550) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi id opar formals cpar colon type ocur id . LexToken(ccur,'}',80,2554) + yacc.py: 471:Action : Reduce rule [atom -> id] with ['cdr'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['tail','(',[],')',':','List','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( id colon type] with ['i',':','Int'] and goto state 44 + yacc.py: 506:Result : ((LexToken(id,'i',82,2566), LexToken(type ...) + yacc.py: 410: + yacc.py: 411:State : 44 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param . LexToken(comma,',',82,2573) + yacc.py: 445:Action : Shift and goto state 60 + yacc.py: 410: + yacc.py: 411:State : 60 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param comma . LexToken(id,'rest',82,2575) + yacc.py: 445:Action : Shift and goto state 46 + yacc.py: 410: + yacc.py: 411:State : 46 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param comma id . LexToken(colon,':',82,2580) + yacc.py: 445:Action : Shift and goto state 61 + yacc.py: 410: + yacc.py: 411:State : 61 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param comma id colon . LexToken(type,'List',82,2582) + yacc.py: 445:Action : Shift and goto state 96 + yacc.py: 410: + yacc.py: 411:State : 96 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param comma id colon type . LexToken(cpar,')',82,2586) + yacc.py: 471:Action : Reduce rule [param -> id colon type] with ['rest',':','List'] and goto state 44 + yacc.py: 506:Result : ((LexToken(id,'rest',82,2575), LexToken(t ...) + yacc.py: 410: + yacc.py: 411:State : 44 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param comma param . LexToken(cpar,')',82,2586) + yacc.py: 471:Action : Reduce rule [param_list -> param] with [] and goto state 95 + yacc.py: 506:Result : ([(LexToken(id,'rest',82,2575), LexToken( ...) + yacc.py: 410: + yacc.py: 411:State : 95 + yacc.py: 430:Defaulted state 95: Reduce using 33 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param comma param_list . LexToken(cpar,')',82,2586) + yacc.py: 471:Action : Reduce rule [param_list -> param comma param_list] with [,',',] and goto state 42 + yacc.py: 506:Result : ([(LexToken(id,'i',82,2566), LexToken(typ ...) + yacc.py: 410: + yacc.py: 411:State : 42 + yacc.py: 430:Defaulted state 42: Reduce using 30 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar param_list . LexToken(cpar,')',82,2586) + yacc.py: 471:Action : Reduce rule [formals -> param_list] with [] and goto state 51 + yacc.py: 506:Result : ([(LexToken(id,'i',82,2566), LexToken(typ ...) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals . LexToken(cpar,')',82,2586) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar . LexToken(colon,':',82,2588) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar colon . LexToken(type,'List',82,2590) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar colon type . LexToken(ocur,'{',82,2595) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar colon type ocur . LexToken(ocur,'{',83,2603) + yacc.py: 445:Action : Shift and goto state 90 + yacc.py: 410: + yacc.py: 411:State : 90 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar colon type ocur ocur . LexToken(id,'car',84,2607) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar colon type ocur ocur id . LexToken(larrow,'<-',84,2611) + yacc.py: 445:Action : Shift and goto state 112 + yacc.py: 410: + yacc.py: 411:State : 112 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar colon type ocur ocur id larrow . LexToken(id,'i',84,2614) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi id opar formals cpar colon type ocur ocur id larrow id . LexToken(semi,';',84,2615) + yacc.py: 471:Action : Reduce rule [atom -> id] with ['i'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 152 + yacc.py: 506:Result : ( id larrow expr] with ['car','<-',] and goto state 111 + yacc.py: 506:Result : ( id] with ['rest'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 152 + yacc.py: 506:Result : ( id larrow expr] with ['cdr','<-',] and goto state 111 + yacc.py: 506:Result : ( id] with ['self'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( expr semi] with [,';'] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 135 + yacc.py: 506:Result : ([ ocur block ccur] with ['{',,'}'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['init','(',,')',':','List','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 16 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 16 + yacc.py: 430:Defaulted state 16: Reduce using 14 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi def_func semi epsilon . LexToken(ccur,'}',90,2655) + yacc.py: 471:Action : Reduce rule [feature_list -> epsilon] with [None] and goto state 48 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 48 + yacc.py: 430:Defaulted state 48: Reduce using 16 + yacc.py: 435:Stack : def_class class type inherits type ocur def_attr semi def_attr semi def_func semi def_func semi def_func semi def_func semi feature_list . LexToken(ccur,'}',90,2655) + yacc.py: 471:Action : Reduce rule [feature_list -> def_func semi feature_list] with [,';',[]] and goto state 48 + yacc.py: 506:Result : ([ def_func semi feature_list] with [,';',] and goto state 48 + yacc.py: 506:Result : ([ def_func semi feature_list] with [,';',] and goto state 48 + yacc.py: 506:Result : ([ def_func semi feature_list] with [,';',] and goto state 47 + yacc.py: 506:Result : ([ def_attr semi feature_list] with [,';',] and goto state 47 + yacc.py: 506:Result : ([ def_attr semi feature_list] with [,';',] and goto state 53 + yacc.py: 506:Result : ([ class type inherits type ocur feature_list ccur semi] with ['class','Cons','inherits','List','{',,'}',';'] and goto state 3 + yacc.py: 506:Result : ( id colon type] with ['mylist',':','List'] and goto state 17 + yacc.py: 506:Result : ( id colon type] with ['l',':','List'] and goto state 44 + yacc.py: 506:Result : ((LexToken(id,'l',107,3036), LexToken(typ ...) + yacc.py: 410: + yacc.py: 411:State : 44 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar param . LexToken(cpar,')',107,3044) + yacc.py: 471:Action : Reduce rule [param_list -> param] with [] and goto state 42 + yacc.py: 506:Result : ([(LexToken(id,'l',107,3036), LexToken(ty ...) + yacc.py: 410: + yacc.py: 411:State : 42 + yacc.py: 430:Defaulted state 42: Reduce using 30 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar param_list . LexToken(cpar,')',107,3044) + yacc.py: 471:Action : Reduce rule [formals -> param_list] with [] and goto state 51 + yacc.py: 506:Result : ([(LexToken(id,'l',107,3036), LexToken(ty ...) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals . LexToken(cpar,')',107,3044) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar . LexToken(colon,':',107,3046) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon . LexToken(type,'Object',107,3048) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type . LexToken(ocur,'{',107,3055) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur . LexToken(if,'if',108,3063) + yacc.py: 445:Action : Shift and goto state 86 + yacc.py: 410: + yacc.py: 411:State : 86 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if . LexToken(id,'l',108,3066) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if id . LexToken(dot,'.',108,3067) + yacc.py: 471:Action : Reduce rule [atom -> id] with ['l'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( ] with [] and goto state 150 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 150 + yacc.py: 430:Defaulted state 150: Reduce using 96 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if factor dot id opar epsilon . LexToken(cpar,')',108,3074) + yacc.py: 471:Action : Reduce rule [arg_list_empty -> epsilon] with [None] and goto state 149 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 149 + yacc.py: 430:Defaulted state 149: Reduce using 92 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if factor dot id opar arg_list_empty . LexToken(cpar,')',108,3074) + yacc.py: 471:Action : Reduce rule [args -> arg_list_empty] with [[]] and goto state 153 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 153 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if factor dot id opar args . LexToken(cpar,')',108,3074) + yacc.py: 445:Action : Shift and goto state 191 + yacc.py: 410: + yacc.py: 411:State : 191 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if factor dot id opar args cpar . LexToken(then,'then',108,3076) + yacc.py: 471:Action : Reduce rule [func_call -> id opar args cpar] with ['isNil','(',[],')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'isNil',108,3068), [])) + yacc.py: 410: + yacc.py: 411:State : 167 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if factor dot func_call . LexToken(then,'then',108,3076) + yacc.py: 471:Action : Reduce rule [factor -> factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 132 + yacc.py: 506:Result : ( string] with ['\n'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['out_string','(',,')'] and goto state 78 + yacc.py: 506:Result : ((LexToken(id,'out_string',108,3081), [ func_call] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 203 + yacc.py: 506:Result : ( id] with ['l'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( ] with [] and goto state 150 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 150 + yacc.py: 430:Defaulted state 150: Reduce using 96 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur id opar factor dot id opar epsilon . LexToken(cpar,')',110,3145) + yacc.py: 471:Action : Reduce rule [arg_list_empty -> epsilon] with [None] and goto state 149 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 149 + yacc.py: 430:Defaulted state 149: Reduce using 92 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur id opar factor dot id opar arg_list_empty . LexToken(cpar,')',110,3145) + yacc.py: 471:Action : Reduce rule [args -> arg_list_empty] with [[]] and goto state 153 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 153 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur id opar factor dot id opar args . LexToken(cpar,')',110,3145) + yacc.py: 445:Action : Shift and goto state 191 + yacc.py: 410: + yacc.py: 411:State : 191 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur id opar factor dot id opar args cpar . LexToken(cpar,')',110,3146) + yacc.py: 471:Action : Reduce rule [func_call -> id opar args cpar] with ['head','(',[],')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'head',110,3140), [])) + yacc.py: 410: + yacc.py: 411:State : 167 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur id opar factor dot func_call . LexToken(cpar,')',110,3146) + yacc.py: 471:Action : Reduce rule [factor -> factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['out_int','(',,')'] and goto state 78 + yacc.py: 506:Result : ((LexToken(id,'out_int',110,3130), [ func_call] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( string] with [' '] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['out_string','(',,')'] and goto state 78 + yacc.py: 506:Result : ((LexToken(id,'out_string',111,3155), [ func_call] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( id] with ['l'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( ] with [] and goto state 150 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 150 + yacc.py: 430:Defaulted state 150: Reduce using 96 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur expr semi expr semi id opar factor dot id opar epsilon . LexToken(cpar,')',112,3196) + yacc.py: 471:Action : Reduce rule [arg_list_empty -> epsilon] with [None] and goto state 149 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 149 + yacc.py: 430:Defaulted state 149: Reduce using 92 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur expr semi expr semi id opar factor dot id opar arg_list_empty . LexToken(cpar,')',112,3196) + yacc.py: 471:Action : Reduce rule [args -> arg_list_empty] with [[]] and goto state 153 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 153 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur expr semi expr semi id opar factor dot id opar args . LexToken(cpar,')',112,3196) + yacc.py: 445:Action : Shift and goto state 191 + yacc.py: 410: + yacc.py: 411:State : 191 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur expr semi expr semi id opar factor dot id opar args cpar . LexToken(cpar,')',112,3197) + yacc.py: 471:Action : Reduce rule [func_call -> id opar args cpar] with ['tail','(',[],')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'tail',112,3191), [])) + yacc.py: 410: + yacc.py: 411:State : 167 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi id opar formals cpar colon type ocur if expr then expr else ocur expr semi expr semi id opar factor dot func_call . LexToken(cpar,')',112,3197) + yacc.py: 471:Action : Reduce rule [factor -> factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['print_list','(',,')'] and goto state 78 + yacc.py: 506:Result : ((LexToken(id,'print_list',112,3178), [ func_call] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( expr semi] with [,';'] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 135 + yacc.py: 506:Result : ([ ocur block ccur] with ['{',,'}'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 228 + yacc.py: 506:Result : ( if expr then expr else expr fi] with ['if',,'then',,'else',,'fi'] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['print_list','(',,')',':','Object','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 45 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 45 + yacc.py: 430:Defaulted state 45: Reduce using 34 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar epsilon . LexToken(cpar,')',126,3742) + yacc.py: 471:Action : Reduce rule [param_list_empty -> epsilon] with [None] and goto state 43 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 43 + yacc.py: 430:Defaulted state 43: Reduce using 31 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar param_list_empty . LexToken(cpar,')',126,3742) + yacc.py: 471:Action : Reduce rule [formals -> param_list_empty] with [[]] and goto state 51 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 51 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals . LexToken(cpar,')',126,3742) + yacc.py: 445:Action : Shift and goto state 64 + yacc.py: 410: + yacc.py: 411:State : 64 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar . LexToken(colon,':',126,3744) + yacc.py: 445:Action : Shift and goto state 100 + yacc.py: 410: + yacc.py: 411:State : 100 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon . LexToken(type,'Object',126,3746) + yacc.py: 445:Action : Shift and goto state 138 + yacc.py: 410: + yacc.py: 411:State : 138 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type . LexToken(ocur,'{',126,3753) + yacc.py: 445:Action : Shift and goto state 181 + yacc.py: 410: + yacc.py: 411:State : 181 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur . LexToken(ocur,'{',127,3761) + yacc.py: 445:Action : Shift and goto state 90 + yacc.py: 410: + yacc.py: 411:State : 90 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur . LexToken(id,'mylist',128,3765) + yacc.py: 445:Action : Shift and goto state 72 + yacc.py: 410: + yacc.py: 411:State : 72 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur id . LexToken(larrow,'<-',128,3772) + yacc.py: 445:Action : Shift and goto state 112 + yacc.py: 410: + yacc.py: 411:State : 112 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur id larrow . LexToken(new,'new',128,3775) + yacc.py: 445:Action : Shift and goto state 89 + yacc.py: 410: + yacc.py: 411:State : 89 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur id larrow new . LexToken(type,'List',128,3779) + yacc.py: 445:Action : Shift and goto state 134 + yacc.py: 410: + yacc.py: 411:State : 134 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur id larrow new type . LexToken(dot,'.',128,3783) + yacc.py: 471:Action : Reduce rule [atom -> new type] with ['new','List'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( num] with [1.0] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['cons','(',,')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'cons',128,3784), [ factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( num] with [2.0] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['cons','(',,')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'cons',128,3792), [ factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( num] with [3.0] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['cons','(',,')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'cons',128,3800), [ factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( num] with [4.0] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['cons','(',,')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'cons',128,3808), [ factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( num] with [5.0] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['cons','(',,')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'cons',128,3816), [ factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 152 + yacc.py: 506:Result : ( id larrow expr] with ['mylist','<-',] and goto state 111 + yacc.py: 506:Result : ( id] with ['mylist'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( ] with [] and goto state 150 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 150 + yacc.py: 430:Defaulted state 150: Reduce using 96 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while opar not factor dot id opar epsilon . LexToken(cpar,')',129,3851) + yacc.py: 471:Action : Reduce rule [arg_list_empty -> epsilon] with [None] and goto state 149 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 149 + yacc.py: 430:Defaulted state 149: Reduce using 92 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while opar not factor dot id opar arg_list_empty . LexToken(cpar,')',129,3851) + yacc.py: 471:Action : Reduce rule [args -> arg_list_empty] with [[]] and goto state 153 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 153 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while opar not factor dot id opar args . LexToken(cpar,')',129,3851) + yacc.py: 445:Action : Shift and goto state 191 + yacc.py: 410: + yacc.py: 411:State : 191 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while opar not factor dot id opar args cpar . LexToken(cpar,')',129,3852) + yacc.py: 471:Action : Reduce rule [func_call -> id opar args cpar] with ['isNil','(',[],')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'isNil',129,3845), [])) + yacc.py: 410: + yacc.py: 411:State : 167 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while opar not factor dot func_call . LexToken(cpar,')',129,3852) + yacc.py: 471:Action : Reduce rule [factor -> factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 124 + yacc.py: 506:Result : ( not expr] with ['not',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 123 + yacc.py: 506:Result : ( opar expr cpar] with ['(',,')'] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 133 + yacc.py: 506:Result : ( id] with ['mylist'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 155 + yacc.py: 506:Result : ( expr] with [] and goto state 148 + yacc.py: 506:Result : ([ arg_list] with [] and goto state 153 + yacc.py: 506:Result : ([ id opar args cpar] with ['print_list','(',,')'] and goto state 78 + yacc.py: 506:Result : ((LexToken(id,'print_list',131,3874), [ func_call] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( id] with ['mylist'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( ] with [] and goto state 150 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 150 + yacc.py: 430:Defaulted state 150: Reduce using 96 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while expr loop ocur expr semi id larrow factor dot id opar epsilon . LexToken(cpar,')',132,3924) + yacc.py: 471:Action : Reduce rule [arg_list_empty -> epsilon] with [None] and goto state 149 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 149 + yacc.py: 430:Defaulted state 149: Reduce using 92 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while expr loop ocur expr semi id larrow factor dot id opar arg_list_empty . LexToken(cpar,')',132,3924) + yacc.py: 471:Action : Reduce rule [args -> arg_list_empty] with [[]] and goto state 153 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 153 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while expr loop ocur expr semi id larrow factor dot id opar args . LexToken(cpar,')',132,3924) + yacc.py: 445:Action : Shift and goto state 191 + yacc.py: 410: + yacc.py: 411:State : 191 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while expr loop ocur expr semi id larrow factor dot id opar args cpar . LexToken(semi,';',132,3925) + yacc.py: 471:Action : Reduce rule [func_call -> id opar args cpar] with ['tail','(',[],')'] and goto state 167 + yacc.py: 506:Result : ((LexToken(id,'tail',132,3919), [])) + yacc.py: 410: + yacc.py: 411:State : 167 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi id opar formals cpar colon type ocur ocur expr semi while expr loop ocur expr semi id larrow factor dot func_call . LexToken(semi,';',132,3925) + yacc.py: 471:Action : Reduce rule [factor -> factor dot func_call] with [,'.',] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 152 + yacc.py: 506:Result : ( id larrow expr] with ['mylist','<-',] and goto state 111 + yacc.py: 506:Result : ( expr semi] with [,';'] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 135 + yacc.py: 506:Result : ([ ocur block ccur] with ['{',,'}'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 204 + yacc.py: 506:Result : ( while expr loop expr pool] with ['while',,'loop',,'pool'] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 111 + yacc.py: 506:Result : ( expr semi] with [,';'] and goto state 190 + yacc.py: 506:Result : ([ expr semi block] with [,';',] and goto state 135 + yacc.py: 506:Result : ([ ocur block ccur] with ['{',,'}'] and goto state 79 + yacc.py: 506:Result : ( atom] with [] and goto state 77 + yacc.py: 506:Result : ( factor] with [] and goto state 76 + yacc.py: 506:Result : ( base_call] with [] and goto state 75 + yacc.py: 506:Result : ( term] with [] and goto state 74 + yacc.py: 506:Result : ( op] with [] and goto state 73 + yacc.py: 506:Result : ( comp] with [] and goto state 206 + yacc.py: 506:Result : ( id opar formals cpar colon type ocur expr ccur] with ['main','(',[],')',':','Object','{',,'}'] and goto state 18 + yacc.py: 506:Result : ( ] with [] and goto state 16 + yacc.py: 548:Result : (None) + yacc.py: 410: + yacc.py: 411:State : 16 + yacc.py: 430:Defaulted state 16: Reduce using 14 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi def_func semi epsilon . LexToken(ccur,'}',138,3957) + yacc.py: 471:Action : Reduce rule [feature_list -> epsilon] with [None] and goto state 48 + yacc.py: 506:Result : ([]) + yacc.py: 410: + yacc.py: 411:State : 48 + yacc.py: 430:Defaulted state 48: Reduce using 16 + yacc.py: 435:Stack : def_class def_class class type inherits type ocur def_attr semi def_func semi def_func semi feature_list . LexToken(ccur,'}',138,3957) + yacc.py: 471:Action : Reduce rule [feature_list -> def_func semi feature_list] with [,';',[]] and goto state 48 + yacc.py: 506:Result : ([ def_func semi feature_list] with [,';',] and goto state 47 + yacc.py: 506:Result : ([ def_attr semi feature_list] with [,';',] and goto state 53 + yacc.py: 506:Result : ([ class type inherits type ocur feature_list ccur semi] with ['class','Main','inherits','IO','{',,'}',';'] and goto state 3 + yacc.py: 506:Result : ( def_class] with [] and goto state 6 + yacc.py: 506:Result : ([ def_class class_list] with [,] and goto state 6 + yacc.py: 506:Result : ([ def_class class_list] with [,] and goto state 2 + yacc.py: 506:Result : ([ class_list] with [] and goto state 1 + yacc.py: 506:Result : ( ( program +Rule 1 program -> class_list +Rule 2 epsilon -> +Rule 3 class_list -> def_class class_list +Rule 4 class_list -> def_class +Rule 5 class_list -> error class_list +Rule 6 def_class -> class type ocur feature_list ccur semi +Rule 7 def_class -> class type inherits type ocur feature_list ccur semi +Rule 8 def_class -> class error ocur feature_list ccur semi +Rule 9 def_class -> class error inherits type ocur feature_list ccur semi +Rule 10 def_class -> class error inherits error ocur feature_list ccur semi +Rule 11 def_class -> class type inherits error ocur feature_list ccur semi +Rule 12 feature_list -> epsilon +Rule 13 feature_list -> def_attr semi feature_list +Rule 14 feature_list -> def_func semi feature_list +Rule 15 feature_list -> error feature_list +Rule 16 def_attr -> id colon type +Rule 17 def_attr -> id colon type larrow expr +Rule 18 def_attr -> error colon type +Rule 19 def_attr -> id colon error +Rule 20 def_attr -> error colon type larrow expr +Rule 21 def_attr -> id colon error larrow expr +Rule 22 def_attr -> id colon type larrow error +Rule 23 def_func -> id opar formals cpar colon type ocur expr ccur +Rule 24 def_func -> error opar formals cpar colon type ocur expr ccur +Rule 25 def_func -> id opar error cpar colon type ocur expr ccur +Rule 26 def_func -> id opar formals cpar colon error ocur expr ccur +Rule 27 def_func -> id opar formals cpar colon type ocur error ccur +Rule 28 formals -> param_list +Rule 29 formals -> param_list_empty +Rule 30 param_list -> param +Rule 31 param_list -> param comma param_list +Rule 32 param_list -> error param_list +Rule 33 param_list_empty -> epsilon +Rule 34 param -> id colon type +Rule 35 expr -> let let_list in expr +Rule 36 expr -> let error in expr +Rule 37 expr -> let let_list in error +Rule 38 expr -> case expr of cases_list esac +Rule 39 expr -> case error of cases_list esac +Rule 40 expr -> case expr of error esac +Rule 41 expr -> if expr then expr else expr fi +Rule 42 expr -> if error then expr else expr fi +Rule 43 expr -> if expr then error else expr fi +Rule 44 expr -> if expr then expr else error fi +Rule 45 expr -> while expr loop expr pool +Rule 46 expr -> while error loop expr pool +Rule 47 expr -> while expr loop error pool +Rule 48 expr -> while expr loop expr error +Rule 49 expr -> arith +Rule 50 let_list -> let_assign +Rule 51 let_list -> let_assign comma let_list +Rule 52 let_list -> error let_list +Rule 53 let_assign -> param larrow expr +Rule 54 let_assign -> param +Rule 55 cases_list -> casep semi +Rule 56 cases_list -> casep semi cases_list +Rule 57 cases_list -> error cases_list +Rule 58 casep -> id colon type rarrow expr +Rule 59 arith -> id larrow expr +Rule 60 arith -> not comp +Rule 61 arith -> comp +Rule 62 comp -> comp less op +Rule 63 comp -> comp lesseq op +Rule 64 comp -> comp equal op +Rule 65 comp -> op +Rule 66 op -> op plus term +Rule 67 op -> op minus term +Rule 68 op -> term +Rule 69 term -> term star base_call +Rule 70 term -> term div base_call +Rule 71 term -> isvoid base_call +Rule 72 term -> nox base_call +Rule 73 term -> base_call +Rule 74 base_call -> factor arroba type dot func_call +Rule 75 base_call -> factor +Rule 76 factor -> atom +Rule 77 factor -> opar expr cpar +Rule 78 factor -> factor dot func_call +Rule 79 factor -> func_call +Rule 80 atom -> num +Rule 81 atom -> id +Rule 82 atom -> new type +Rule 83 atom -> new error +Rule 84 atom -> ocur block ccur +Rule 85 atom -> true +Rule 86 atom -> false +Rule 87 atom -> string +Rule 88 block -> expr semi +Rule 89 block -> expr semi block +Rule 90 block -> error block +Rule 91 block -> error +Rule 92 func_call -> id opar args cpar +Rule 93 args -> arg_list +Rule 94 args -> arg_list_empty +Rule 95 arg_list -> expr +Rule 96 arg_list -> expr comma arg_list +Rule 97 arg_list -> error arg_list +Rule 98 arg_list_empty -> epsilon + +Terminals, with rules where they appear + +arroba : 74 +case : 38 39 40 +ccur : 6 7 8 9 10 11 23 24 25 26 27 84 +class : 6 7 8 9 10 11 +colon : 16 17 18 19 20 21 22 23 24 25 26 27 34 58 +comma : 31 51 96 +cpar : 23 24 25 26 27 77 92 +div : 70 +dot : 74 78 +else : 41 42 43 44 +equal : 64 +error : 5 8 9 10 10 11 15 18 19 20 21 22 24 25 26 27 32 36 37 39 40 42 43 44 46 47 48 52 57 83 90 91 97 +esac : 38 39 40 +false : 86 +fi : 41 42 43 44 +id : 16 17 19 21 22 23 25 26 27 34 58 59 81 92 +if : 41 42 43 44 +in : 35 36 37 +inherits : 7 9 10 11 +isvoid : 71 +larrow : 17 20 21 22 53 59 +less : 62 +lesseq : 63 +let : 35 36 37 +loop : 45 46 47 48 +minus : 67 +new : 82 83 +not : 60 +nox : 72 +num : 80 +ocur : 6 7 8 9 10 11 23 24 25 26 27 84 +of : 38 39 40 +opar : 23 24 25 26 27 77 92 +plus : 66 +pool : 45 46 47 +rarrow : 58 +semi : 6 7 8 9 10 11 13 14 55 56 88 89 +star : 69 +string : 87 +then : 41 42 43 44 +true : 85 +type : 6 7 7 9 11 16 17 18 20 22 23 24 25 27 34 58 74 82 +while : 45 46 47 48 + +Nonterminals, with rules where they appear + +arg_list : 93 96 97 +arg_list_empty : 94 +args : 92 +arith : 49 +atom : 76 +base_call : 69 70 71 72 73 +block : 84 89 90 +casep : 55 56 +cases_list : 38 39 56 57 +class_list : 1 3 5 +comp : 60 61 62 63 64 +def_attr : 13 +def_class : 3 4 +def_func : 14 +epsilon : 12 33 98 +expr : 17 20 21 23 24 25 26 35 36 38 40 41 41 41 42 42 43 43 44 44 45 45 46 47 48 48 53 58 59 77 88 89 95 96 +factor : 74 75 78 +feature_list : 6 7 8 9 10 11 13 14 15 +formals : 23 24 26 27 +func_call : 74 78 79 +let_assign : 50 51 +let_list : 35 37 51 52 +op : 62 63 64 65 66 67 +param : 30 31 53 54 +param_list : 28 31 32 +param_list_empty : 29 +program : 0 +term : 66 67 68 69 70 + +Parsing method: LALR + +state 0 + + (0) S' -> . program + (1) program -> . class_list + (3) class_list -> . def_class class_list + (4) class_list -> . def_class + (5) class_list -> . error class_list + (6) def_class -> . class type ocur feature_list ccur semi + (7) def_class -> . class type inherits type ocur feature_list ccur semi + (8) def_class -> . class error ocur feature_list ccur semi + (9) def_class -> . class error inherits type ocur feature_list ccur semi + (10) def_class -> . class error inherits error ocur feature_list ccur semi + (11) def_class -> . class type inherits error ocur feature_list ccur semi + + error shift and go to state 4 + class shift and go to state 5 + + program shift and go to state 1 + class_list shift and go to state 2 + def_class shift and go to state 3 + +state 1 + + (0) S' -> program . + + + +state 2 + + (1) program -> class_list . + + $end reduce using rule 1 (program -> class_list .) + + +state 3 + + (3) class_list -> def_class . class_list + (4) class_list -> def_class . + (3) class_list -> . def_class class_list + (4) class_list -> . def_class + (5) class_list -> . error class_list + (6) def_class -> . class type ocur feature_list ccur semi + (7) def_class -> . class type inherits type ocur feature_list ccur semi + (8) def_class -> . class error ocur feature_list ccur semi + (9) def_class -> . class error inherits type ocur feature_list ccur semi + (10) def_class -> . class error inherits error ocur feature_list ccur semi + (11) def_class -> . class type inherits error ocur feature_list ccur semi + + $end reduce using rule 4 (class_list -> def_class .) + error shift and go to state 4 + class shift and go to state 5 + + def_class shift and go to state 3 + class_list shift and go to state 6 + +state 4 + + (5) class_list -> error . class_list + (3) class_list -> . def_class class_list + (4) class_list -> . def_class + (5) class_list -> . error class_list + (6) def_class -> . class type ocur feature_list ccur semi + (7) def_class -> . class type inherits type ocur feature_list ccur semi + (8) def_class -> . class error ocur feature_list ccur semi + (9) def_class -> . class error inherits type ocur feature_list ccur semi + (10) def_class -> . class error inherits error ocur feature_list ccur semi + (11) def_class -> . class type inherits error ocur feature_list ccur semi + + error shift and go to state 4 + class shift and go to state 5 + + class_list shift and go to state 7 + def_class shift and go to state 3 + +state 5 + + (6) def_class -> class . type ocur feature_list ccur semi + (7) def_class -> class . type inherits type ocur feature_list ccur semi + (8) def_class -> class . error ocur feature_list ccur semi + (9) def_class -> class . error inherits type ocur feature_list ccur semi + (10) def_class -> class . error inherits error ocur feature_list ccur semi + (11) def_class -> class . type inherits error ocur feature_list ccur semi + + type shift and go to state 8 + error shift and go to state 9 + + +state 6 + + (3) class_list -> def_class class_list . + + $end reduce using rule 3 (class_list -> def_class class_list .) + + +state 7 + + (5) class_list -> error class_list . + + $end reduce using rule 5 (class_list -> error class_list .) + + +state 8 + + (6) def_class -> class type . ocur feature_list ccur semi + (7) def_class -> class type . inherits type ocur feature_list ccur semi + (11) def_class -> class type . inherits error ocur feature_list ccur semi + + ocur shift and go to state 10 + inherits shift and go to state 11 + + +state 9 + + (8) def_class -> class error . ocur feature_list ccur semi + (9) def_class -> class error . inherits type ocur feature_list ccur semi + (10) def_class -> class error . inherits error ocur feature_list ccur semi + + ocur shift and go to state 12 + inherits shift and go to state 13 + + +state 10 + + (6) def_class -> class type ocur . feature_list ccur semi + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + feature_list shift and go to state 14 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + def_func shift and go to state 17 + +state 11 + + (7) def_class -> class type inherits . type ocur feature_list ccur semi + (11) def_class -> class type inherits . error ocur feature_list ccur semi + + type shift and go to state 20 + error shift and go to state 21 + + +state 12 + + (8) def_class -> class error ocur . feature_list ccur semi + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + feature_list shift and go to state 22 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + def_func shift and go to state 17 + +state 13 + + (9) def_class -> class error inherits . type ocur feature_list ccur semi + (10) def_class -> class error inherits . error ocur feature_list ccur semi + + type shift and go to state 24 + error shift and go to state 23 + + +state 14 + + (6) def_class -> class type ocur feature_list . ccur semi + + ccur shift and go to state 25 + + +state 15 + + (12) feature_list -> epsilon . + + ccur reduce using rule 12 (feature_list -> epsilon .) + + +state 16 + + (13) feature_list -> def_attr . semi feature_list + + semi shift and go to state 26 + + +state 17 + + (14) feature_list -> def_func . semi feature_list + + semi shift and go to state 27 + + +state 18 + + (15) feature_list -> error . feature_list + (18) def_attr -> error . colon type + (20) def_attr -> error . colon type larrow expr + (24) def_func -> error . opar formals cpar colon type ocur expr ccur + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + colon shift and go to state 29 + opar shift and go to state 30 + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + feature_list shift and go to state 28 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + def_func shift and go to state 17 + +state 19 + + (16) def_attr -> id . colon type + (17) def_attr -> id . colon type larrow expr + (19) def_attr -> id . colon error + (21) def_attr -> id . colon error larrow expr + (22) def_attr -> id . colon type larrow error + (23) def_func -> id . opar formals cpar colon type ocur expr ccur + (25) def_func -> id . opar error cpar colon type ocur expr ccur + (26) def_func -> id . opar formals cpar colon error ocur expr ccur + (27) def_func -> id . opar formals cpar colon type ocur error ccur + + colon shift and go to state 31 + opar shift and go to state 32 + + +state 20 + + (7) def_class -> class type inherits type . ocur feature_list ccur semi + + ocur shift and go to state 33 + + +state 21 + + (11) def_class -> class type inherits error . ocur feature_list ccur semi + + ocur shift and go to state 34 + + +state 22 + + (8) def_class -> class error ocur feature_list . ccur semi + + ccur shift and go to state 35 + + +state 23 + + (10) def_class -> class error inherits error . ocur feature_list ccur semi + + ocur shift and go to state 36 + + +state 24 + + (9) def_class -> class error inherits type . ocur feature_list ccur semi + + ocur shift and go to state 37 + + +state 25 + + (6) def_class -> class type ocur feature_list ccur . semi + + semi shift and go to state 38 + + +state 26 + + (13) feature_list -> def_attr semi . feature_list + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + def_attr shift and go to state 16 + feature_list shift and go to state 39 + epsilon shift and go to state 15 + def_func shift and go to state 17 + +state 27 + + (14) feature_list -> def_func semi . feature_list + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + def_func shift and go to state 17 + feature_list shift and go to state 40 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + +state 28 + + (15) feature_list -> error feature_list . + + ccur reduce using rule 15 (feature_list -> error feature_list .) + + +state 29 + + (18) def_attr -> error colon . type + (20) def_attr -> error colon . type larrow expr + + type shift and go to state 41 + + +state 30 + + (24) def_func -> error opar . formals cpar colon type ocur expr ccur + (28) formals -> . param_list + (29) formals -> . param_list_empty + (30) param_list -> . param + (31) param_list -> . param comma param_list + (32) param_list -> . error param_list + (33) param_list_empty -> . epsilon + (34) param -> . id colon type + (2) epsilon -> . + + error shift and go to state 42 + id shift and go to state 48 + cpar reduce using rule 2 (epsilon -> .) + + formals shift and go to state 43 + param_list shift and go to state 44 + param_list_empty shift and go to state 45 + param shift and go to state 46 + epsilon shift and go to state 47 + +state 31 + + (16) def_attr -> id colon . type + (17) def_attr -> id colon . type larrow expr + (19) def_attr -> id colon . error + (21) def_attr -> id colon . error larrow expr + (22) def_attr -> id colon . type larrow error + + type shift and go to state 49 + error shift and go to state 50 + + +state 32 + + (23) def_func -> id opar . formals cpar colon type ocur expr ccur + (25) def_func -> id opar . error cpar colon type ocur expr ccur + (26) def_func -> id opar . formals cpar colon error ocur expr ccur + (27) def_func -> id opar . formals cpar colon type ocur error ccur + (28) formals -> . param_list + (29) formals -> . param_list_empty + (30) param_list -> . param + (31) param_list -> . param comma param_list + (32) param_list -> . error param_list + (33) param_list_empty -> . epsilon + (34) param -> . id colon type + (2) epsilon -> . + + error shift and go to state 52 + id shift and go to state 48 + cpar reduce using rule 2 (epsilon -> .) + + formals shift and go to state 51 + param_list shift and go to state 44 + param_list_empty shift and go to state 45 + param shift and go to state 46 + epsilon shift and go to state 47 + +state 33 + + (7) def_class -> class type inherits type ocur . feature_list ccur semi + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + feature_list shift and go to state 53 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + def_func shift and go to state 17 + +state 34 + + (11) def_class -> class type inherits error ocur . feature_list ccur semi + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + feature_list shift and go to state 54 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + def_func shift and go to state 17 + +state 35 + + (8) def_class -> class error ocur feature_list ccur . semi + + semi shift and go to state 55 + + +state 36 + + (10) def_class -> class error inherits error ocur . feature_list ccur semi + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + feature_list shift and go to state 56 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + def_func shift and go to state 17 + +state 37 + + (9) def_class -> class error inherits type ocur . feature_list ccur semi + (12) feature_list -> . epsilon + (13) feature_list -> . def_attr semi feature_list + (14) feature_list -> . def_func semi feature_list + (15) feature_list -> . error feature_list + (2) epsilon -> . + (16) def_attr -> . id colon type + (17) def_attr -> . id colon type larrow expr + (18) def_attr -> . error colon type + (19) def_attr -> . id colon error + (20) def_attr -> . error colon type larrow expr + (21) def_attr -> . id colon error larrow expr + (22) def_attr -> . id colon type larrow error + (23) def_func -> . id opar formals cpar colon type ocur expr ccur + (24) def_func -> . error opar formals cpar colon type ocur expr ccur + (25) def_func -> . id opar error cpar colon type ocur expr ccur + (26) def_func -> . id opar formals cpar colon error ocur expr ccur + (27) def_func -> . id opar formals cpar colon type ocur error ccur + + error shift and go to state 18 + ccur reduce using rule 2 (epsilon -> .) + id shift and go to state 19 + + feature_list shift and go to state 57 + epsilon shift and go to state 15 + def_attr shift and go to state 16 + def_func shift and go to state 17 + +state 38 + + (6) def_class -> class type ocur feature_list ccur semi . + + error reduce using rule 6 (def_class -> class type ocur feature_list ccur semi .) + class reduce using rule 6 (def_class -> class type ocur feature_list ccur semi .) + $end reduce using rule 6 (def_class -> class type ocur feature_list ccur semi .) + + +state 39 + + (13) feature_list -> def_attr semi feature_list . + + ccur reduce using rule 13 (feature_list -> def_attr semi feature_list .) + + +state 40 + + (14) feature_list -> def_func semi feature_list . + + ccur reduce using rule 14 (feature_list -> def_func semi feature_list .) + + +state 41 + + (18) def_attr -> error colon type . + (20) def_attr -> error colon type . larrow expr + + semi reduce using rule 18 (def_attr -> error colon type .) + larrow shift and go to state 58 + + +state 42 + + (32) param_list -> error . param_list + (30) param_list -> . param + (31) param_list -> . param comma param_list + (32) param_list -> . error param_list + (34) param -> . id colon type + + error shift and go to state 42 + id shift and go to state 48 + + param_list shift and go to state 59 + param shift and go to state 46 + +state 43 + + (24) def_func -> error opar formals . cpar colon type ocur expr ccur + + cpar shift and go to state 60 + + +state 44 + + (28) formals -> param_list . + + cpar reduce using rule 28 (formals -> param_list .) + + +state 45 + + (29) formals -> param_list_empty . + + cpar reduce using rule 29 (formals -> param_list_empty .) + + +state 46 + + (30) param_list -> param . + (31) param_list -> param . comma param_list + + cpar reduce using rule 30 (param_list -> param .) + comma shift and go to state 61 + + +state 47 + + (33) param_list_empty -> epsilon . + + cpar reduce using rule 33 (param_list_empty -> epsilon .) + + +state 48 + + (34) param -> id . colon type + + colon shift and go to state 62 + + +state 49 + + (16) def_attr -> id colon type . + (17) def_attr -> id colon type . larrow expr + (22) def_attr -> id colon type . larrow error + + semi reduce using rule 16 (def_attr -> id colon type .) + larrow shift and go to state 63 + + +state 50 + + (19) def_attr -> id colon error . + (21) def_attr -> id colon error . larrow expr + + semi reduce using rule 19 (def_attr -> id colon error .) + larrow shift and go to state 64 + + +state 51 + + (23) def_func -> id opar formals . cpar colon type ocur expr ccur + (26) def_func -> id opar formals . cpar colon error ocur expr ccur + (27) def_func -> id opar formals . cpar colon type ocur error ccur + + cpar shift and go to state 65 + + +state 52 + + (25) def_func -> id opar error . cpar colon type ocur expr ccur + (32) param_list -> error . param_list + (30) param_list -> . param + (31) param_list -> . param comma param_list + (32) param_list -> . error param_list + (34) param -> . id colon type + + cpar shift and go to state 66 + error shift and go to state 42 + id shift and go to state 48 + + param_list shift and go to state 59 + param shift and go to state 46 + +state 53 + + (7) def_class -> class type inherits type ocur feature_list . ccur semi + + ccur shift and go to state 67 + + +state 54 + + (11) def_class -> class type inherits error ocur feature_list . ccur semi + + ccur shift and go to state 68 + + +state 55 + + (8) def_class -> class error ocur feature_list ccur semi . + + error reduce using rule 8 (def_class -> class error ocur feature_list ccur semi .) + class reduce using rule 8 (def_class -> class error ocur feature_list ccur semi .) + $end reduce using rule 8 (def_class -> class error ocur feature_list ccur semi .) + + +state 56 + + (10) def_class -> class error inherits error ocur feature_list . ccur semi + + ccur shift and go to state 69 + + +state 57 + + (9) def_class -> class error inherits type ocur feature_list . ccur semi + + ccur shift and go to state 70 + + +state 58 + + (20) def_attr -> error colon type larrow . expr + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 71 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 59 + + (32) param_list -> error param_list . + + cpar reduce using rule 32 (param_list -> error param_list .) + + +state 60 + + (24) def_func -> error opar formals cpar . colon type ocur expr ccur + + colon shift and go to state 95 + + +state 61 + + (31) param_list -> param comma . param_list + (30) param_list -> . param + (31) param_list -> . param comma param_list + (32) param_list -> . error param_list + (34) param -> . id colon type + + error shift and go to state 42 + id shift and go to state 48 + + param shift and go to state 46 + param_list shift and go to state 96 + +state 62 + + (34) param -> id colon . type + + type shift and go to state 97 + + +state 63 + + (17) def_attr -> id colon type larrow . expr + (22) def_attr -> id colon type larrow . error + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 99 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 98 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 64 + + (21) def_attr -> id colon error larrow . expr + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 100 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 65 + + (23) def_func -> id opar formals cpar . colon type ocur expr ccur + (26) def_func -> id opar formals cpar . colon error ocur expr ccur + (27) def_func -> id opar formals cpar . colon type ocur error ccur + + colon shift and go to state 101 + + +state 66 + + (25) def_func -> id opar error cpar . colon type ocur expr ccur + + colon shift and go to state 102 + + +state 67 + + (7) def_class -> class type inherits type ocur feature_list ccur . semi + + semi shift and go to state 103 + + +state 68 + + (11) def_class -> class type inherits error ocur feature_list ccur . semi + + semi shift and go to state 104 + + +state 69 + + (10) def_class -> class error inherits error ocur feature_list ccur . semi + + semi shift and go to state 105 + + +state 70 + + (9) def_class -> class error inherits type ocur feature_list ccur . semi + + semi shift and go to state 106 + + +state 71 + + (20) def_attr -> error colon type larrow expr . + + semi reduce using rule 20 (def_attr -> error colon type larrow expr .) + + +state 72 + + (35) expr -> let . let_list in expr + (36) expr -> let . error in expr + (37) expr -> let . let_list in error + (50) let_list -> . let_assign + (51) let_list -> . let_assign comma let_list + (52) let_list -> . error let_list + (53) let_assign -> . param larrow expr + (54) let_assign -> . param + (34) param -> . id colon type + + error shift and go to state 108 + id shift and go to state 48 + + let_list shift and go to state 107 + let_assign shift and go to state 109 + param shift and go to state 110 + +state 73 + + (38) expr -> case . expr of cases_list esac + (39) expr -> case . error of cases_list esac + (40) expr -> case . expr of error esac + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 112 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 111 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 74 + + (41) expr -> if . expr then expr else expr fi + (42) expr -> if . error then expr else expr fi + (43) expr -> if . expr then error else expr fi + (44) expr -> if . expr then expr else error fi + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 114 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 113 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 75 + + (45) expr -> while . expr loop expr pool + (46) expr -> while . error loop expr pool + (47) expr -> while . expr loop error pool + (48) expr -> while . expr loop expr error + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 116 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 115 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 76 + + (49) expr -> arith . + + semi reduce using rule 49 (expr -> arith .) + of reduce using rule 49 (expr -> arith .) + then reduce using rule 49 (expr -> arith .) + loop reduce using rule 49 (expr -> arith .) + cpar reduce using rule 49 (expr -> arith .) + comma reduce using rule 49 (expr -> arith .) + in reduce using rule 49 (expr -> arith .) + else reduce using rule 49 (expr -> arith .) + pool reduce using rule 49 (expr -> arith .) + error reduce using rule 49 (expr -> arith .) + ccur reduce using rule 49 (expr -> arith .) + fi reduce using rule 49 (expr -> arith .) + + +state 77 + + (59) arith -> id . larrow expr + (81) atom -> id . + (92) func_call -> id . opar args cpar + + larrow shift and go to state 117 + arroba reduce using rule 81 (atom -> id .) + dot reduce using rule 81 (atom -> id .) + star reduce using rule 81 (atom -> id .) + div reduce using rule 81 (atom -> id .) + plus reduce using rule 81 (atom -> id .) + minus reduce using rule 81 (atom -> id .) + less reduce using rule 81 (atom -> id .) + lesseq reduce using rule 81 (atom -> id .) + equal reduce using rule 81 (atom -> id .) + semi reduce using rule 81 (atom -> id .) + of reduce using rule 81 (atom -> id .) + then reduce using rule 81 (atom -> id .) + loop reduce using rule 81 (atom -> id .) + cpar reduce using rule 81 (atom -> id .) + comma reduce using rule 81 (atom -> id .) + in reduce using rule 81 (atom -> id .) + else reduce using rule 81 (atom -> id .) + pool reduce using rule 81 (atom -> id .) + error reduce using rule 81 (atom -> id .) + ccur reduce using rule 81 (atom -> id .) + fi reduce using rule 81 (atom -> id .) + opar shift and go to state 118 + + +state 78 + + (60) arith -> not . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + comp shift and go to state 119 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 79 + + (61) arith -> comp . + (62) comp -> comp . less op + (63) comp -> comp . lesseq op + (64) comp -> comp . equal op + + semi reduce using rule 61 (arith -> comp .) + of reduce using rule 61 (arith -> comp .) + then reduce using rule 61 (arith -> comp .) + loop reduce using rule 61 (arith -> comp .) + cpar reduce using rule 61 (arith -> comp .) + comma reduce using rule 61 (arith -> comp .) + in reduce using rule 61 (arith -> comp .) + else reduce using rule 61 (arith -> comp .) + pool reduce using rule 61 (arith -> comp .) + error reduce using rule 61 (arith -> comp .) + ccur reduce using rule 61 (arith -> comp .) + fi reduce using rule 61 (arith -> comp .) + less shift and go to state 121 + lesseq shift and go to state 122 + equal shift and go to state 123 + + +state 80 + + (65) comp -> op . + (66) op -> op . plus term + (67) op -> op . minus term + + less reduce using rule 65 (comp -> op .) + lesseq reduce using rule 65 (comp -> op .) + equal reduce using rule 65 (comp -> op .) + semi reduce using rule 65 (comp -> op .) + of reduce using rule 65 (comp -> op .) + then reduce using rule 65 (comp -> op .) + loop reduce using rule 65 (comp -> op .) + cpar reduce using rule 65 (comp -> op .) + comma reduce using rule 65 (comp -> op .) + in reduce using rule 65 (comp -> op .) + else reduce using rule 65 (comp -> op .) + pool reduce using rule 65 (comp -> op .) + error reduce using rule 65 (comp -> op .) + ccur reduce using rule 65 (comp -> op .) + fi reduce using rule 65 (comp -> op .) + plus shift and go to state 124 + minus shift and go to state 125 + + +state 81 + + (68) op -> term . + (69) term -> term . star base_call + (70) term -> term . div base_call + + plus reduce using rule 68 (op -> term .) + minus reduce using rule 68 (op -> term .) + less reduce using rule 68 (op -> term .) + lesseq reduce using rule 68 (op -> term .) + equal reduce using rule 68 (op -> term .) + semi reduce using rule 68 (op -> term .) + of reduce using rule 68 (op -> term .) + then reduce using rule 68 (op -> term .) + loop reduce using rule 68 (op -> term .) + cpar reduce using rule 68 (op -> term .) + comma reduce using rule 68 (op -> term .) + in reduce using rule 68 (op -> term .) + else reduce using rule 68 (op -> term .) + pool reduce using rule 68 (op -> term .) + error reduce using rule 68 (op -> term .) + ccur reduce using rule 68 (op -> term .) + fi reduce using rule 68 (op -> term .) + star shift and go to state 126 + div shift and go to state 127 + + +state 82 + + (73) term -> base_call . + + star reduce using rule 73 (term -> base_call .) + div reduce using rule 73 (term -> base_call .) + plus reduce using rule 73 (term -> base_call .) + minus reduce using rule 73 (term -> base_call .) + less reduce using rule 73 (term -> base_call .) + lesseq reduce using rule 73 (term -> base_call .) + equal reduce using rule 73 (term -> base_call .) + semi reduce using rule 73 (term -> base_call .) + of reduce using rule 73 (term -> base_call .) + then reduce using rule 73 (term -> base_call .) + loop reduce using rule 73 (term -> base_call .) + cpar reduce using rule 73 (term -> base_call .) + comma reduce using rule 73 (term -> base_call .) + in reduce using rule 73 (term -> base_call .) + else reduce using rule 73 (term -> base_call .) + pool reduce using rule 73 (term -> base_call .) + error reduce using rule 73 (term -> base_call .) + ccur reduce using rule 73 (term -> base_call .) + fi reduce using rule 73 (term -> base_call .) + + +state 83 + + (71) term -> isvoid . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + base_call shift and go to state 128 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 84 + + (72) term -> nox . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + base_call shift and go to state 129 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 85 + + (74) base_call -> factor . arroba type dot func_call + (75) base_call -> factor . + (78) factor -> factor . dot func_call + + arroba shift and go to state 130 + star reduce using rule 75 (base_call -> factor .) + div reduce using rule 75 (base_call -> factor .) + plus reduce using rule 75 (base_call -> factor .) + minus reduce using rule 75 (base_call -> factor .) + less reduce using rule 75 (base_call -> factor .) + lesseq reduce using rule 75 (base_call -> factor .) + equal reduce using rule 75 (base_call -> factor .) + semi reduce using rule 75 (base_call -> factor .) + of reduce using rule 75 (base_call -> factor .) + then reduce using rule 75 (base_call -> factor .) + loop reduce using rule 75 (base_call -> factor .) + cpar reduce using rule 75 (base_call -> factor .) + comma reduce using rule 75 (base_call -> factor .) + in reduce using rule 75 (base_call -> factor .) + else reduce using rule 75 (base_call -> factor .) + pool reduce using rule 75 (base_call -> factor .) + error reduce using rule 75 (base_call -> factor .) + ccur reduce using rule 75 (base_call -> factor .) + fi reduce using rule 75 (base_call -> factor .) + dot shift and go to state 131 + + +state 86 + + (79) factor -> func_call . + + arroba reduce using rule 79 (factor -> func_call .) + dot reduce using rule 79 (factor -> func_call .) + star reduce using rule 79 (factor -> func_call .) + div reduce using rule 79 (factor -> func_call .) + plus reduce using rule 79 (factor -> func_call .) + minus reduce using rule 79 (factor -> func_call .) + less reduce using rule 79 (factor -> func_call .) + lesseq reduce using rule 79 (factor -> func_call .) + equal reduce using rule 79 (factor -> func_call .) + semi reduce using rule 79 (factor -> func_call .) + of reduce using rule 79 (factor -> func_call .) + then reduce using rule 79 (factor -> func_call .) + loop reduce using rule 79 (factor -> func_call .) + cpar reduce using rule 79 (factor -> func_call .) + comma reduce using rule 79 (factor -> func_call .) + in reduce using rule 79 (factor -> func_call .) + else reduce using rule 79 (factor -> func_call .) + pool reduce using rule 79 (factor -> func_call .) + error reduce using rule 79 (factor -> func_call .) + ccur reduce using rule 79 (factor -> func_call .) + fi reduce using rule 79 (factor -> func_call .) + + +state 87 + + (76) factor -> atom . + + arroba reduce using rule 76 (factor -> atom .) + dot reduce using rule 76 (factor -> atom .) + star reduce using rule 76 (factor -> atom .) + div reduce using rule 76 (factor -> atom .) + plus reduce using rule 76 (factor -> atom .) + minus reduce using rule 76 (factor -> atom .) + less reduce using rule 76 (factor -> atom .) + lesseq reduce using rule 76 (factor -> atom .) + equal reduce using rule 76 (factor -> atom .) + semi reduce using rule 76 (factor -> atom .) + of reduce using rule 76 (factor -> atom .) + then reduce using rule 76 (factor -> atom .) + loop reduce using rule 76 (factor -> atom .) + cpar reduce using rule 76 (factor -> atom .) + comma reduce using rule 76 (factor -> atom .) + in reduce using rule 76 (factor -> atom .) + else reduce using rule 76 (factor -> atom .) + pool reduce using rule 76 (factor -> atom .) + error reduce using rule 76 (factor -> atom .) + ccur reduce using rule 76 (factor -> atom .) + fi reduce using rule 76 (factor -> atom .) + + +state 88 + + (77) factor -> opar . expr cpar + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 132 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 89 + + (80) atom -> num . + + arroba reduce using rule 80 (atom -> num .) + dot reduce using rule 80 (atom -> num .) + star reduce using rule 80 (atom -> num .) + div reduce using rule 80 (atom -> num .) + plus reduce using rule 80 (atom -> num .) + minus reduce using rule 80 (atom -> num .) + less reduce using rule 80 (atom -> num .) + lesseq reduce using rule 80 (atom -> num .) + equal reduce using rule 80 (atom -> num .) + semi reduce using rule 80 (atom -> num .) + of reduce using rule 80 (atom -> num .) + then reduce using rule 80 (atom -> num .) + loop reduce using rule 80 (atom -> num .) + cpar reduce using rule 80 (atom -> num .) + comma reduce using rule 80 (atom -> num .) + in reduce using rule 80 (atom -> num .) + else reduce using rule 80 (atom -> num .) + pool reduce using rule 80 (atom -> num .) + error reduce using rule 80 (atom -> num .) + ccur reduce using rule 80 (atom -> num .) + fi reduce using rule 80 (atom -> num .) + + +state 90 + + (82) atom -> new . type + (83) atom -> new . error + + type shift and go to state 133 + error shift and go to state 134 + + +state 91 + + (84) atom -> ocur . block ccur + (88) block -> . expr semi + (89) block -> . expr semi block + (90) block -> . error block + (91) block -> . error + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 137 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + block shift and go to state 135 + expr shift and go to state 136 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 92 + + (85) atom -> true . + + arroba reduce using rule 85 (atom -> true .) + dot reduce using rule 85 (atom -> true .) + star reduce using rule 85 (atom -> true .) + div reduce using rule 85 (atom -> true .) + plus reduce using rule 85 (atom -> true .) + minus reduce using rule 85 (atom -> true .) + less reduce using rule 85 (atom -> true .) + lesseq reduce using rule 85 (atom -> true .) + equal reduce using rule 85 (atom -> true .) + semi reduce using rule 85 (atom -> true .) + of reduce using rule 85 (atom -> true .) + then reduce using rule 85 (atom -> true .) + loop reduce using rule 85 (atom -> true .) + cpar reduce using rule 85 (atom -> true .) + comma reduce using rule 85 (atom -> true .) + in reduce using rule 85 (atom -> true .) + else reduce using rule 85 (atom -> true .) + pool reduce using rule 85 (atom -> true .) + error reduce using rule 85 (atom -> true .) + ccur reduce using rule 85 (atom -> true .) + fi reduce using rule 85 (atom -> true .) + + +state 93 + + (86) atom -> false . + + arroba reduce using rule 86 (atom -> false .) + dot reduce using rule 86 (atom -> false .) + star reduce using rule 86 (atom -> false .) + div reduce using rule 86 (atom -> false .) + plus reduce using rule 86 (atom -> false .) + minus reduce using rule 86 (atom -> false .) + less reduce using rule 86 (atom -> false .) + lesseq reduce using rule 86 (atom -> false .) + equal reduce using rule 86 (atom -> false .) + semi reduce using rule 86 (atom -> false .) + of reduce using rule 86 (atom -> false .) + then reduce using rule 86 (atom -> false .) + loop reduce using rule 86 (atom -> false .) + cpar reduce using rule 86 (atom -> false .) + comma reduce using rule 86 (atom -> false .) + in reduce using rule 86 (atom -> false .) + else reduce using rule 86 (atom -> false .) + pool reduce using rule 86 (atom -> false .) + error reduce using rule 86 (atom -> false .) + ccur reduce using rule 86 (atom -> false .) + fi reduce using rule 86 (atom -> false .) + + +state 94 + + (87) atom -> string . + + arroba reduce using rule 87 (atom -> string .) + dot reduce using rule 87 (atom -> string .) + star reduce using rule 87 (atom -> string .) + div reduce using rule 87 (atom -> string .) + plus reduce using rule 87 (atom -> string .) + minus reduce using rule 87 (atom -> string .) + less reduce using rule 87 (atom -> string .) + lesseq reduce using rule 87 (atom -> string .) + equal reduce using rule 87 (atom -> string .) + semi reduce using rule 87 (atom -> string .) + of reduce using rule 87 (atom -> string .) + then reduce using rule 87 (atom -> string .) + loop reduce using rule 87 (atom -> string .) + cpar reduce using rule 87 (atom -> string .) + comma reduce using rule 87 (atom -> string .) + in reduce using rule 87 (atom -> string .) + else reduce using rule 87 (atom -> string .) + pool reduce using rule 87 (atom -> string .) + error reduce using rule 87 (atom -> string .) + ccur reduce using rule 87 (atom -> string .) + fi reduce using rule 87 (atom -> string .) + + +state 95 + + (24) def_func -> error opar formals cpar colon . type ocur expr ccur + + type shift and go to state 138 + + +state 96 + + (31) param_list -> param comma param_list . + + cpar reduce using rule 31 (param_list -> param comma param_list .) + + +state 97 + + (34) param -> id colon type . + + comma reduce using rule 34 (param -> id colon type .) + cpar reduce using rule 34 (param -> id colon type .) + larrow reduce using rule 34 (param -> id colon type .) + in reduce using rule 34 (param -> id colon type .) + + +state 98 + + (17) def_attr -> id colon type larrow expr . + + semi reduce using rule 17 (def_attr -> id colon type larrow expr .) + + +state 99 + + (22) def_attr -> id colon type larrow error . + + semi reduce using rule 22 (def_attr -> id colon type larrow error .) + + +state 100 + + (21) def_attr -> id colon error larrow expr . + + semi reduce using rule 21 (def_attr -> id colon error larrow expr .) + + +state 101 + + (23) def_func -> id opar formals cpar colon . type ocur expr ccur + (26) def_func -> id opar formals cpar colon . error ocur expr ccur + (27) def_func -> id opar formals cpar colon . type ocur error ccur + + type shift and go to state 139 + error shift and go to state 140 + + +state 102 + + (25) def_func -> id opar error cpar colon . type ocur expr ccur + + type shift and go to state 141 + + +state 103 + + (7) def_class -> class type inherits type ocur feature_list ccur semi . + + error reduce using rule 7 (def_class -> class type inherits type ocur feature_list ccur semi .) + class reduce using rule 7 (def_class -> class type inherits type ocur feature_list ccur semi .) + $end reduce using rule 7 (def_class -> class type inherits type ocur feature_list ccur semi .) + + +state 104 + + (11) def_class -> class type inherits error ocur feature_list ccur semi . + + error reduce using rule 11 (def_class -> class type inherits error ocur feature_list ccur semi .) + class reduce using rule 11 (def_class -> class type inherits error ocur feature_list ccur semi .) + $end reduce using rule 11 (def_class -> class type inherits error ocur feature_list ccur semi .) + + +state 105 + + (10) def_class -> class error inherits error ocur feature_list ccur semi . + + error reduce using rule 10 (def_class -> class error inherits error ocur feature_list ccur semi .) + class reduce using rule 10 (def_class -> class error inherits error ocur feature_list ccur semi .) + $end reduce using rule 10 (def_class -> class error inherits error ocur feature_list ccur semi .) + + +state 106 + + (9) def_class -> class error inherits type ocur feature_list ccur semi . + + error reduce using rule 9 (def_class -> class error inherits type ocur feature_list ccur semi .) + class reduce using rule 9 (def_class -> class error inherits type ocur feature_list ccur semi .) + $end reduce using rule 9 (def_class -> class error inherits type ocur feature_list ccur semi .) + + +state 107 + + (35) expr -> let let_list . in expr + (37) expr -> let let_list . in error + + in shift and go to state 142 + + +state 108 + + (36) expr -> let error . in expr + (52) let_list -> error . let_list + (50) let_list -> . let_assign + (51) let_list -> . let_assign comma let_list + (52) let_list -> . error let_list + (53) let_assign -> . param larrow expr + (54) let_assign -> . param + (34) param -> . id colon type + + in shift and go to state 144 + error shift and go to state 143 + id shift and go to state 48 + + let_list shift and go to state 145 + let_assign shift and go to state 109 + param shift and go to state 110 + +state 109 + + (50) let_list -> let_assign . + (51) let_list -> let_assign . comma let_list + + in reduce using rule 50 (let_list -> let_assign .) + comma shift and go to state 146 + + +state 110 + + (53) let_assign -> param . larrow expr + (54) let_assign -> param . + + larrow shift and go to state 147 + comma reduce using rule 54 (let_assign -> param .) + in reduce using rule 54 (let_assign -> param .) + + +state 111 + + (38) expr -> case expr . of cases_list esac + (40) expr -> case expr . of error esac + + of shift and go to state 148 + + +state 112 + + (39) expr -> case error . of cases_list esac + + of shift and go to state 149 + + +state 113 + + (41) expr -> if expr . then expr else expr fi + (43) expr -> if expr . then error else expr fi + (44) expr -> if expr . then expr else error fi + + then shift and go to state 150 + + +state 114 + + (42) expr -> if error . then expr else expr fi + + then shift and go to state 151 + + +state 115 + + (45) expr -> while expr . loop expr pool + (47) expr -> while expr . loop error pool + (48) expr -> while expr . loop expr error + + loop shift and go to state 152 + + +state 116 + + (46) expr -> while error . loop expr pool + + loop shift and go to state 153 + + +state 117 + + (59) arith -> id larrow . expr + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 154 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 118 + + (92) func_call -> id opar . args cpar + (93) args -> . arg_list + (94) args -> . arg_list_empty + (95) arg_list -> . expr + (96) arg_list -> . expr comma arg_list + (97) arg_list -> . error arg_list + (98) arg_list_empty -> . epsilon + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (2) epsilon -> . + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 159 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + cpar reduce using rule 2 (epsilon -> .) + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + args shift and go to state 155 + arg_list shift and go to state 156 + arg_list_empty shift and go to state 157 + expr shift and go to state 158 + epsilon shift and go to state 160 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 119 + + (60) arith -> not comp . + (62) comp -> comp . less op + (63) comp -> comp . lesseq op + (64) comp -> comp . equal op + + semi reduce using rule 60 (arith -> not comp .) + of reduce using rule 60 (arith -> not comp .) + then reduce using rule 60 (arith -> not comp .) + loop reduce using rule 60 (arith -> not comp .) + cpar reduce using rule 60 (arith -> not comp .) + comma reduce using rule 60 (arith -> not comp .) + in reduce using rule 60 (arith -> not comp .) + else reduce using rule 60 (arith -> not comp .) + pool reduce using rule 60 (arith -> not comp .) + error reduce using rule 60 (arith -> not comp .) + ccur reduce using rule 60 (arith -> not comp .) + fi reduce using rule 60 (arith -> not comp .) + less shift and go to state 121 + lesseq shift and go to state 122 + equal shift and go to state 123 + + +state 120 + + (81) atom -> id . + (92) func_call -> id . opar args cpar + + arroba reduce using rule 81 (atom -> id .) + dot reduce using rule 81 (atom -> id .) + star reduce using rule 81 (atom -> id .) + div reduce using rule 81 (atom -> id .) + plus reduce using rule 81 (atom -> id .) + minus reduce using rule 81 (atom -> id .) + less reduce using rule 81 (atom -> id .) + lesseq reduce using rule 81 (atom -> id .) + equal reduce using rule 81 (atom -> id .) + semi reduce using rule 81 (atom -> id .) + of reduce using rule 81 (atom -> id .) + then reduce using rule 81 (atom -> id .) + loop reduce using rule 81 (atom -> id .) + cpar reduce using rule 81 (atom -> id .) + comma reduce using rule 81 (atom -> id .) + in reduce using rule 81 (atom -> id .) + else reduce using rule 81 (atom -> id .) + pool reduce using rule 81 (atom -> id .) + error reduce using rule 81 (atom -> id .) + ccur reduce using rule 81 (atom -> id .) + fi reduce using rule 81 (atom -> id .) + opar shift and go to state 118 + + +state 121 + + (62) comp -> comp less . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + op shift and go to state 161 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 122 + + (63) comp -> comp lesseq . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + op shift and go to state 162 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 123 + + (64) comp -> comp equal . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + op shift and go to state 163 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 124 + + (66) op -> op plus . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + term shift and go to state 164 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 125 + + (67) op -> op minus . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + term shift and go to state 165 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 126 + + (69) term -> term star . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + base_call shift and go to state 166 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 127 + + (70) term -> term div . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + opar shift and go to state 88 + num shift and go to state 89 + id shift and go to state 120 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + base_call shift and go to state 167 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 128 + + (71) term -> isvoid base_call . + + star reduce using rule 71 (term -> isvoid base_call .) + div reduce using rule 71 (term -> isvoid base_call .) + plus reduce using rule 71 (term -> isvoid base_call .) + minus reduce using rule 71 (term -> isvoid base_call .) + less reduce using rule 71 (term -> isvoid base_call .) + lesseq reduce using rule 71 (term -> isvoid base_call .) + equal reduce using rule 71 (term -> isvoid base_call .) + semi reduce using rule 71 (term -> isvoid base_call .) + of reduce using rule 71 (term -> isvoid base_call .) + then reduce using rule 71 (term -> isvoid base_call .) + loop reduce using rule 71 (term -> isvoid base_call .) + cpar reduce using rule 71 (term -> isvoid base_call .) + comma reduce using rule 71 (term -> isvoid base_call .) + in reduce using rule 71 (term -> isvoid base_call .) + else reduce using rule 71 (term -> isvoid base_call .) + pool reduce using rule 71 (term -> isvoid base_call .) + error reduce using rule 71 (term -> isvoid base_call .) + ccur reduce using rule 71 (term -> isvoid base_call .) + fi reduce using rule 71 (term -> isvoid base_call .) + + +state 129 + + (72) term -> nox base_call . + + star reduce using rule 72 (term -> nox base_call .) + div reduce using rule 72 (term -> nox base_call .) + plus reduce using rule 72 (term -> nox base_call .) + minus reduce using rule 72 (term -> nox base_call .) + less reduce using rule 72 (term -> nox base_call .) + lesseq reduce using rule 72 (term -> nox base_call .) + equal reduce using rule 72 (term -> nox base_call .) + semi reduce using rule 72 (term -> nox base_call .) + of reduce using rule 72 (term -> nox base_call .) + then reduce using rule 72 (term -> nox base_call .) + loop reduce using rule 72 (term -> nox base_call .) + cpar reduce using rule 72 (term -> nox base_call .) + comma reduce using rule 72 (term -> nox base_call .) + in reduce using rule 72 (term -> nox base_call .) + else reduce using rule 72 (term -> nox base_call .) + pool reduce using rule 72 (term -> nox base_call .) + error reduce using rule 72 (term -> nox base_call .) + ccur reduce using rule 72 (term -> nox base_call .) + fi reduce using rule 72 (term -> nox base_call .) + + +state 130 + + (74) base_call -> factor arroba . type dot func_call + + type shift and go to state 168 + + +state 131 + + (78) factor -> factor dot . func_call + (92) func_call -> . id opar args cpar + + id shift and go to state 170 + + func_call shift and go to state 169 + +state 132 + + (77) factor -> opar expr . cpar + + cpar shift and go to state 171 + + +state 133 + + (82) atom -> new type . + + arroba reduce using rule 82 (atom -> new type .) + dot reduce using rule 82 (atom -> new type .) + star reduce using rule 82 (atom -> new type .) + div reduce using rule 82 (atom -> new type .) + plus reduce using rule 82 (atom -> new type .) + minus reduce using rule 82 (atom -> new type .) + less reduce using rule 82 (atom -> new type .) + lesseq reduce using rule 82 (atom -> new type .) + equal reduce using rule 82 (atom -> new type .) + semi reduce using rule 82 (atom -> new type .) + of reduce using rule 82 (atom -> new type .) + then reduce using rule 82 (atom -> new type .) + loop reduce using rule 82 (atom -> new type .) + cpar reduce using rule 82 (atom -> new type .) + comma reduce using rule 82 (atom -> new type .) + in reduce using rule 82 (atom -> new type .) + else reduce using rule 82 (atom -> new type .) + pool reduce using rule 82 (atom -> new type .) + error reduce using rule 82 (atom -> new type .) + ccur reduce using rule 82 (atom -> new type .) + fi reduce using rule 82 (atom -> new type .) + + +state 134 + + (83) atom -> new error . + + arroba reduce using rule 83 (atom -> new error .) + dot reduce using rule 83 (atom -> new error .) + star reduce using rule 83 (atom -> new error .) + div reduce using rule 83 (atom -> new error .) + plus reduce using rule 83 (atom -> new error .) + minus reduce using rule 83 (atom -> new error .) + less reduce using rule 83 (atom -> new error .) + lesseq reduce using rule 83 (atom -> new error .) + equal reduce using rule 83 (atom -> new error .) + semi reduce using rule 83 (atom -> new error .) + of reduce using rule 83 (atom -> new error .) + then reduce using rule 83 (atom -> new error .) + loop reduce using rule 83 (atom -> new error .) + cpar reduce using rule 83 (atom -> new error .) + comma reduce using rule 83 (atom -> new error .) + in reduce using rule 83 (atom -> new error .) + else reduce using rule 83 (atom -> new error .) + pool reduce using rule 83 (atom -> new error .) + error reduce using rule 83 (atom -> new error .) + ccur reduce using rule 83 (atom -> new error .) + fi reduce using rule 83 (atom -> new error .) + + +state 135 + + (84) atom -> ocur block . ccur + + ccur shift and go to state 172 + + +state 136 + + (88) block -> expr . semi + (89) block -> expr . semi block + + semi shift and go to state 173 + + +state 137 + + (90) block -> error . block + (91) block -> error . + (88) block -> . expr semi + (89) block -> . expr semi block + (90) block -> . error block + (91) block -> . error + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + ccur reduce using rule 91 (block -> error .) + error shift and go to state 137 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + block shift and go to state 174 + expr shift and go to state 136 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 138 + + (24) def_func -> error opar formals cpar colon type . ocur expr ccur + + ocur shift and go to state 175 + + +state 139 + + (23) def_func -> id opar formals cpar colon type . ocur expr ccur + (27) def_func -> id opar formals cpar colon type . ocur error ccur + + ocur shift and go to state 176 + + +state 140 + + (26) def_func -> id opar formals cpar colon error . ocur expr ccur + + ocur shift and go to state 177 + + +state 141 + + (25) def_func -> id opar error cpar colon type . ocur expr ccur + + ocur shift and go to state 178 + + +state 142 + + (35) expr -> let let_list in . expr + (37) expr -> let let_list in . error + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 180 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 179 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 143 + + (52) let_list -> error . let_list + (50) let_list -> . let_assign + (51) let_list -> . let_assign comma let_list + (52) let_list -> . error let_list + (53) let_assign -> . param larrow expr + (54) let_assign -> . param + (34) param -> . id colon type + + error shift and go to state 143 + id shift and go to state 48 + + let_list shift and go to state 145 + let_assign shift and go to state 109 + param shift and go to state 110 + +state 144 + + (36) expr -> let error in . expr + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 181 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 145 + + (52) let_list -> error let_list . + + in reduce using rule 52 (let_list -> error let_list .) + + +state 146 + + (51) let_list -> let_assign comma . let_list + (50) let_list -> . let_assign + (51) let_list -> . let_assign comma let_list + (52) let_list -> . error let_list + (53) let_assign -> . param larrow expr + (54) let_assign -> . param + (34) param -> . id colon type + + error shift and go to state 143 + id shift and go to state 48 + + let_assign shift and go to state 109 + let_list shift and go to state 182 + param shift and go to state 110 + +state 147 + + (53) let_assign -> param larrow . expr + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 183 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 148 + + (38) expr -> case expr of . cases_list esac + (40) expr -> case expr of . error esac + (55) cases_list -> . casep semi + (56) cases_list -> . casep semi cases_list + (57) cases_list -> . error cases_list + (58) casep -> . id colon type rarrow expr + + error shift and go to state 185 + id shift and go to state 187 + + cases_list shift and go to state 184 + casep shift and go to state 186 + +state 149 + + (39) expr -> case error of . cases_list esac + (55) cases_list -> . casep semi + (56) cases_list -> . casep semi cases_list + (57) cases_list -> . error cases_list + (58) casep -> . id colon type rarrow expr + + error shift and go to state 188 + id shift and go to state 187 + + cases_list shift and go to state 189 + casep shift and go to state 186 + +state 150 + + (41) expr -> if expr then . expr else expr fi + (43) expr -> if expr then . error else expr fi + (44) expr -> if expr then . expr else error fi + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 191 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 190 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 151 + + (42) expr -> if error then . expr else expr fi + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 192 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 152 + + (45) expr -> while expr loop . expr pool + (47) expr -> while expr loop . error pool + (48) expr -> while expr loop . expr error + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 194 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 193 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 153 + + (46) expr -> while error loop . expr pool + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 195 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 154 + + (59) arith -> id larrow expr . + + semi reduce using rule 59 (arith -> id larrow expr .) + of reduce using rule 59 (arith -> id larrow expr .) + then reduce using rule 59 (arith -> id larrow expr .) + loop reduce using rule 59 (arith -> id larrow expr .) + cpar reduce using rule 59 (arith -> id larrow expr .) + comma reduce using rule 59 (arith -> id larrow expr .) + in reduce using rule 59 (arith -> id larrow expr .) + else reduce using rule 59 (arith -> id larrow expr .) + pool reduce using rule 59 (arith -> id larrow expr .) + error reduce using rule 59 (arith -> id larrow expr .) + ccur reduce using rule 59 (arith -> id larrow expr .) + fi reduce using rule 59 (arith -> id larrow expr .) + + +state 155 + + (92) func_call -> id opar args . cpar + + cpar shift and go to state 196 + + +state 156 + + (93) args -> arg_list . + + cpar reduce using rule 93 (args -> arg_list .) + + +state 157 + + (94) args -> arg_list_empty . + + cpar reduce using rule 94 (args -> arg_list_empty .) + + +state 158 + + (95) arg_list -> expr . + (96) arg_list -> expr . comma arg_list + + cpar reduce using rule 95 (arg_list -> expr .) + comma shift and go to state 197 + + +state 159 + + (97) arg_list -> error . arg_list + (95) arg_list -> . expr + (96) arg_list -> . expr comma arg_list + (97) arg_list -> . error arg_list + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 159 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + arg_list shift and go to state 198 + expr shift and go to state 158 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 160 + + (98) arg_list_empty -> epsilon . + + cpar reduce using rule 98 (arg_list_empty -> epsilon .) + + +state 161 + + (62) comp -> comp less op . + (66) op -> op . plus term + (67) op -> op . minus term + + less reduce using rule 62 (comp -> comp less op .) + lesseq reduce using rule 62 (comp -> comp less op .) + equal reduce using rule 62 (comp -> comp less op .) + semi reduce using rule 62 (comp -> comp less op .) + of reduce using rule 62 (comp -> comp less op .) + then reduce using rule 62 (comp -> comp less op .) + loop reduce using rule 62 (comp -> comp less op .) + cpar reduce using rule 62 (comp -> comp less op .) + comma reduce using rule 62 (comp -> comp less op .) + in reduce using rule 62 (comp -> comp less op .) + else reduce using rule 62 (comp -> comp less op .) + pool reduce using rule 62 (comp -> comp less op .) + error reduce using rule 62 (comp -> comp less op .) + ccur reduce using rule 62 (comp -> comp less op .) + fi reduce using rule 62 (comp -> comp less op .) + plus shift and go to state 124 + minus shift and go to state 125 + + +state 162 + + (63) comp -> comp lesseq op . + (66) op -> op . plus term + (67) op -> op . minus term + + less reduce using rule 63 (comp -> comp lesseq op .) + lesseq reduce using rule 63 (comp -> comp lesseq op .) + equal reduce using rule 63 (comp -> comp lesseq op .) + semi reduce using rule 63 (comp -> comp lesseq op .) + of reduce using rule 63 (comp -> comp lesseq op .) + then reduce using rule 63 (comp -> comp lesseq op .) + loop reduce using rule 63 (comp -> comp lesseq op .) + cpar reduce using rule 63 (comp -> comp lesseq op .) + comma reduce using rule 63 (comp -> comp lesseq op .) + in reduce using rule 63 (comp -> comp lesseq op .) + else reduce using rule 63 (comp -> comp lesseq op .) + pool reduce using rule 63 (comp -> comp lesseq op .) + error reduce using rule 63 (comp -> comp lesseq op .) + ccur reduce using rule 63 (comp -> comp lesseq op .) + fi reduce using rule 63 (comp -> comp lesseq op .) + plus shift and go to state 124 + minus shift and go to state 125 + + +state 163 + + (64) comp -> comp equal op . + (66) op -> op . plus term + (67) op -> op . minus term + + less reduce using rule 64 (comp -> comp equal op .) + lesseq reduce using rule 64 (comp -> comp equal op .) + equal reduce using rule 64 (comp -> comp equal op .) + semi reduce using rule 64 (comp -> comp equal op .) + of reduce using rule 64 (comp -> comp equal op .) + then reduce using rule 64 (comp -> comp equal op .) + loop reduce using rule 64 (comp -> comp equal op .) + cpar reduce using rule 64 (comp -> comp equal op .) + comma reduce using rule 64 (comp -> comp equal op .) + in reduce using rule 64 (comp -> comp equal op .) + else reduce using rule 64 (comp -> comp equal op .) + pool reduce using rule 64 (comp -> comp equal op .) + error reduce using rule 64 (comp -> comp equal op .) + ccur reduce using rule 64 (comp -> comp equal op .) + fi reduce using rule 64 (comp -> comp equal op .) + plus shift and go to state 124 + minus shift and go to state 125 + + +state 164 + + (66) op -> op plus term . + (69) term -> term . star base_call + (70) term -> term . div base_call + + plus reduce using rule 66 (op -> op plus term .) + minus reduce using rule 66 (op -> op plus term .) + less reduce using rule 66 (op -> op plus term .) + lesseq reduce using rule 66 (op -> op plus term .) + equal reduce using rule 66 (op -> op plus term .) + semi reduce using rule 66 (op -> op plus term .) + of reduce using rule 66 (op -> op plus term .) + then reduce using rule 66 (op -> op plus term .) + loop reduce using rule 66 (op -> op plus term .) + cpar reduce using rule 66 (op -> op plus term .) + comma reduce using rule 66 (op -> op plus term .) + in reduce using rule 66 (op -> op plus term .) + else reduce using rule 66 (op -> op plus term .) + pool reduce using rule 66 (op -> op plus term .) + error reduce using rule 66 (op -> op plus term .) + ccur reduce using rule 66 (op -> op plus term .) + fi reduce using rule 66 (op -> op plus term .) + star shift and go to state 126 + div shift and go to state 127 + + +state 165 + + (67) op -> op minus term . + (69) term -> term . star base_call + (70) term -> term . div base_call + + plus reduce using rule 67 (op -> op minus term .) + minus reduce using rule 67 (op -> op minus term .) + less reduce using rule 67 (op -> op minus term .) + lesseq reduce using rule 67 (op -> op minus term .) + equal reduce using rule 67 (op -> op minus term .) + semi reduce using rule 67 (op -> op minus term .) + of reduce using rule 67 (op -> op minus term .) + then reduce using rule 67 (op -> op minus term .) + loop reduce using rule 67 (op -> op minus term .) + cpar reduce using rule 67 (op -> op minus term .) + comma reduce using rule 67 (op -> op minus term .) + in reduce using rule 67 (op -> op minus term .) + else reduce using rule 67 (op -> op minus term .) + pool reduce using rule 67 (op -> op minus term .) + error reduce using rule 67 (op -> op minus term .) + ccur reduce using rule 67 (op -> op minus term .) + fi reduce using rule 67 (op -> op minus term .) + star shift and go to state 126 + div shift and go to state 127 + + +state 166 + + (69) term -> term star base_call . + + star reduce using rule 69 (term -> term star base_call .) + div reduce using rule 69 (term -> term star base_call .) + plus reduce using rule 69 (term -> term star base_call .) + minus reduce using rule 69 (term -> term star base_call .) + less reduce using rule 69 (term -> term star base_call .) + lesseq reduce using rule 69 (term -> term star base_call .) + equal reduce using rule 69 (term -> term star base_call .) + semi reduce using rule 69 (term -> term star base_call .) + of reduce using rule 69 (term -> term star base_call .) + then reduce using rule 69 (term -> term star base_call .) + loop reduce using rule 69 (term -> term star base_call .) + cpar reduce using rule 69 (term -> term star base_call .) + comma reduce using rule 69 (term -> term star base_call .) + in reduce using rule 69 (term -> term star base_call .) + else reduce using rule 69 (term -> term star base_call .) + pool reduce using rule 69 (term -> term star base_call .) + error reduce using rule 69 (term -> term star base_call .) + ccur reduce using rule 69 (term -> term star base_call .) + fi reduce using rule 69 (term -> term star base_call .) + + +state 167 + + (70) term -> term div base_call . + + star reduce using rule 70 (term -> term div base_call .) + div reduce using rule 70 (term -> term div base_call .) + plus reduce using rule 70 (term -> term div base_call .) + minus reduce using rule 70 (term -> term div base_call .) + less reduce using rule 70 (term -> term div base_call .) + lesseq reduce using rule 70 (term -> term div base_call .) + equal reduce using rule 70 (term -> term div base_call .) + semi reduce using rule 70 (term -> term div base_call .) + of reduce using rule 70 (term -> term div base_call .) + then reduce using rule 70 (term -> term div base_call .) + loop reduce using rule 70 (term -> term div base_call .) + cpar reduce using rule 70 (term -> term div base_call .) + comma reduce using rule 70 (term -> term div base_call .) + in reduce using rule 70 (term -> term div base_call .) + else reduce using rule 70 (term -> term div base_call .) + pool reduce using rule 70 (term -> term div base_call .) + error reduce using rule 70 (term -> term div base_call .) + ccur reduce using rule 70 (term -> term div base_call .) + fi reduce using rule 70 (term -> term div base_call .) + + +state 168 + + (74) base_call -> factor arroba type . dot func_call + + dot shift and go to state 199 + + +state 169 + + (78) factor -> factor dot func_call . + + arroba reduce using rule 78 (factor -> factor dot func_call .) + dot reduce using rule 78 (factor -> factor dot func_call .) + star reduce using rule 78 (factor -> factor dot func_call .) + div reduce using rule 78 (factor -> factor dot func_call .) + plus reduce using rule 78 (factor -> factor dot func_call .) + minus reduce using rule 78 (factor -> factor dot func_call .) + less reduce using rule 78 (factor -> factor dot func_call .) + lesseq reduce using rule 78 (factor -> factor dot func_call .) + equal reduce using rule 78 (factor -> factor dot func_call .) + semi reduce using rule 78 (factor -> factor dot func_call .) + of reduce using rule 78 (factor -> factor dot func_call .) + then reduce using rule 78 (factor -> factor dot func_call .) + loop reduce using rule 78 (factor -> factor dot func_call .) + cpar reduce using rule 78 (factor -> factor dot func_call .) + comma reduce using rule 78 (factor -> factor dot func_call .) + in reduce using rule 78 (factor -> factor dot func_call .) + else reduce using rule 78 (factor -> factor dot func_call .) + pool reduce using rule 78 (factor -> factor dot func_call .) + error reduce using rule 78 (factor -> factor dot func_call .) + ccur reduce using rule 78 (factor -> factor dot func_call .) + fi reduce using rule 78 (factor -> factor dot func_call .) + + +state 170 + + (92) func_call -> id . opar args cpar + + opar shift and go to state 118 + + +state 171 + + (77) factor -> opar expr cpar . + + arroba reduce using rule 77 (factor -> opar expr cpar .) + dot reduce using rule 77 (factor -> opar expr cpar .) + star reduce using rule 77 (factor -> opar expr cpar .) + div reduce using rule 77 (factor -> opar expr cpar .) + plus reduce using rule 77 (factor -> opar expr cpar .) + minus reduce using rule 77 (factor -> opar expr cpar .) + less reduce using rule 77 (factor -> opar expr cpar .) + lesseq reduce using rule 77 (factor -> opar expr cpar .) + equal reduce using rule 77 (factor -> opar expr cpar .) + semi reduce using rule 77 (factor -> opar expr cpar .) + of reduce using rule 77 (factor -> opar expr cpar .) + then reduce using rule 77 (factor -> opar expr cpar .) + loop reduce using rule 77 (factor -> opar expr cpar .) + cpar reduce using rule 77 (factor -> opar expr cpar .) + comma reduce using rule 77 (factor -> opar expr cpar .) + in reduce using rule 77 (factor -> opar expr cpar .) + else reduce using rule 77 (factor -> opar expr cpar .) + pool reduce using rule 77 (factor -> opar expr cpar .) + error reduce using rule 77 (factor -> opar expr cpar .) + ccur reduce using rule 77 (factor -> opar expr cpar .) + fi reduce using rule 77 (factor -> opar expr cpar .) + + +state 172 + + (84) atom -> ocur block ccur . + + arroba reduce using rule 84 (atom -> ocur block ccur .) + dot reduce using rule 84 (atom -> ocur block ccur .) + star reduce using rule 84 (atom -> ocur block ccur .) + div reduce using rule 84 (atom -> ocur block ccur .) + plus reduce using rule 84 (atom -> ocur block ccur .) + minus reduce using rule 84 (atom -> ocur block ccur .) + less reduce using rule 84 (atom -> ocur block ccur .) + lesseq reduce using rule 84 (atom -> ocur block ccur .) + equal reduce using rule 84 (atom -> ocur block ccur .) + semi reduce using rule 84 (atom -> ocur block ccur .) + of reduce using rule 84 (atom -> ocur block ccur .) + then reduce using rule 84 (atom -> ocur block ccur .) + loop reduce using rule 84 (atom -> ocur block ccur .) + cpar reduce using rule 84 (atom -> ocur block ccur .) + comma reduce using rule 84 (atom -> ocur block ccur .) + in reduce using rule 84 (atom -> ocur block ccur .) + else reduce using rule 84 (atom -> ocur block ccur .) + pool reduce using rule 84 (atom -> ocur block ccur .) + error reduce using rule 84 (atom -> ocur block ccur .) + ccur reduce using rule 84 (atom -> ocur block ccur .) + fi reduce using rule 84 (atom -> ocur block ccur .) + + +state 173 + + (88) block -> expr semi . + (89) block -> expr semi . block + (88) block -> . expr semi + (89) block -> . expr semi block + (90) block -> . error block + (91) block -> . error + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + ccur reduce using rule 88 (block -> expr semi .) + error shift and go to state 137 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 136 + block shift and go to state 200 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 174 + + (90) block -> error block . + + ccur reduce using rule 90 (block -> error block .) + + +state 175 + + (24) def_func -> error opar formals cpar colon type ocur . expr ccur + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 201 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 176 + + (23) def_func -> id opar formals cpar colon type ocur . expr ccur + (27) def_func -> id opar formals cpar colon type ocur . error ccur + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 203 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 202 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 177 + + (26) def_func -> id opar formals cpar colon error ocur . expr ccur + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 204 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 178 + + (25) def_func -> id opar error cpar colon type ocur . expr ccur + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 205 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 179 + + (35) expr -> let let_list in expr . + + semi reduce using rule 35 (expr -> let let_list in expr .) + of reduce using rule 35 (expr -> let let_list in expr .) + then reduce using rule 35 (expr -> let let_list in expr .) + loop reduce using rule 35 (expr -> let let_list in expr .) + cpar reduce using rule 35 (expr -> let let_list in expr .) + comma reduce using rule 35 (expr -> let let_list in expr .) + in reduce using rule 35 (expr -> let let_list in expr .) + else reduce using rule 35 (expr -> let let_list in expr .) + pool reduce using rule 35 (expr -> let let_list in expr .) + error reduce using rule 35 (expr -> let let_list in expr .) + ccur reduce using rule 35 (expr -> let let_list in expr .) + fi reduce using rule 35 (expr -> let let_list in expr .) + + +state 180 + + (37) expr -> let let_list in error . + + semi reduce using rule 37 (expr -> let let_list in error .) + of reduce using rule 37 (expr -> let let_list in error .) + then reduce using rule 37 (expr -> let let_list in error .) + loop reduce using rule 37 (expr -> let let_list in error .) + cpar reduce using rule 37 (expr -> let let_list in error .) + comma reduce using rule 37 (expr -> let let_list in error .) + in reduce using rule 37 (expr -> let let_list in error .) + else reduce using rule 37 (expr -> let let_list in error .) + pool reduce using rule 37 (expr -> let let_list in error .) + error reduce using rule 37 (expr -> let let_list in error .) + ccur reduce using rule 37 (expr -> let let_list in error .) + fi reduce using rule 37 (expr -> let let_list in error .) + + +state 181 + + (36) expr -> let error in expr . + + semi reduce using rule 36 (expr -> let error in expr .) + of reduce using rule 36 (expr -> let error in expr .) + then reduce using rule 36 (expr -> let error in expr .) + loop reduce using rule 36 (expr -> let error in expr .) + cpar reduce using rule 36 (expr -> let error in expr .) + comma reduce using rule 36 (expr -> let error in expr .) + in reduce using rule 36 (expr -> let error in expr .) + else reduce using rule 36 (expr -> let error in expr .) + pool reduce using rule 36 (expr -> let error in expr .) + error reduce using rule 36 (expr -> let error in expr .) + ccur reduce using rule 36 (expr -> let error in expr .) + fi reduce using rule 36 (expr -> let error in expr .) + + +state 182 + + (51) let_list -> let_assign comma let_list . + + in reduce using rule 51 (let_list -> let_assign comma let_list .) + + +state 183 + + (53) let_assign -> param larrow expr . + + comma reduce using rule 53 (let_assign -> param larrow expr .) + in reduce using rule 53 (let_assign -> param larrow expr .) + + +state 184 + + (38) expr -> case expr of cases_list . esac + + esac shift and go to state 206 + + +state 185 + + (40) expr -> case expr of error . esac + (57) cases_list -> error . cases_list + (55) cases_list -> . casep semi + (56) cases_list -> . casep semi cases_list + (57) cases_list -> . error cases_list + (58) casep -> . id colon type rarrow expr + + esac shift and go to state 207 + error shift and go to state 188 + id shift and go to state 187 + + cases_list shift and go to state 208 + casep shift and go to state 186 + +state 186 + + (55) cases_list -> casep . semi + (56) cases_list -> casep . semi cases_list + + semi shift and go to state 209 + + +state 187 + + (58) casep -> id . colon type rarrow expr + + colon shift and go to state 210 + + +state 188 + + (57) cases_list -> error . cases_list + (55) cases_list -> . casep semi + (56) cases_list -> . casep semi cases_list + (57) cases_list -> . error cases_list + (58) casep -> . id colon type rarrow expr + + error shift and go to state 188 + id shift and go to state 187 + + cases_list shift and go to state 208 + casep shift and go to state 186 + +state 189 + + (39) expr -> case error of cases_list . esac + + esac shift and go to state 211 + + +state 190 + + (41) expr -> if expr then expr . else expr fi + (44) expr -> if expr then expr . else error fi + + else shift and go to state 212 + + +state 191 + + (43) expr -> if expr then error . else expr fi + + else shift and go to state 213 + + +state 192 + + (42) expr -> if error then expr . else expr fi + + else shift and go to state 214 + + +state 193 + + (45) expr -> while expr loop expr . pool + (48) expr -> while expr loop expr . error + + pool shift and go to state 215 + error shift and go to state 216 + + +state 194 + + (47) expr -> while expr loop error . pool + + pool shift and go to state 217 + + +state 195 + + (46) expr -> while error loop expr . pool + + pool shift and go to state 218 + + +state 196 + + (92) func_call -> id opar args cpar . + + arroba reduce using rule 92 (func_call -> id opar args cpar .) + dot reduce using rule 92 (func_call -> id opar args cpar .) + star reduce using rule 92 (func_call -> id opar args cpar .) + div reduce using rule 92 (func_call -> id opar args cpar .) + plus reduce using rule 92 (func_call -> id opar args cpar .) + minus reduce using rule 92 (func_call -> id opar args cpar .) + less reduce using rule 92 (func_call -> id opar args cpar .) + lesseq reduce using rule 92 (func_call -> id opar args cpar .) + equal reduce using rule 92 (func_call -> id opar args cpar .) + semi reduce using rule 92 (func_call -> id opar args cpar .) + of reduce using rule 92 (func_call -> id opar args cpar .) + then reduce using rule 92 (func_call -> id opar args cpar .) + loop reduce using rule 92 (func_call -> id opar args cpar .) + cpar reduce using rule 92 (func_call -> id opar args cpar .) + comma reduce using rule 92 (func_call -> id opar args cpar .) + in reduce using rule 92 (func_call -> id opar args cpar .) + else reduce using rule 92 (func_call -> id opar args cpar .) + pool reduce using rule 92 (func_call -> id opar args cpar .) + error reduce using rule 92 (func_call -> id opar args cpar .) + ccur reduce using rule 92 (func_call -> id opar args cpar .) + fi reduce using rule 92 (func_call -> id opar args cpar .) + + +state 197 + + (96) arg_list -> expr comma . arg_list + (95) arg_list -> . expr + (96) arg_list -> . expr comma arg_list + (97) arg_list -> . error arg_list + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 159 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 158 + arg_list shift and go to state 219 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 198 + + (97) arg_list -> error arg_list . + + cpar reduce using rule 97 (arg_list -> error arg_list .) + + +state 199 + + (74) base_call -> factor arroba type dot . func_call + (92) func_call -> . id opar args cpar + + id shift and go to state 170 + + func_call shift and go to state 220 + +state 200 + + (89) block -> expr semi block . + + ccur reduce using rule 89 (block -> expr semi block .) + + +state 201 + + (24) def_func -> error opar formals cpar colon type ocur expr . ccur + + ccur shift and go to state 221 + + +state 202 + + (23) def_func -> id opar formals cpar colon type ocur expr . ccur + + ccur shift and go to state 222 + + +state 203 + + (27) def_func -> id opar formals cpar colon type ocur error . ccur + + ccur shift and go to state 223 + + +state 204 + + (26) def_func -> id opar formals cpar colon error ocur expr . ccur + + ccur shift and go to state 224 + + +state 205 + + (25) def_func -> id opar error cpar colon type ocur expr . ccur + + ccur shift and go to state 225 + + +state 206 + + (38) expr -> case expr of cases_list esac . + + semi reduce using rule 38 (expr -> case expr of cases_list esac .) + of reduce using rule 38 (expr -> case expr of cases_list esac .) + then reduce using rule 38 (expr -> case expr of cases_list esac .) + loop reduce using rule 38 (expr -> case expr of cases_list esac .) + cpar reduce using rule 38 (expr -> case expr of cases_list esac .) + comma reduce using rule 38 (expr -> case expr of cases_list esac .) + in reduce using rule 38 (expr -> case expr of cases_list esac .) + else reduce using rule 38 (expr -> case expr of cases_list esac .) + pool reduce using rule 38 (expr -> case expr of cases_list esac .) + error reduce using rule 38 (expr -> case expr of cases_list esac .) + ccur reduce using rule 38 (expr -> case expr of cases_list esac .) + fi reduce using rule 38 (expr -> case expr of cases_list esac .) + + +state 207 + + (40) expr -> case expr of error esac . + + semi reduce using rule 40 (expr -> case expr of error esac .) + of reduce using rule 40 (expr -> case expr of error esac .) + then reduce using rule 40 (expr -> case expr of error esac .) + loop reduce using rule 40 (expr -> case expr of error esac .) + cpar reduce using rule 40 (expr -> case expr of error esac .) + comma reduce using rule 40 (expr -> case expr of error esac .) + in reduce using rule 40 (expr -> case expr of error esac .) + else reduce using rule 40 (expr -> case expr of error esac .) + pool reduce using rule 40 (expr -> case expr of error esac .) + error reduce using rule 40 (expr -> case expr of error esac .) + ccur reduce using rule 40 (expr -> case expr of error esac .) + fi reduce using rule 40 (expr -> case expr of error esac .) + + +state 208 + + (57) cases_list -> error cases_list . + + esac reduce using rule 57 (cases_list -> error cases_list .) + + +state 209 + + (55) cases_list -> casep semi . + (56) cases_list -> casep semi . cases_list + (55) cases_list -> . casep semi + (56) cases_list -> . casep semi cases_list + (57) cases_list -> . error cases_list + (58) casep -> . id colon type rarrow expr + + esac reduce using rule 55 (cases_list -> casep semi .) + error shift and go to state 188 + id shift and go to state 187 + + casep shift and go to state 186 + cases_list shift and go to state 226 + +state 210 + + (58) casep -> id colon . type rarrow expr + + type shift and go to state 227 + + +state 211 + + (39) expr -> case error of cases_list esac . + + semi reduce using rule 39 (expr -> case error of cases_list esac .) + of reduce using rule 39 (expr -> case error of cases_list esac .) + then reduce using rule 39 (expr -> case error of cases_list esac .) + loop reduce using rule 39 (expr -> case error of cases_list esac .) + cpar reduce using rule 39 (expr -> case error of cases_list esac .) + comma reduce using rule 39 (expr -> case error of cases_list esac .) + in reduce using rule 39 (expr -> case error of cases_list esac .) + else reduce using rule 39 (expr -> case error of cases_list esac .) + pool reduce using rule 39 (expr -> case error of cases_list esac .) + error reduce using rule 39 (expr -> case error of cases_list esac .) + ccur reduce using rule 39 (expr -> case error of cases_list esac .) + fi reduce using rule 39 (expr -> case error of cases_list esac .) + + +state 212 + + (41) expr -> if expr then expr else . expr fi + (44) expr -> if expr then expr else . error fi + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + error shift and go to state 229 + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 228 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 213 + + (43) expr -> if expr then error else . expr fi + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 230 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 214 + + (42) expr -> if error then expr else . expr fi + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 231 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 215 + + (45) expr -> while expr loop expr pool . + + semi reduce using rule 45 (expr -> while expr loop expr pool .) + of reduce using rule 45 (expr -> while expr loop expr pool .) + then reduce using rule 45 (expr -> while expr loop expr pool .) + loop reduce using rule 45 (expr -> while expr loop expr pool .) + cpar reduce using rule 45 (expr -> while expr loop expr pool .) + comma reduce using rule 45 (expr -> while expr loop expr pool .) + in reduce using rule 45 (expr -> while expr loop expr pool .) + else reduce using rule 45 (expr -> while expr loop expr pool .) + pool reduce using rule 45 (expr -> while expr loop expr pool .) + error reduce using rule 45 (expr -> while expr loop expr pool .) + ccur reduce using rule 45 (expr -> while expr loop expr pool .) + fi reduce using rule 45 (expr -> while expr loop expr pool .) + + +state 216 + + (48) expr -> while expr loop expr error . + + semi reduce using rule 48 (expr -> while expr loop expr error .) + of reduce using rule 48 (expr -> while expr loop expr error .) + then reduce using rule 48 (expr -> while expr loop expr error .) + loop reduce using rule 48 (expr -> while expr loop expr error .) + cpar reduce using rule 48 (expr -> while expr loop expr error .) + comma reduce using rule 48 (expr -> while expr loop expr error .) + in reduce using rule 48 (expr -> while expr loop expr error .) + else reduce using rule 48 (expr -> while expr loop expr error .) + pool reduce using rule 48 (expr -> while expr loop expr error .) + error reduce using rule 48 (expr -> while expr loop expr error .) + ccur reduce using rule 48 (expr -> while expr loop expr error .) + fi reduce using rule 48 (expr -> while expr loop expr error .) + + +state 217 + + (47) expr -> while expr loop error pool . + + semi reduce using rule 47 (expr -> while expr loop error pool .) + of reduce using rule 47 (expr -> while expr loop error pool .) + then reduce using rule 47 (expr -> while expr loop error pool .) + loop reduce using rule 47 (expr -> while expr loop error pool .) + cpar reduce using rule 47 (expr -> while expr loop error pool .) + comma reduce using rule 47 (expr -> while expr loop error pool .) + in reduce using rule 47 (expr -> while expr loop error pool .) + else reduce using rule 47 (expr -> while expr loop error pool .) + pool reduce using rule 47 (expr -> while expr loop error pool .) + error reduce using rule 47 (expr -> while expr loop error pool .) + ccur reduce using rule 47 (expr -> while expr loop error pool .) + fi reduce using rule 47 (expr -> while expr loop error pool .) + + +state 218 + + (46) expr -> while error loop expr pool . + + semi reduce using rule 46 (expr -> while error loop expr pool .) + of reduce using rule 46 (expr -> while error loop expr pool .) + then reduce using rule 46 (expr -> while error loop expr pool .) + loop reduce using rule 46 (expr -> while error loop expr pool .) + cpar reduce using rule 46 (expr -> while error loop expr pool .) + comma reduce using rule 46 (expr -> while error loop expr pool .) + in reduce using rule 46 (expr -> while error loop expr pool .) + else reduce using rule 46 (expr -> while error loop expr pool .) + pool reduce using rule 46 (expr -> while error loop expr pool .) + error reduce using rule 46 (expr -> while error loop expr pool .) + ccur reduce using rule 46 (expr -> while error loop expr pool .) + fi reduce using rule 46 (expr -> while error loop expr pool .) + + +state 219 + + (96) arg_list -> expr comma arg_list . + + cpar reduce using rule 96 (arg_list -> expr comma arg_list .) + + +state 220 + + (74) base_call -> factor arroba type dot func_call . + + star reduce using rule 74 (base_call -> factor arroba type dot func_call .) + div reduce using rule 74 (base_call -> factor arroba type dot func_call .) + plus reduce using rule 74 (base_call -> factor arroba type dot func_call .) + minus reduce using rule 74 (base_call -> factor arroba type dot func_call .) + less reduce using rule 74 (base_call -> factor arroba type dot func_call .) + lesseq reduce using rule 74 (base_call -> factor arroba type dot func_call .) + equal reduce using rule 74 (base_call -> factor arroba type dot func_call .) + semi reduce using rule 74 (base_call -> factor arroba type dot func_call .) + of reduce using rule 74 (base_call -> factor arroba type dot func_call .) + then reduce using rule 74 (base_call -> factor arroba type dot func_call .) + loop reduce using rule 74 (base_call -> factor arroba type dot func_call .) + cpar reduce using rule 74 (base_call -> factor arroba type dot func_call .) + comma reduce using rule 74 (base_call -> factor arroba type dot func_call .) + in reduce using rule 74 (base_call -> factor arroba type dot func_call .) + else reduce using rule 74 (base_call -> factor arroba type dot func_call .) + pool reduce using rule 74 (base_call -> factor arroba type dot func_call .) + error reduce using rule 74 (base_call -> factor arroba type dot func_call .) + ccur reduce using rule 74 (base_call -> factor arroba type dot func_call .) + fi reduce using rule 74 (base_call -> factor arroba type dot func_call .) + + +state 221 + + (24) def_func -> error opar formals cpar colon type ocur expr ccur . + + semi reduce using rule 24 (def_func -> error opar formals cpar colon type ocur expr ccur .) + + +state 222 + + (23) def_func -> id opar formals cpar colon type ocur expr ccur . + + semi reduce using rule 23 (def_func -> id opar formals cpar colon type ocur expr ccur .) + + +state 223 + + (27) def_func -> id opar formals cpar colon type ocur error ccur . + + semi reduce using rule 27 (def_func -> id opar formals cpar colon type ocur error ccur .) + + +state 224 + + (26) def_func -> id opar formals cpar colon error ocur expr ccur . + + semi reduce using rule 26 (def_func -> id opar formals cpar colon error ocur expr ccur .) + + +state 225 + + (25) def_func -> id opar error cpar colon type ocur expr ccur . + + semi reduce using rule 25 (def_func -> id opar error cpar colon type ocur expr ccur .) + + +state 226 + + (56) cases_list -> casep semi cases_list . + + esac reduce using rule 56 (cases_list -> casep semi cases_list .) + + +state 227 + + (58) casep -> id colon type . rarrow expr + + rarrow shift and go to state 232 + + +state 228 + + (41) expr -> if expr then expr else expr . fi + + fi shift and go to state 233 + + +state 229 + + (44) expr -> if expr then expr else error . fi + + fi shift and go to state 234 + + +state 230 + + (43) expr -> if expr then error else expr . fi + + fi shift and go to state 235 + + +state 231 + + (42) expr -> if error then expr else expr . fi + + fi shift and go to state 236 + + +state 232 + + (58) casep -> id colon type rarrow . expr + (35) expr -> . let let_list in expr + (36) expr -> . let error in expr + (37) expr -> . let let_list in error + (38) expr -> . case expr of cases_list esac + (39) expr -> . case error of cases_list esac + (40) expr -> . case expr of error esac + (41) expr -> . if expr then expr else expr fi + (42) expr -> . if error then expr else expr fi + (43) expr -> . if expr then error else expr fi + (44) expr -> . if expr then expr else error fi + (45) expr -> . while expr loop expr pool + (46) expr -> . while error loop expr pool + (47) expr -> . while expr loop error pool + (48) expr -> . while expr loop expr error + (49) expr -> . arith + (59) arith -> . id larrow expr + (60) arith -> . not comp + (61) arith -> . comp + (62) comp -> . comp less op + (63) comp -> . comp lesseq op + (64) comp -> . comp equal op + (65) comp -> . op + (66) op -> . op plus term + (67) op -> . op minus term + (68) op -> . term + (69) term -> . term star base_call + (70) term -> . term div base_call + (71) term -> . isvoid base_call + (72) term -> . nox base_call + (73) term -> . base_call + (74) base_call -> . factor arroba type dot func_call + (75) base_call -> . factor + (76) factor -> . atom + (77) factor -> . opar expr cpar + (78) factor -> . factor dot func_call + (79) factor -> . func_call + (80) atom -> . num + (81) atom -> . id + (82) atom -> . new type + (83) atom -> . new error + (84) atom -> . ocur block ccur + (85) atom -> . true + (86) atom -> . false + (87) atom -> . string + (92) func_call -> . id opar args cpar + + let shift and go to state 72 + case shift and go to state 73 + if shift and go to state 74 + while shift and go to state 75 + id shift and go to state 77 + not shift and go to state 78 + isvoid shift and go to state 83 + nox shift and go to state 84 + opar shift and go to state 88 + num shift and go to state 89 + new shift and go to state 90 + ocur shift and go to state 91 + true shift and go to state 92 + false shift and go to state 93 + string shift and go to state 94 + + expr shift and go to state 237 + arith shift and go to state 76 + comp shift and go to state 79 + op shift and go to state 80 + term shift and go to state 81 + base_call shift and go to state 82 + factor shift and go to state 85 + func_call shift and go to state 86 + atom shift and go to state 87 + +state 233 + + (41) expr -> if expr then expr else expr fi . + + semi reduce using rule 41 (expr -> if expr then expr else expr fi .) + of reduce using rule 41 (expr -> if expr then expr else expr fi .) + then reduce using rule 41 (expr -> if expr then expr else expr fi .) + loop reduce using rule 41 (expr -> if expr then expr else expr fi .) + cpar reduce using rule 41 (expr -> if expr then expr else expr fi .) + comma reduce using rule 41 (expr -> if expr then expr else expr fi .) + in reduce using rule 41 (expr -> if expr then expr else expr fi .) + else reduce using rule 41 (expr -> if expr then expr else expr fi .) + pool reduce using rule 41 (expr -> if expr then expr else expr fi .) + error reduce using rule 41 (expr -> if expr then expr else expr fi .) + ccur reduce using rule 41 (expr -> if expr then expr else expr fi .) + fi reduce using rule 41 (expr -> if expr then expr else expr fi .) + + +state 234 + + (44) expr -> if expr then expr else error fi . + + semi reduce using rule 44 (expr -> if expr then expr else error fi .) + of reduce using rule 44 (expr -> if expr then expr else error fi .) + then reduce using rule 44 (expr -> if expr then expr else error fi .) + loop reduce using rule 44 (expr -> if expr then expr else error fi .) + cpar reduce using rule 44 (expr -> if expr then expr else error fi .) + comma reduce using rule 44 (expr -> if expr then expr else error fi .) + in reduce using rule 44 (expr -> if expr then expr else error fi .) + else reduce using rule 44 (expr -> if expr then expr else error fi .) + pool reduce using rule 44 (expr -> if expr then expr else error fi .) + error reduce using rule 44 (expr -> if expr then expr else error fi .) + ccur reduce using rule 44 (expr -> if expr then expr else error fi .) + fi reduce using rule 44 (expr -> if expr then expr else error fi .) + + +state 235 + + (43) expr -> if expr then error else expr fi . + + semi reduce using rule 43 (expr -> if expr then error else expr fi .) + of reduce using rule 43 (expr -> if expr then error else expr fi .) + then reduce using rule 43 (expr -> if expr then error else expr fi .) + loop reduce using rule 43 (expr -> if expr then error else expr fi .) + cpar reduce using rule 43 (expr -> if expr then error else expr fi .) + comma reduce using rule 43 (expr -> if expr then error else expr fi .) + in reduce using rule 43 (expr -> if expr then error else expr fi .) + else reduce using rule 43 (expr -> if expr then error else expr fi .) + pool reduce using rule 43 (expr -> if expr then error else expr fi .) + error reduce using rule 43 (expr -> if expr then error else expr fi .) + ccur reduce using rule 43 (expr -> if expr then error else expr fi .) + fi reduce using rule 43 (expr -> if expr then error else expr fi .) + + +state 236 + + (42) expr -> if error then expr else expr fi . + + semi reduce using rule 42 (expr -> if error then expr else expr fi .) + of reduce using rule 42 (expr -> if error then expr else expr fi .) + then reduce using rule 42 (expr -> if error then expr else expr fi .) + loop reduce using rule 42 (expr -> if error then expr else expr fi .) + cpar reduce using rule 42 (expr -> if error then expr else expr fi .) + comma reduce using rule 42 (expr -> if error then expr else expr fi .) + in reduce using rule 42 (expr -> if error then expr else expr fi .) + else reduce using rule 42 (expr -> if error then expr else expr fi .) + pool reduce using rule 42 (expr -> if error then expr else expr fi .) + error reduce using rule 42 (expr -> if error then expr else expr fi .) + ccur reduce using rule 42 (expr -> if error then expr else expr fi .) + fi reduce using rule 42 (expr -> if error then expr else expr fi .) + + +state 237 + + (58) casep -> id colon type rarrow expr . + + semi reduce using rule 58 (casep -> id colon type rarrow expr .) + diff --git a/src/cool_parser/output_parser/parsetab.py b/src/cool_parser/output_parser/parsetab.py new file mode 100644 index 00000000..e9699a3a --- /dev/null +++ b/src/cool_parser/output_parser/parsetab.py @@ -0,0 +1,126 @@ + +# parsetab.py +# This file is automatically generated. Do not edit. +# pylint: disable=W,C,R +_tabversion = '3.10' + +_lr_method = 'LALR' + +_lr_signature = 'programarroba case ccur class colon comma cpar div dot else equal esac false fi id if in inherits isvoid larrow less lesseq let loop minus new not nox num ocur of opar plus pool rarrow semi star string then true type whileprogram : class_listepsilon :class_list : def_class class_list \n | def_classclass_list : error class_listdef_class : class type ocur feature_list ccur semi \n | class type inherits type ocur feature_list ccur semidef_class : class error ocur feature_list ccur semi \n | class type ocur feature_list ccur error \n | class error inherits type ocur feature_list ccur semi\n | class error inherits error ocur feature_list ccur semi\n | class type inherits error ocur feature_list ccur semi\n | class type inherits type ocur feature_list ccur errorfeature_list : epsilon\n | def_attr semi feature_list\n | def_func semi feature_listfeature_list : error feature_listdef_attr : id colon type\n | id colon type larrow exprdef_attr : error colon type\n | id colon error\n | error colon type larrow expr\n | id colon error larrow expr\n | id colon type larrow errordef_func : id opar formals cpar colon type ocur expr ccurdef_func : error opar formals cpar colon type ocur expr ccur\n | id opar error cpar colon type ocur expr ccur\n | id opar formals cpar colon error ocur expr ccur\n | id opar formals cpar colon type ocur error ccurformals : param_list\n | param_list_empty\n param_list : param\n | param comma param_listparam_list_empty : epsilonparam : id colon typelet_list : let_assign\n | let_assign comma let_listlet_assign : param larrow expr\n | paramcases_list : casep semi\n | casep semi cases_listcases_list : error cases_list\n | error semicasep : id colon type rarrow exprexpr : id larrow expr\n | comp\n comp : comp less op\n | comp lesseq op\n | comp equal op\n | opop : op plus term\n | op minus term\n | termterm : term star base_call\n | term div base_call\n | base_callterm : term star error\n | term div errorbase_call : factor arroba type dot func_call\n | factorbase_call : error arroba type dot func_call\n | factor arroba error dot func_call\n factor : atom\n | opar expr cparfactor : factor dot func_call\n | not expr\n | func_callfactor : isvoid base_call\n | nox base_call\n factor : let let_list in exprfactor : case expr of cases_list esacfactor : if expr then expr else expr fifactor : while expr loop expr poolatom : numatom : idatom : new typeatom : ocur block ccuratom : error block ccur\n | ocur error ccur\n | ocur block erroratom : true\n | falseatom : stringblock : expr semi\n | expr semi blockblock : error block\n | error semifunc_call : id opar args cparfunc_call : id opar error cpar\n | error opar args cparargs : arg_list\n | arg_list_empty\n arg_list : expr \n | expr comma arg_listarg_list : error arg_listarg_list_empty : epsilon' + +_lr_action_items = {'error':([0,3,4,5,10,11,12,13,15,25,29,30,31,32,33,34,36,37,38,39,55,58,62,63,66,70,80,81,82,83,85,86,87,90,98,100,102,103,104,105,106,107,110,112,113,114,115,116,117,118,119,120,121,122,135,136,141,142,145,151,154,162,164,171,173,174,175,176,180,181,182,183,184,185,189,190,193,194,195,201,207,215,219,229,],[4,4,4,9,15,21,15,23,15,39,15,15,50,52,15,15,15,15,-6,-9,-8,70,98,70,103,107,70,70,70,70,70,70,70,136,107,139,-7,-13,-12,-11,-10,107,145,70,154,70,70,70,70,70,162,164,166,169,178,107,-86,-87,185,107,185,107,107,70,70,201,70,70,70,207,70,70,169,185,145,-85,169,169,145,201,107,201,70,70,]),'class':([0,3,4,38,39,55,102,103,104,105,106,],[5,5,5,-6,-9,-8,-7,-13,-12,-11,-10,]),'$end':([1,2,3,6,7,38,39,55,102,103,104,105,106,],[0,-1,-4,-3,-5,-6,-9,-8,-7,-13,-12,-11,-10,]),'type':([5,11,13,27,31,61,89,94,100,101,108,121,218,],[8,20,24,40,49,96,134,137,138,140,143,165,227,]),'ocur':([8,9,20,21,23,24,58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,137,138,139,140,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[10,12,33,34,36,37,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,180,181,182,183,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,]),'inherits':([8,9,],[11,13,]),'ccur':([10,12,14,15,16,22,26,29,30,33,34,36,37,47,48,53,54,56,57,72,73,74,75,76,77,78,79,88,91,92,93,109,124,125,126,127,134,135,136,141,142,144,151,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,190,191,192,196,205,206,207,208,209,210,212,213,214,220,230,],[-2,-2,25,-2,-14,35,-17,-2,-2,-2,-2,-2,-2,-15,-16,66,67,68,69,-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,144,-66,-68,-75,-69,-76,177,179,144,-87,-78,-84,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-85,-88,-89,-70,221,222,223,224,225,-61,-59,-62,-71,-73,-72,]),'id':([10,12,15,28,29,30,32,33,34,36,37,58,60,62,63,70,80,81,82,83,84,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,122,136,145,151,154,162,164,171,172,173,174,175,176,180,181,182,183,184,185,189,193,194,195,201,207,215,219,229,],[19,19,19,46,19,19,46,19,19,19,19,72,46,72,72,72,72,72,126,126,46,72,72,72,72,72,72,72,72,72,126,126,126,126,126,126,126,168,72,72,72,72,72,72,72,46,72,202,72,72,72,72,72,72,168,72,72,168,168,72,202,72,202,72,72,]),'colon':([15,19,46,59,64,65,202,],[27,31,61,94,100,101,218,]),'opar':([15,19,58,62,63,70,72,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,126,136,145,151,154,162,164,168,169,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[28,32,80,80,80,110,113,80,80,80,80,80,80,80,80,110,110,80,80,80,80,80,80,80,80,80,80,113,110,110,80,110,110,110,113,195,80,80,80,80,80,80,80,80,110,80,80,110,80,80,]),'semi':([17,18,25,35,40,49,50,66,67,68,69,71,72,73,74,75,76,77,78,79,88,91,92,93,97,98,99,107,111,124,125,126,127,134,136,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,185,187,188,191,192,196,200,201,210,212,213,214,220,221,222,223,224,225,230,231,],[29,30,38,55,-20,-18,-21,102,104,105,106,-22,-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-19,-24,-23,142,151,-66,-68,-75,-69,-76,142,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,142,151,-90,-88,-89,-70,215,217,-61,-59,-62,-71,-73,-26,-25,-29,-28,-27,-72,-44,]),'cpar':([28,32,41,42,43,44,45,51,52,72,73,74,75,76,77,78,79,88,91,92,93,95,96,110,113,123,124,125,126,127,134,144,146,147,148,149,150,152,153,154,155,156,157,158,159,160,161,162,163,164,167,170,177,178,179,186,187,188,191,192,195,196,210,211,212,213,214,220,230,],[-2,-2,59,-30,-31,-32,-34,64,65,-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-33,-35,-2,-2,170,-66,-68,-75,-69,-76,-78,188,170,-91,-92,-96,-45,191,192,-93,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-95,-93,-90,-88,-89,-2,-70,-61,-94,-59,-62,-71,-73,-72,]),'larrow':([40,49,50,72,96,130,],[58,62,63,112,-35,173,]),'comma':([44,72,73,74,75,76,77,78,79,88,91,92,93,96,124,125,126,127,129,130,134,144,147,152,155,156,157,158,159,160,161,162,163,164,167,170,177,178,179,187,188,191,192,196,198,210,212,213,214,220,230,],[60,-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-35,-66,-68,-75,-69,172,-39,-76,-78,189,-45,189,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,189,-90,-88,-89,-70,-38,-61,-59,-62,-71,-73,-72,]),'not':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,81,]),'isvoid':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,]),'nox':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,83,]),'let':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,84,]),'case':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,]),'if':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,]),'while':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,87,]),'num':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,]),'new':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,89,]),'true':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,91,]),'false':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,92,]),'string':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,]),'arroba':([70,72,73,74,75,76,77,78,79,88,91,92,93,98,107,124,125,126,127,134,136,144,145,152,154,156,157,158,159,160,161,162,163,164,167,170,177,178,179,185,188,191,192,196,207,210,212,213,214,220,230,],[108,-75,-46,-50,-53,-56,121,-67,-63,-74,-81,-82,-83,108,108,-66,-68,-75,-69,-76,108,-78,108,-45,108,-47,-48,-49,-51,-52,-54,108,-55,108,-65,-64,-77,-80,-79,108,-90,-88,-89,-70,108,-61,-59,-62,-71,-73,-72,]),'dot':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,143,144,152,156,157,158,159,160,161,162,163,164,165,166,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,-50,-53,-56,122,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,184,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,193,194,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'star':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,-50,119,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,119,119,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'div':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,-50,120,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,120,120,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'plus':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,117,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,117,117,117,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'minus':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,118,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,118,118,118,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'less':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,114,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'lesseq':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,115,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'equal':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,116,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'of':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,131,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,174,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'then':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,132,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,175,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'loop':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,133,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,230,],[-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,176,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,-72,]),'in':([72,73,74,75,76,77,78,79,88,91,92,93,96,124,125,126,127,128,129,130,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,197,198,210,212,213,214,220,230,],[-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-35,-66,-68,-75,-69,171,-36,-39,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-37,-38,-61,-59,-62,-71,-73,-72,]),'else':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,203,210,212,213,214,220,230,],[-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,219,-61,-59,-62,-71,-73,-72,]),'pool':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,204,210,212,213,214,220,230,],[-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,220,-61,-59,-62,-71,-73,-72,]),'fi':([72,73,74,75,76,77,78,79,88,91,92,93,124,125,126,127,134,144,152,156,157,158,159,160,161,162,163,164,167,170,177,178,179,188,191,192,196,210,212,213,214,220,228,230,],[-75,-46,-50,-53,-56,-60,-67,-63,-74,-81,-82,-83,-66,-68,-75,-69,-76,-78,-45,-47,-48,-49,-51,-52,-54,-57,-55,-58,-65,-64,-77,-80,-79,-90,-88,-89,-70,-61,-59,-62,-71,-73,230,-72,]),'esac':([199,215,216,217,226,],[214,-40,-42,-43,-41,]),'rarrow':([227,],[229,]),} + +_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,3,4,],[2,6,7,]),'def_class':([0,3,4,],[3,3,3,]),'feature_list':([10,12,15,29,30,33,34,36,37,],[14,22,26,47,48,53,54,56,57,]),'epsilon':([10,12,15,28,29,30,32,33,34,36,37,110,113,195,],[16,16,16,45,16,16,45,16,16,16,16,150,150,150,]),'def_attr':([10,12,15,29,30,33,34,36,37,],[17,17,17,17,17,17,17,17,17,]),'def_func':([10,12,15,29,30,33,34,36,37,],[18,18,18,18,18,18,18,18,18,]),'formals':([28,32,],[41,51,]),'param_list':([28,32,60,],[42,42,95,]),'param_list_empty':([28,32,],[43,43,]),'param':([28,32,60,84,172,],[44,44,44,130,130,]),'expr':([58,62,63,70,80,81,85,86,87,90,98,107,110,112,113,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[71,97,99,111,123,124,131,132,133,111,111,111,147,152,155,111,187,111,187,111,111,196,198,203,204,205,206,208,209,187,155,155,111,228,231,]),'comp':([58,62,63,70,80,81,85,86,87,90,98,107,110,112,113,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,73,]),'op':([58,62,63,70,80,81,85,86,87,90,98,107,110,112,113,114,115,116,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,156,157,158,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,74,]),'term':([58,62,63,70,80,81,85,86,87,90,98,107,110,112,113,114,115,116,117,118,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,159,160,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,75,]),'base_call':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[76,76,76,76,76,76,125,127,76,76,76,76,76,76,76,76,76,76,76,76,76,76,161,163,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,76,]),'factor':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,]),'func_call':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,122,136,145,151,154,162,164,171,173,175,176,180,181,182,183,184,185,189,193,194,195,207,219,229,],[78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,78,167,78,78,78,78,78,78,78,78,78,78,78,78,78,78,210,78,78,212,213,78,78,78,78,]),'atom':([58,62,63,70,80,81,82,83,85,86,87,90,98,107,110,112,113,114,115,116,117,118,119,120,136,145,151,154,162,164,171,173,175,176,180,181,182,183,185,189,195,207,219,229,],[79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,79,]),'block':([70,90,98,107,136,145,151,154,162,164,185,207,],[109,135,109,141,141,109,190,109,109,109,141,109,]),'let_list':([84,172,],[128,197,]),'let_assign':([84,172,],[129,129,]),'args':([110,113,195,],[146,153,146,]),'arg_list':([110,113,145,154,185,189,195,],[148,148,186,186,186,211,148,]),'arg_list_empty':([110,113,195,],[149,149,149,]),'cases_list':([174,201,215,],[199,216,226,]),'casep':([174,201,215,],[200,200,200,]),} + +_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',8), + ('epsilon -> ','epsilon',0,'p_epsilon','parser.py',12), + ('class_list -> def_class class_list','class_list',2,'p_class_list','parser.py',17), + ('class_list -> def_class','class_list',1,'p_class_list','parser.py',18), + ('class_list -> error class_list','class_list',2,'p_class_list_error','parser.py',23), + ('def_class -> class type ocur feature_list ccur semi','def_class',6,'p_def_class','parser.py',29), + ('def_class -> class type inherits type ocur feature_list ccur semi','def_class',8,'p_def_class','parser.py',30), + ('def_class -> class error ocur feature_list ccur semi','def_class',6,'p_def_class_error','parser.py',38), + ('def_class -> class type ocur feature_list ccur error','def_class',6,'p_def_class_error','parser.py',39), + ('def_class -> class error inherits type ocur feature_list ccur semi','def_class',8,'p_def_class_error','parser.py',40), + ('def_class -> class error inherits error ocur feature_list ccur semi','def_class',8,'p_def_class_error','parser.py',41), + ('def_class -> class type inherits error ocur feature_list ccur semi','def_class',8,'p_def_class_error','parser.py',42), + ('def_class -> class type inherits type ocur feature_list ccur error','def_class',8,'p_def_class_error','parser.py',43), + ('feature_list -> epsilon','feature_list',1,'p_feature_list','parser.py',48), + ('feature_list -> def_attr semi feature_list','feature_list',3,'p_feature_list','parser.py',49), + ('feature_list -> def_func semi feature_list','feature_list',3,'p_feature_list','parser.py',50), + ('feature_list -> error feature_list','feature_list',2,'p_feature_list_error','parser.py',55), + ('def_attr -> id colon type','def_attr',3,'p_def_attr','parser.py',60), + ('def_attr -> id colon type larrow expr','def_attr',5,'p_def_attr','parser.py',61), + ('def_attr -> error colon type','def_attr',3,'p_def_attr_error','parser.py',68), + ('def_attr -> id colon error','def_attr',3,'p_def_attr_error','parser.py',69), + ('def_attr -> error colon type larrow expr','def_attr',5,'p_def_attr_error','parser.py',70), + ('def_attr -> id colon error larrow expr','def_attr',5,'p_def_attr_error','parser.py',71), + ('def_attr -> id colon type larrow error','def_attr',5,'p_def_attr_error','parser.py',72), + ('def_func -> id opar formals cpar colon type ocur expr ccur','def_func',9,'p_def_func','parser.py',77), + ('def_func -> error opar formals cpar colon type ocur expr ccur','def_func',9,'p_def_func_error','parser.py',81), + ('def_func -> id opar error cpar colon type ocur expr ccur','def_func',9,'p_def_func_error','parser.py',82), + ('def_func -> id opar formals cpar colon error ocur expr ccur','def_func',9,'p_def_func_error','parser.py',83), + ('def_func -> id opar formals cpar colon type ocur error ccur','def_func',9,'p_def_func_error','parser.py',84), + ('formals -> param_list','formals',1,'p_formals','parser.py',89), + ('formals -> param_list_empty','formals',1,'p_formals','parser.py',90), + ('param_list -> param','param_list',1,'p_param_list','parser.py',96), + ('param_list -> param comma param_list','param_list',3,'p_param_list','parser.py',97), + ('param_list_empty -> epsilon','param_list_empty',1,'p_param_list_empty','parser.py',106), + ('param -> id colon type','param',3,'p_param','parser.py',110), + ('let_list -> let_assign','let_list',1,'p_let_list','parser.py',115), + ('let_list -> let_assign comma let_list','let_list',3,'p_let_list','parser.py',116), + ('let_assign -> param larrow expr','let_assign',3,'p_let_assign','parser.py',125), + ('let_assign -> param','let_assign',1,'p_let_assign','parser.py',126), + ('cases_list -> casep semi','cases_list',2,'p_cases_list','parser.py',134), + ('cases_list -> casep semi cases_list','cases_list',3,'p_cases_list','parser.py',135), + ('cases_list -> error cases_list','cases_list',2,'p_cases_list_error','parser.py',139), + ('cases_list -> error semi','cases_list',2,'p_cases_list_error','parser.py',140), + ('casep -> id colon type rarrow expr','casep',5,'p_case','parser.py',144), + ('expr -> id larrow expr','expr',3,'p_expr','parser.py',149), + ('expr -> comp','expr',1,'p_expr','parser.py',150), + ('comp -> comp less op','comp',3,'p_comp','parser.py',158), + ('comp -> comp lesseq op','comp',3,'p_comp','parser.py',159), + ('comp -> comp equal op','comp',3,'p_comp','parser.py',160), + ('comp -> op','comp',1,'p_comp','parser.py',161), + ('op -> op plus term','op',3,'p_op','parser.py',180), + ('op -> op minus term','op',3,'p_op','parser.py',181), + ('op -> term','op',1,'p_op','parser.py',182), + ('term -> term star base_call','term',3,'p_term','parser.py',197), + ('term -> term div base_call','term',3,'p_term','parser.py',198), + ('term -> base_call','term',1,'p_term','parser.py',199), + ('term -> term star error','term',3,'p_term_error','parser.py',209), + ('term -> term div error','term',3,'p_term_error','parser.py',210), + ('base_call -> factor arroba type dot func_call','base_call',5,'p_base_call','parser.py',215), + ('base_call -> factor','base_call',1,'p_base_call','parser.py',216), + ('base_call -> error arroba type dot func_call','base_call',5,'p_base_call_error','parser.py',223), + ('base_call -> factor arroba error dot func_call','base_call',5,'p_base_call_error','parser.py',224), + ('factor -> atom','factor',1,'p_factor1','parser.py',229), + ('factor -> opar expr cpar','factor',3,'p_factor1','parser.py',230), + ('factor -> factor dot func_call','factor',3,'p_factor2','parser.py',234), + ('factor -> not expr','factor',2,'p_factor2','parser.py',235), + ('factor -> func_call','factor',1,'p_factor2','parser.py',236), + ('factor -> isvoid base_call','factor',2,'p_factor3','parser.py',245), + ('factor -> nox base_call','factor',2,'p_factor3','parser.py',246), + ('factor -> let let_list in expr','factor',4,'p_expr_let','parser.py',255), + ('factor -> case expr of cases_list esac','factor',5,'p_expr_case','parser.py',267), + ('factor -> if expr then expr else expr fi','factor',7,'p_expr_if','parser.py',279), + ('factor -> while expr loop expr pool','factor',5,'p_expr_while','parser.py',293), + ('atom -> num','atom',1,'p_atom_num','parser.py',306), + ('atom -> id','atom',1,'p_atom_id','parser.py',310), + ('atom -> new type','atom',2,'p_atom_new','parser.py',314), + ('atom -> ocur block ccur','atom',3,'p_atom_block','parser.py',318), + ('atom -> error block ccur','atom',3,'p_atom_block_error','parser.py',322), + ('atom -> ocur error ccur','atom',3,'p_atom_block_error','parser.py',323), + ('atom -> ocur block error','atom',3,'p_atom_block_error','parser.py',324), + ('atom -> true','atom',1,'p_atom_boolean','parser.py',328), + ('atom -> false','atom',1,'p_atom_boolean','parser.py',329), + ('atom -> string','atom',1,'p_atom_string','parser.py',333), + ('block -> expr semi','block',2,'p_block','parser.py',338), + ('block -> expr semi block','block',3,'p_block','parser.py',339), + ('block -> error block','block',2,'p_block_error','parser.py',343), + ('block -> error semi','block',2,'p_block_error','parser.py',344), + ('func_call -> id opar args cpar','func_call',4,'p_func_call','parser.py',349), + ('func_call -> id opar error cpar','func_call',4,'p_func_call_error','parser.py',353), + ('func_call -> error opar args cpar','func_call',4,'p_func_call_error','parser.py',354), + ('args -> arg_list','args',1,'p_args','parser.py',359), + ('args -> arg_list_empty','args',1,'p_args','parser.py',360), + ('arg_list -> expr','arg_list',1,'p_arg_list','parser.py',366), + ('arg_list -> expr comma arg_list','arg_list',3,'p_arg_list','parser.py',367), + ('arg_list -> error arg_list','arg_list',2,'p_arg_list_error','parser.py',374), + ('arg_list_empty -> epsilon','arg_list_empty',1,'p_arg_list_empty','parser.py',378), +] diff --git a/src/cool_parser/parser.py b/src/cool_parser/parser.py new file mode 100644 index 00000000..47fef6d2 --- /dev/null +++ b/src/cool_parser/parser.py @@ -0,0 +1,403 @@ +from utils.ast import * +from utils.errors import SyntaticError +from utils.utils import find_column +from cool_parser.base_parser import Parser + +class CoolParser(Parser): + def p_program(self, p): + 'program : class_list' + p[0] = ProgramNode(p[1]) + + def p_epsilon(self, p): + 'epsilon :' + pass + + + def p_class_list(self, p): + '''class_list : def_class class_list + | def_class''' + p[0] = [p[1]] if len(p) == 2 else [p[1]] + p[2] + + + def p_class_list_error(self, p): + '''class_list : error class_list''' + p[0] = [p[1]] if len(p) == 2 else [p[1]] + p[2] + + + + def p_def_class(self, p): + '''def_class : class type ocur feature_list ccur semi + | class type inherits type ocur feature_list ccur semi''' + if len(p) == 7: + p[0] = ClassDeclarationNode(p.slice[2], p[4]) + else: + p[0] = ClassDeclarationNode(p.slice[2], p[6], p.slice[4]) + + + def p_def_class_error(self, p): + '''def_class : class error ocur feature_list ccur semi + | class type ocur feature_list ccur error + | class error inherits type ocur feature_list ccur semi + | class error inherits error ocur feature_list ccur semi + | class type inherits error ocur feature_list ccur semi + | class type inherits type ocur feature_list ccur error''' + p[0] = ErrorNode() + + + def p_feature_list(self, p): + '''feature_list : epsilon + | def_attr semi feature_list + | def_func semi feature_list''' + p[0] = [] if len(p) == 2 else [p[1]] + p[3] + + + def p_feature_list_error(self, p): + 'feature_list : error feature_list' + p[0] = [p[1]] + p[2] + + + def p_def_attr(self, p): + '''def_attr : id colon type + | id colon type larrow expr''' + if len(p) == 4: + p[0] = AttrDeclarationNode(p.slice[1], p.slice[3]) + else: + p[0] = AttrDeclarationNode(p.slice[1], p.slice[3], p[5]) + + def p_def_attr_error(self, p): + '''def_attr : error colon type + | id colon error + | error colon type larrow expr + | id colon error larrow expr + | id colon type larrow error''' + p[0] = ErrorNode() + + + def p_def_func(self, p): + 'def_func : id opar formals cpar colon type ocur expr ccur' + p[0] = FuncDeclarationNode(p.slice[1], p[3], p.slice[6], p[8]) + + def p_def_func_error(self, p): + '''def_func : error opar formals cpar colon type ocur expr ccur + | id opar error cpar colon type ocur expr ccur + | id opar formals cpar colon error ocur expr ccur + | id opar formals cpar colon type ocur error ccur''' + p[0] = ErrorNode() + + + def p_formals(self, p): + '''formals : param_list + | param_list_empty + ''' + p[0] = p[1] + + + def p_param_list(self, p): + '''param_list : param + | param comma param_list''' + p[0] = [p[1]] if len(p) == 2 else [p[1]] + p[3] + + # def p_param_list_error(self, p): + # '''param_list : error comma param_list''' + # p[0] = [ErrorNode()] + + + def p_param_list_empty(self, p): + 'param_list_empty : epsilon' + p[0] = [] + + def p_param(self, p): + 'param : id colon type' + p[0] = (p.slice[1], p.slice[3]) + + + def p_let_list(self, p): + '''let_list : let_assign + | let_assign comma let_list''' + p[0] = [p[1]] if len(p) == 2 else [p[1]] + p[3] + + # def p_let_list_error(self, p): + # '''let_list : error let_list + # | error''' + # p[0] = [ErrorNode()] + + def p_let_assign(self, p): + '''let_assign : param larrow expr + | param''' + if len(p) == 2: + p[0] = VarDeclarationNode(p[1][0], p[1][1]) + else: + p[0] = VarDeclarationNode(p[1][0], p[1][1], p[3]) + + + def p_cases_list(self, p): + '''cases_list : casep semi + | casep semi cases_list''' + p[0] = [p[1]] if len(p) == 3 else [p[1]] + p[3] + + def p_cases_list_error(self, p): + '''cases_list : error cases_list + | error semi''' + p[0] = [ErrorNode()] + + def p_case(self, p): + 'casep : id colon type rarrow expr' + p[0] = OptionNode(p.slice[1], p.slice[3], p[5]) + + + def p_expr(self, p): + '''expr : id larrow expr + | comp + ''' + if len(p) == 4: + p[0] = AssignNode(p.slice[1], p[3]) + else: + p[0] = p[1] + + def p_comp(self, p): + '''comp : comp less op + | comp lesseq op + | comp equal op + | op''' + if len(p) == 2: + p[0] = p[1] + elif p[2] == '<': + p[0] = LessNode(p[1], p[3]) + elif p[2] == '<=': + p[0] = LessEqNode(p[1], p[3]) + elif p[2] == '=': + p[0] = EqualNode(p[1], p[3]) + + + # def p_comp_error(self, p): + # '''comp : comp less error + # | comp lesseq error + # | comp equal error''' + # p[0] = ErrorNode() + + + def p_op(self, p): + '''op : op plus term + | op minus term + | term''' + if len(p) == 2: + p[0] = p[1] + elif p[2] == '+': + p[0] = PlusNode(p[1], p[3]) + elif p[2] == '-': + p[0] = MinusNode(p[1], p[3]) + + # def p_op_error(self, p): + # '''op : op plus error + # | op minus error''' + # p[0] = ErrorNode() + + + def p_term(self, p): + '''term : term star base_call + | term div base_call + | base_call''' + if len(p) == 2: + p[0] = p[1] + elif p[2] == '*': + p[0] = StarNode(p[1], p[3]) + elif p[2] == '/': + p[0] = DivNode(p[1], p[3]) + + + def p_term_error(self, p): + '''term : term star error + | term div error''' + p[0] = ErrorNode() + + + def p_base_call(self, p): + '''base_call : factor arroba type dot func_call + | factor''' + if len(p) == 2: + p[0] = p[1] + else: + p[0] = BaseCallNode(p[1], p.slice[3], *p[5]) + + def p_base_call_error(self, p): + '''base_call : error arroba type dot func_call + | factor arroba error dot func_call + ''' + p[0] = ErrorNode() + + def p_factor1(self, p): + '''factor : atom + | opar expr cpar''' + p[0] = p[1] if len(p) == 2 else p[2] + + def p_factor2(self, p): + '''factor : factor dot func_call + | not expr + | func_call''' + if len(p) == 2: + p[0] = StaticCallNode(*p[1]) + elif p[1] == 'not': + p[0] = NotNode(p[2], p.slice[1]) + else: + p[0] = CallNode(p[1], *p[3]) + + def p_factor3(self, p): + '''factor : isvoid base_call + | nox base_call + ''' + if p[1] == 'isvoid': + p[0] = IsVoidNode(p[2], p.slice[1]) + else: + p[0] = BinaryNotNode(p[2], p.slice[1]) + + + def p_expr_let(self, p): + 'factor : let let_list in expr' + p[0] = LetNode(p[2], p[4], p.slice[1]) + + + # def p_expr_let_error(self, p): + # '''factor : let error in expr + # | let let_list in error + # | let let_list error expr''' + # p[0] = ErrorNode() + + + def p_expr_case(self, p): + 'factor : case expr of cases_list esac' + p[0] = CaseNode(p[2], p[4], p.slice[1]) + + # def p_expr_case_error(self, p): + # '''factor : case error of cases_list esac + # | case expr of error esac + # | case expr error cases_list esac + # | case expr of cases_list error''' + # p[0] = ErrorNode() + + + def p_expr_if(self, p): + 'factor : if expr then expr else expr fi' + p[0] = ConditionalNode(p[2], p[4], p[6], p.slice[1]) + + # def p_expr_if_error(self, p): + # '''factor : if error then expr else expr fi + # | if expr then error else expr fi + # | if expr then expr else error fi + # | if expr error expr else expr fi + # | if expr then expr error expr fi + # | if expr then expr else expr error''' + # p[0] = ErrorNode() + + + def p_expr_while(self, p): + 'factor : while expr loop expr pool' + p[0] = WhileNode(p[2], p[4], p.slice[1]) + + + # def p_expr_while_error(self, p): + # '''factor : while error loop expr pool + # | while expr loop error pool + # | while expr loop expr error + # | while expr error expr pool''' + # p[0] = ErrorNode() + + + def p_atom_num(self, p): + 'atom : num' + p[0] = ConstantNumNode(p.slice[1]) + + def p_atom_id(self, p): + 'atom : id' + p[0] = VariableNode(p.slice[1]) + + def p_atom_new(self, p): + 'atom : new type' + p[0] = InstantiateNode(p.slice[2]) + + def p_atom_block(self, p): + 'atom : ocur block ccur' + p[0] = BlockNode(p[2], p.slice[1]) + + def p_atom_block_error(self, p): + '''atom : error block ccur + | ocur error ccur + | ocur block error''' + p[0] = ErrorNode() + + def p_atom_boolean(self, p): + '''atom : true + | false''' + p[0] = ConstantBoolNode(p.slice[1]) + + def p_atom_string(self, p): + 'atom : string' + p[0] = ConstantStrNode(p.slice[1]) + + + def p_block(self, p): + '''block : expr semi + | expr semi block''' + p[0] = [p[1]] if len(p) == 3 else [p[1]] + p[3] + + def p_block_error(self, p): + '''block : error block + | error semi''' + p[0] = [ErrorNode()] + + + def p_func_call(self, p): + 'func_call : id opar args cpar' + p[0] = (p.slice[1], p[3]) + + def p_func_call_error(self, p): + '''func_call : id opar error cpar + | error opar args cpar''' + p[0] = (ErrorNode(), ErrorNode()) + + + def p_args(self, p): + '''args : arg_list + | arg_list_empty + ''' + p[0] = p[1] + + + def p_arg_list(self, p): + '''arg_list : expr + | expr comma arg_list''' + if len(p) == 2: + p[0] = [p[1]] + else: + p[0] = [p[1]] + p[3] + + def p_arg_list_error(self, p): + 'arg_list : error arg_list' + p[0] = [ErrorNode()] + + def p_arg_list_empty(self, p): + 'arg_list_empty : epsilon' + p[0] = [] + + # Error rule for syntax errors + def p_error(self, p): + self.errors = True + if p: + self.print_error(p) + else: + error_text = SyntaticError.ERROR % 'EOF' + column = find_column(self.lexer.lexer, self.lexer.lexer) + line = self.lexer.lexer.lineno + print(SyntaticError(error_text, line, column - 1)) + + def print_error(self, tok): + error_text = SyntaticError.ERROR % tok.value + line, column = tok.lineno, tok.column + print(SyntaticError(error_text, line, column)) + + +if __name__ == "__main__": + s = '''''' + # Parser() + parser = CoolParser() + result = parser.parse(s) + # print(result) \ No newline at end of file diff --git a/src/coolc.sh b/src/coolc.sh old mode 100755 new mode 100644 index 3088de4f..0407b479 --- a/src/coolc.sh +++ b/src/coolc.sh @@ -1,11 +1,15 @@ -# Incluya aquí las instrucciones necesarias para ejecutar su compilador +# Incluye aqui las instrucciones necesarias para ejecutar su compilador INPUT_FILE=$1 -OUTPUT_FILE=${INPUT_FILE:0: -2}mips +OUTPUT_FILE=$INPUT_FILE +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 +# Si su compilador no lo hace ya, aquí puede imprimir información de contacto +# echo "LINEA_CON_NOMBRE_Y_VERSION_DEL_COMPILADOR" # TODO: Recuerde cambiar estas lineas +echo "COOL COMPILER 2020" +echo "Copyright (c) 2019: Loraine Monteagudo, Amanda Marrero, Manuel Fernandez" -# Llamar al compilador -echo "Compiling $INPUT_FILE into $OUTPUT_FILE" +FILE="../src/main.py" + +# echo "Compiling $INPUT_FILE into $OUTPUT_FILE" +python ${FILE} $INPUT_FILE $OUTPUT_FILE \ No newline at end of file diff --git a/src/hello_world.cl b/src/hello_world.cl new file mode 100644 index 00000000..17248e7a --- /dev/null +++ b/src/hello_world.cl @@ -0,0 +1,10 @@ +class Main inherits IO { + a : String <- case 1 of + n : Main => n.type_name(); + a : Int => a.type_name(); + esac; + + main(): IO { + out_string(a) + }; +}; diff --git a/src/lexer/__init__.py b/src/lexer/__init__.py new file mode 100644 index 00000000..66f30ad1 --- /dev/null +++ b/src/lexer/__init__.py @@ -0,0 +1 @@ +from lexer.lexer import CoolLexer \ No newline at end of file diff --git a/src/lexer/__pycache__/__init__.cpython-38.pyc b/src/lexer/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 00000000..faa19c29 Binary files /dev/null and b/src/lexer/__pycache__/__init__.cpython-38.pyc differ diff --git a/src/lexer/__pycache__/lexer.cpython-38.pyc b/src/lexer/__pycache__/lexer.cpython-38.pyc new file mode 100644 index 00000000..797eb3c8 Binary files /dev/null and b/src/lexer/__pycache__/lexer.cpython-38.pyc differ diff --git a/src/lexer/lexer.py b/src/lexer/lexer.py new file mode 100644 index 00000000..add4401d --- /dev/null +++ b/src/lexer/lexer.py @@ -0,0 +1,324 @@ +import ply.lex as lex +from pprint import pprint + +from utils.tokens import tokens, reserved, Token +from utils.errors import LexicographicError, SyntaticError +from utils.utils import find_column + + +class CoolLexer: + def __init__(self, **kwargs): + self.reserved = reserved + self.tokens = tokens + self.errors = [] + self.lexer = lex.lex(module=self, **kwargs) + self.lexer.lineno = 1 + self.lexer.linestart = 0 + + def _update_column(self, t): + t.column = t.lexpos - t.lexer.linestart + 1 + + states = ( + ('comments', 'exclusive'), + ('strings', 'exclusive') + ) + + # Comments + def t_comment(self, t): + r'--.*($|\n)' + t.lexer.lineno += 1 + t.lexer.linestart = t.lexer.lexpos + + def t_comments(self,t): + r'\(\*' + t.lexer.level = 1 + t.lexer.begin('comments') + + def t_comments_open(self, t): + r'\(\*' + t.lexer.level += 1 + + def t_comments_close(self, t): + r'\*\)' + t.lexer.level -= 1 + + if t.lexer.level == 0: + t.lexer.begin('INITIAL') + + def t_comments_newline(self, t): + r'\n+' + t.lexer.lineno += len(t.value) + t.lexer.linestart = t.lexer.lexpos + + t_comments_ignore = ' \t\f\r\t\v' + + def t_comments_error(self, t): + t.lexer.skip(1) + + def t_comments_eof(self, t): + self._update_column(t) + if t.lexer.level > 0: + error_text = LexicographicError.EOF_COMMENT + self.errors.append(LexicographicError(error_text, t.lineno, t.column)) + + # Strings + t_strings_ignore = '' + + def t_strings(self, t): + r'\"' + t.lexer.str_start = t.lexer.lexpos + t.lexer.myString = '' + t.lexer.backslash = False + t.lexer.begin('strings') + + def t_strings_end(self, t): + r'\"' + self._update_column(t) + + if t.lexer.backslash : + t.lexer.myString += '"' + t.lexer.backslash = False + else: + t.value = t.lexer.myString + t.type = 'string' + t.lexer.begin('INITIAL') + return t + + def t_strings_newline(self, t): + r'\n' + t.lexer.lineno += 1 + self._update_column(t) + + t.lexer.linestart = t.lexer.lexpos + + if not t.lexer.backslash: + error_text = LexicographicError.UNDETERMINATED_STRING + self.errors.append(LexicographicError(error_text, t.lineno, t.column)) + t.lexer.begin('INITIAL') + + def t_strings_nill(self, t): + r'\0' + error_text = LexicographicError.NULL_STRING + self._update_column(t) + + self.errors.append(LexicographicError(error_text, t.lineno, t.column)) + + def t_strings_consume(self, t): + r'[^\n]' + # self._update_column(t) + + if t.lexer.backslash : + if t.value == 'b': + t.lexer.myString += '\b' + + elif t.value == 't': + t.lexer.myString += '\t' + + + elif t.value == 'f': + t.lexer.myString += '\f' + + + elif t.value == 'n': + t.lexer.myString += '\n' + + elif t.value == '\\': + t.lexer.myString += '\\' + else: + t.lexer.myString += t.value + t.lexer.backslash = False + else: + if t.value != '\\': + t.lexer.myString += t.value + else: + t.lexer.backslash = True + + def t_strings_error(self, t): + pass + + def t_strings_eof(self, t): + self._update_column(t) + + error_text = LexicographicError.EOF_STRING + self.errors.append(LexicographicError(error_text, t.lineno, t.column)) + + + t_ignore = ' \t\f\r\t\v' + + + def t_semi(self, t): + r';' + self._update_column(t) + return t + + def t_colon(self, t): + r':' + self._update_column(t) + return t + + def t_comma(self, t): + r',' + self._update_column(t) + return t + + def t_dot(self, t): + r'\.' + self._update_column(t) + return t + + def t_opar(self, t): + r'\(' + self._update_column(t) + return t + + def t_cpar(self, t): + r'\)' + self._update_column(t) + return t + + def t_ocur(self, t): + r'\{' + self._update_column(t) + return t + + def t_ccur(self, t): + r'\}' + self._update_column(t) + return t + + def t_larrow(self, t): + r'<-' + self._update_column(t) + return t + + def t_arroba(self, t): + r'@' + self._update_column(t) + return t + + def t_rarrow(self, t): + r'=>' + self._update_column(t) + return t + + def t_nox(self, t): + r'~' + self._update_column(t) + return t + + def t_equal(self, t): + r'=' + self._update_column(t) + return t + + def t_plus(self, t): + r'\+' + self._update_column(t) + return t + + def t_of(self, t): + r'of' + self._update_column(t) + return t + + def t_minus(self, t): + r'-' + self._update_column(t) + return t + + def t_star(self, t): + r'\*' + self._update_column(t) + return t + + def t_div(self, t): + r'/' + self._update_column(t) + return t + + def t_lesseq(self, t): + r'<=' + self._update_column(t) + return t + + def t_less(self, t): + r'<' + self._update_column(t) + return t + + + def t_inherits(self, t): + r'inherits' + self._update_column(t) + return t + + def t_type(self, t): + r'[A-Z][a-zA-Z_0-9]*' + t.type = self.reserved.get(t.value.lower(), 'type') + self._update_column(t) + return t + + # Check for reserved words: + def t_id(self, t): + r'[a-z][a-zA-Z_0-9]*' + t.type = self.reserved.get(t.value.lower(), 'id') + self._update_column(t) + return t + + + # Get Numbers + def t_num(self, t): + r'\d+(\.\d+)? ' + t.value = float(t.value) + self._update_column(t) + return t + + # Define a rule so we can track line numbers + def t_newline(self, t): + r'\n+' + t.lexer.lineno += len(t.value) + t.lexer.linestart = t.lexer.lexpos + + # Error handling rule + def t_error(self, t): + self._update_column(t) + error_text = LexicographicError.UNKNOWN_TOKEN % t.value[0] + + self.errors.append(LexicographicError(error_text, t.lineno, t.column)) + t.lexer.skip(1) + #t.lexer.skip(len(t.value)) + + def tokenize_text(self, text: str) -> list: + self.lexer.input(text) + tokens = [] + for tok in self.lexer: + tokens.append(Token(tok.type, tok.value, tok.lineno, tok.column)) + self.lexer.lineno = 1 + self.lexer.linestart = 0 + return tokens + + def _check_empty_line(self, tokens: list): + if len(tokens) == 0: + error_text = SyntaticError.ERROR % 'EOF' + print(SyntaticError(error_text, 0, 0)) + raise Exception() + + + def run(self, text: str): + tokens = self.tokenize_text(text) + if self.errors: + for error in self.errors: + print(error) + raise Exception() + + self._check_empty_line(tokens) + return tokens + +if __name__ == "__main__": + lexer = CoolLexer() + + data = open('string4.cl',encoding='utf-8') + data = data.read() + res = lexer.tokenize_text(data) + #pprint(res) + pprint(lexer.errors) diff --git a/src/main.py b/src/main.py new file mode 100644 index 00000000..ed9b07a3 --- /dev/null +++ b/src/main.py @@ -0,0 +1,43 @@ +from lexer import CoolLexer +from utils.errors import CompilerError +from semantic.semantic import semantic_analysis +from codegen import codegen_pipeline +from cool_parser import CoolParser +from ply.lex import LexToken +import sys + +def run_pipeline(input_, outpt): + try: + with open(input_) as f: + text = f.read() + + lexer = CoolLexer() + tokens = lexer.run(text) + + p = CoolParser(lexer) + + ast = p.parse(text, debug=True) + if p.errors: + raise Exception() + + ast, errors, context, scope = semantic_analysis(ast, debug=False) + if errors: + for err in errors: + print(err) + raise Exception() + else: + mips_code = codegen_pipeline(context, ast, scope, debug=False) + with open(outpt, 'w+') as f: + f.write(mips_code) + + except FileNotFoundError: + error_text = CompilerError.UNKNOWN_FILE % input_ + print(CompilerError(error_text, 0, 0)) + +if __name__ == "__main__": + input_ = sys.argv[1] + output_ = sys.argv[2] + # print(input_) + # input_ = f'hello_world.cl' + # output_ = 'test.mips' + run_pipeline(input_, output_) \ No newline at end of file diff --git a/src/semantic/__init__.py b/src/semantic/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/semantic/semantic.py b/src/semantic/semantic.py new file mode 100644 index 00000000..ac22f056 --- /dev/null +++ b/src/semantic/semantic.py @@ -0,0 +1,46 @@ +from semantic.visitors.type_collector import TypeCollector +from semantic.visitors.type_builder import TypeBuilder +from semantic.visitors.var_collector import VarCollector +from semantic.visitors.type_checker import TypeChecker + + +def semantic_analysis(ast, debug=False): + if debug: + print('============== COLLECTING TYPES ===============') + errors = [] + collector = TypeCollector(errors) + collector.visit(ast) + context = collector.context + if debug: + print('Errors: [') + for error in errors: + print('\t', error) + print('=============== BUILDING TYPES ================') + builder = TypeBuilder(context, errors) + builder.visit(ast) + if debug: + print('Errors: [') + for error in errors: + print('\t', error) + print(']') + print('=============== VAR COLLECTOR ================') + checker = VarCollector(context, errors) + scope = checker.visit(ast) + if debug: + print('Errors: [') + for error in errors: + print('\t', error) + print(']') + print('=============== CHECKING TYPES ================') + checker = TypeChecker(context, errors) + checker.visit(ast, scope) + if debug: + print('Errors: [') + for error in errors: + print('\t', error) + print(']') + print('Context:') + print(context) + print('Scope:') + print(scope) + return ast, errors, context, scope diff --git a/src/semantic/tools.py b/src/semantic/tools.py new file mode 100644 index 00000000..0513a232 --- /dev/null +++ b/src/semantic/tools.py @@ -0,0 +1,142 @@ +import itertools as itt +from utils.errors import SemanticError, AttributesError, TypesError, NamesError +from semantic.types import Type + +class Context: + def __init__(self): + self.types = {} + + def get_depth(self, class_name): + typex = self.types[class_name] + if typex.parent is None: + return 0 + return 1 + self.get_depth(typex.parent.name) + + def build_inheritance_graph(self): + graph = {} + # for type_name in self.types.keys(): + # graph[type_name] = [] + for type_name, typex in self.types.items(): + if typex.parent is not None: + # graph[typex.parent.name].append(type_name) + graph[type_name] = typex.parent.name + else: + if type_name == 'SELF_TYPE': + continue + graph[type_name] = None + return graph + + def create_type(self, name:str, pos) -> Type: + if name in self.types: + error_text = SemanticError.TYPE_ALREADY_DEFINED + raise SemanticError(error_text, *pos) + typex = self.types[name] = Type(name, pos) + return typex + + def get_type(self, name:str, pos) -> Type: + try: + return self.types[name] + except KeyError: + error_text = TypesError.TYPE_NOT_DEFINED % name + raise TypesError(error_text, *pos) + + 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) + +class VariableInfo: + def __init__(self, name, vtype, index=None): + self.name = name + self.type = vtype + self.index = index # saves the index in the scope of the variable + + def __str__(self): + return f'{self.name} : {self.type.name}' + + def __repr__(self): + return str(self) + +class Scope: + def __init__(self, parent=None): + self.locals = [] + self.attributes = [] + self.parent = parent + self.children = [] + self.expr_dict = { } + self.functions = { } + self.index = 0 if parent is None else len(parent) + + def __len__(self): + return len(self.locals) + + def __str__(self): + res = '' + for scope in self.children: + try: + classx = scope.locals[0] + name = classx.type.name + except: + name = '1' + res += name + scope.tab_level(1, '', 1) #'\n\t' + ('\n' + '\t').join(str(local) for local in scope.locals) + '\n' + return res + + def tab_level(self, tabs, name, num) -> str: + res = ('\t' * tabs) + ('\n' + ('\t' * tabs)).join(str(local) for local in self.locals) + if self.functions: + children = '\n'.join(v.tab_level(tabs + 1, '[method] ' + k, num) for k, v in self.functions.items()) + else: + children = '\n'.join(child.tab_level(tabs + 1, num, num + 1) for child in self.children) + return "\t" * (tabs-1) + f'{name}' + "\t" * tabs + f'\n{res}\n{children}' + + def __repr__(self): + return str(self) + + def create_child(self): + child = Scope(self) + self.children.append(child) + return child + + def define_variable(self, vname, vtype) -> VariableInfo: + info = VariableInfo(vname, vtype) + if info not in self.locals: + self.locals.append(info) + return info + + def find_variable(self, vname, index=None) -> VariableInfo: + locals = self.attributes + self.locals + locals = locals if index is None else itt.islice(locals, index) + try: + return next(x for x in locals if x.name == vname) + except StopIteration: + return self.parent.find_variable(vname, index) if self.parent is not None else None + + def find_local(self, vname, index=None) -> VariableInfo: + 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_local(vname, self.index) if self.parent is not None else None + + def find_attribute(self, vname, index=None): + locals = self.attributes if index is None else itt.islice(self.attributes, index) + try: + return next(x for x in locals if x.name == vname) + except StopIteration: + return self.parent.find_attribute(vname, index) if self.parent is not None else None + + + def get_class_scope(self): + if self.parent == None or self.parent.parent == None: + return self + return self.parent.get_class_scope() + + def is_defined(self, vname) -> VariableInfo: + return self.find_variable(vname) is not None + + def is_local(self, vname): + return any(True for x in self.locals if x.name == vname) + + def define_attribute(self, attr): + self.attributes.append(attr) \ No newline at end of file diff --git a/src/semantic/types.py b/src/semantic/types.py new file mode 100644 index 00000000..084db244 --- /dev/null +++ b/src/semantic/types.py @@ -0,0 +1,319 @@ +from utils.errors import SemanticError, AttributesError, TypesError, NamesError +from collections import OrderedDict + +class Attribute: + def __init__(self, name, typex, index, tok=None): + self.name = name + self.type = typex + self.index = index # lugar que ocupa en el scope + self.expr = None + + def __str__(self): + return f'[attrib] {self.name} : {self.type.name};' + + def __repr__(self): + return str(self) + +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 + +class MethodError(Method): + def __init__(self, name, param_names, param_types, return_types): + super().__init__(name, param_names, param_types, return_types) + + def __str__(self): + return f'[method] {self.name} ERROR' + +class Type: + def __init__(self, name:str, pos, parent=True): + if name == 'ObjectType': + return ObjectType(pos) + self.name = name + self.attributes = {} + self.methods = {} + if parent: + self.parent = ObjectType(pos) + else: + self.parent = None + self.pos = pos + + def set_parent(self, parent): + if type(self.parent) != ObjectType and self.parent is not None: + error_text = TypesError.PARENT_ALREADY_DEFINED % self.name + raise TypesError(error_text, *self.pos) + self.parent = parent + + def get_attribute(self, name:str, pos) -> Attribute: + try: + return self.attributes[name] #next(attr for attr in self.attributes if attr.name == name) + except KeyError: + if self.parent is None: + error_text = AttributesError.ATTRIBUTE_NOT_DEFINED % (name, self.name) + raise AttributesError(error_text, *pos) + try: + return self.parent.get_attribute(name, pos) + except AttributesError: + error_text = AttributesError.ATTRIBUTE_NOT_DEFINED % (name, self.name) + raise AttributesError(error_text, *pos) + + def define_attribute(self, name:str, typex, pos): + try: + self.attributes[name] + except KeyError: + try: + self.get_attribute(name, pos) + except SemanticError: + self.attributes[name] = attribute = Attribute(name, typex, len(self.attributes)) + # self.attributes.append(attribute) + return attribute + else: + error_text = SemanticError.ATTR_DEFINED_PARENT % name + raise SemanticError(error_text, *pos) + else: + error_text = SemanticError.ATTRIBUTE_ALREADY_DEFINED % name + raise SemanticError(error_text, *pos) + + def get_method(self, name:str, pos) -> Method: + try: + return self.methods[name] + except KeyError: + error_text = AttributesError.METHOD_NOT_DEFINED %(name, self.name) + if self.parent is None: + raise AttributesError(error_text, *pos) + try: + return self.parent.get_method(name, pos) + except AttributesError: + raise AttributesError(error_text, *pos) + + def define_method(self, name:str, param_names:list, param_types:list, return_type, pos=(0, 0)): + if name in self.methods: + error_text = SemanticError.METHOD_ALREADY_DEFINED % name + raise SemanticError(error_text, *pos) + + method = self.methods[name] = Method(name, param_names, param_types, return_type) + return method + + def change_type(self, method, nparm, newtype): + idx = method.param_names.index(nparm) + method.param_types[idx] = newtype + + def all_attributes(self, clean=True): + plain = OrderedDict() if self.parent is None else self.parent.all_attributes(False) + for attr in self.attributes.values(): + plain[attr.name] = (attr, self) + return plain.values() if clean else plain + + def all_methods(self, clean=True): + plain = OrderedDict() if self.parent is None else self.parent.all_methods(False) + for method in self.methods.values(): + plain[method.name] = (method, self) + return plain.values() if clean else plain + + + 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 __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.values()) + 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 ErrorType(Type): + def __init__(self, pos=(0, 0)): + Type.__init__(self, '', pos) + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, ErrorType) + + def __ne__(self, other): + return not isinstance(other, ErrorType) + +VOID_NAME = 'Void' + +class VoidType(Type): + def __init__(self, pos=(0, 0)): + Type.__init__(self, VOID_NAME, pos) + + def conforms_to(self, other): + return True + + def bypass(self): + return True + + def __eq__(self, other): + return isinstance(other, VoidType) + +class BoolType(Type): + def __init__(self, pos=(0, 0)): + self.name = 'Bool' + self.attributes = {} + self.methods = {} + self.parent = None + self.pos = pos + self.init_methods() + + def init_methods(self): + self.define_method('abort', [], [], self) + self.define_method('type_name', [], [], StringType()) + self.define_method('copy', [], [], SelfType()) + + def conforms_to(self, other): + return other.name == 'Object' or other.name == self.name + + def __eq__(self, other): + return other.name == self.name or isinstance(other, BoolType) + + def __ne__(self, other): + return other.name != self.name and not isinstance(other, BoolType) + + +class SelfType(Type): + def __init__(self, pos=(0, 0)): + self.name = 'Self' + self.attributes = {} + self.methods = {} + self.parent = None + self.pos = pos + + def __eq__(self, other): + return other.name == self.name or isinstance(other, SelfType) + + def __ne__(self, other): + return other.name != self.name and not isinstance(other, SelfType) + + +class IntType(Type): + def __init__(self, pos=(0, 0)): + self.name = 'Int' + self.attributes = {} + self.methods = {} + self.parent = None + self.pos = pos + self.init_methods() + + def init_methods(self): + self.define_method('abort', [], [], self) + self.define_method('type_name', [], [], Type('String', (0, 0), False)) + self.define_method('copy', [], [], SelfType()) + + def conforms_to(self, other): + return other.name == 'Object' or other.name == self.name + + def __eq__(self, other): + return other.name == self.name or isinstance(other, IntType) + + def __ne__(self, other): + return other.name != self.name and not isinstance(other, IntType) + + +class StringType(Type): + def __init__(self, pos=(0, 0)): + self.name = 'String' + self.attributes = {} + self.methods = {} + self.parent = None + self.pos = pos + self.init_methods() + + def init_methods(self): + self.define_method('abort', [], [], self) + self.define_method('type_name', [], [], self) + self.define_method('copy', [], [], SelfType()) + self.define_method('length', [], [], IntType()) + self.define_method('concat', ['s'], [self], self) + self.define_method('substr', ['i', 'l'], [IntType(), IntType()], self) + + def conforms_to(self, other): + return other.name == 'Object' or other.name == self.name + + def __eq__(self, other): + return other.name == self.name or isinstance(other, StringType) + + def __ne__(self, other): + return other.name != self.name and not isinstance(other, StringType) + + +class ObjectType(Type): + def __init__(self, pos=(0, 0)): + self.name = 'Object' + self.attributes = {} + self.methods = {} + self.parent = None + self.pos = pos + self.init_methods() + + def init_methods(self): + self.define_method('abort', [], [], self) + self.define_method('type_name', [], [], StringType()) + self.define_method('copy', [], [], SelfType()) + + def __eq__(self, other): + return other.name == self.name or isinstance(other, ObjectType) + + def __ne__(self, other): + return other.name != self.name and not isinstance(other, ObjectType) + +class AutoType(Type): + def __init__(self): + Type.__init__(self, 'AUTO_TYPE') + + def __eq__(self, other): + return other.name == self.name or isinstance(other, AutoType) + + def __ne__(self, other): + return other.name != self.name and not isinstance(other, AutoType) + + +class IOType(Type): + def __init__(self, pos=(0, 0)): + self.name = 'IO' + self.attributes = {} + self.methods = {} + self.parent = ObjectType(pos) + self.pos = pos + self.init_methods() + + def init_methods(self): + self.define_method('out_string', ['x'], [StringType()], SelfType()) + self.define_method('out_int', ['x'], [IntType()], SelfType()) + self.define_method('in_string', [], [], StringType()) + self.define_method('in_int', [], [], IntType()) + + def __eq__(self, other): + return other.name == self.name or isinstance(other, IOType) + + def __ne__(self, other): + return other.name != self.name and not isinstance(other, IOType) diff --git a/src/semantic/visitors/__init__.py b/src/semantic/visitors/__init__.py new file mode 100644 index 00000000..0aed9818 --- /dev/null +++ b/src/semantic/visitors/__init__.py @@ -0,0 +1,5 @@ +# from semantic.visitors.type_collector import TypeCollector +# from semantic.visitors.type_builder import TypeBuilder +# from semantic.visitors.var_collector import VarCollector +# from semantic.visitors.type_checker import TypeChecker +# from semantic.visitors.selftype_visitor import SelfTypeVisitor diff --git a/src/semantic/visitors/format_visitor.py b/src/semantic/visitors/format_visitor.py new file mode 100644 index 00000000..ae260a7d --- /dev/null +++ b/src/semantic/visitors/format_visitor.py @@ -0,0 +1,128 @@ +from utils import visitor +from utils.ast import * + +class FormatVisitor(object): + @visitor.on('node') + def visit(self, node, tabs): + ans = '\t' * tabs + f'\\__{node.__class__.__name__}' + return ans + + @visitor.when(ProgramNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ProgramNode [ ... ]' + statements = '\n'.join(self.visit(child, tabs + 1) for child in node.declarations) + return f'{ans}\n{statements}' + + @visitor.when(ClassDeclarationNode) + def visit(self, node, tabs=0): + parent = '' if node.parent is None else f": {node.parent}" + ans = '\t' * tabs + f'\\__ClassDeclarationNode: class {node.id} {parent} {{ ... }}' + features = '\n'.join(self.visit(child, tabs + 1) for child in node.features) + return f'{ans}\n{features}' + + @visitor.when(AttrDeclarationNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__AttrDeclarationNode: {node.id} : {node.type}' + return f'{ans}' + + @visitor.when(VarDeclarationNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__VarDeclarationNode: {node.id} : {node.type} = ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(AssignNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__AssignNode: {node.id} <- ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(FuncDeclarationNode) + def visit(self, node, tabs=0): + params = ', '.join(':'.join(param) for param in node.params) + ans = '\t' * tabs + f'\\__FuncDeclarationNode: {node.id}({params}) : {node.type} -> ' + body = f'{self.visit(node.body, tabs + 1)}' + # body = f'\n'#{self.visit(node.body, tabs + 1)}' #.join(self.visit(child, tabs + 1) for child in node.body) + return f'{ans}\n{body}' + + @visitor.when(BinaryNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ {node.__class__.__name__} ' + left = self.visit(node.left, tabs + 1) + right = self.visit(node.right, tabs + 1) + return f'{ans}\n{left}\n{right}' + + @visitor.when(UnaryNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__{node.__class__.__name__} ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(WhileNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__{node.__class__.__name__}: while loop pool' + cond = self.visit(node.cond, tabs + 1) + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{cond}\n{expr}' + + @visitor.when(ConditionalNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ {node.__class__.__name__}: if then else fi' + cond = self.visit(node.cond, tabs + 1) + stm = self.visit(node.stm, tabs + 1) + else_stm = self.visit(node.else_stm, tabs + 1) + return f'{ans}\n{cond}\n{stm}\n{else_stm}' + + @visitor.when(CaseNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ {node.__class__.__name__}: case of esac' + expr = self.visit(node.expr, tabs + 1) + case_list = '\n'.join(self.visit(child, tabs + 1) for child in node.case_list) + return f'{ans}\n{expr}\n{case_list}' + + @visitor.when(OptionNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.id} : {node.typex} -> ' + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{expr}' + + @visitor.when(BlockNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ {node.__class__.__name__} ' + '{ }' + expr = '\n'.join(self.visit(child, tabs + 1) for child in node.expr_list) + return f'{ans}\n{expr}' + + @visitor.when(AtomicNode) + def visit(self, node, tabs=0): + return '\t' * tabs + f'\\__ {node.__class__.__name__}: {node.lex}' + + @visitor.when(BaseCallNode) + def visit(self, node, tabs=0): + obj = self.visit(node.obj, tabs + 1) + ans = '\t' * tabs + f'\\__BaseCallNode: @{node.type}.{node.id}(, ..., )' + args = '\n'.join(self.visit(arg, tabs + 1) for arg in node.args) + return f'{ans}\n{obj}\n{args}' + + @visitor.when(CallNode) + def visit(self, node, tabs=0): + obj = self.visit(node.obj, tabs + 1) + ans = '\t' * tabs + f'\\__CallNode: .{node.id}(, ..., )' + args = '\n'.join(self.visit(arg, tabs + 1) for arg in node.args) + return f'{ans}\n{obj}\n{args}' + + @visitor.when(StaticCallNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__StaticCallNode: {node.id}(, ..., )' + args = '\n'.join(self.visit(arg, tabs + 1) for arg in node.args) + return f'{ans}\n{args}' + + @visitor.when(InstantiateNode) + def visit(self, node, tabs=0): + return '\t' * tabs + f'\\__ InstantiateNode: new {node.lex}()' + + @visitor.when(LetNode) + def visit(self, node, tabs=0): + ans = '\t' * tabs + f'\\__ {node.__class__.__name__} let in ' + init_list = '\n'.join(self.visit(arg, tabs + 1) for arg in node.init_list) + expr = self.visit(node.expr, tabs + 1) + return f'{ans}\n{init_list}\n{expr}' diff --git a/src/semantic/visitors/type_builder.py b/src/semantic/visitors/type_builder.py new file mode 100644 index 00000000..a3609242 --- /dev/null +++ b/src/semantic/visitors/type_builder.py @@ -0,0 +1,102 @@ +from utils.errors import SemanticError, AttributesError, TypesError, NamesError +from semantic.types import Type, VoidType, ErrorType, Attribute, Method +from semantic.tools import Context +from utils import visitor, is_basic_type +from utils.ast import * + +class TypeBuilder: + def __init__(self, context:Context, errors=[]): + self.context:Context = context + self.current_type:Type = None + self.errors:list = errors + + @visitor.on('node') + def visit(self, node): + pass + + @visitor.when(ProgramNode) + def visit(self, node:ProgramNode): + for dec in node.declarations: + self.visit(dec) + + @visitor.when(ClassDeclarationNode) + def visit(self, node:ClassDeclarationNode): + try: + self.current_type = self.context.get_type(node.id, node.pos) + except SemanticError as e: + self.current_type = ErrorType() + self.errors.append(e) + + + if node.parent is not None: + if node.parent in ['Int', 'Bool', 'String']: + error_text = SemanticError.INHERIT_ERROR % (node.id, node.parent) + self.errors.append(SemanticError(error_text, *node.parent_pos)) + try: + parent = self.context.get_type(node.parent, node.parent_pos) + except SemanticError: + error_text = TypesError.INHERIT_UNDEFINED % (node.id, node.parent) + self.errors.append(TypesError(error_text, *node.parent_pos)) + parent = None + try: + current = parent + while current is not None: + if current.name == self.current_type.name: + error_text = SemanticError.CIRCULAR_DEPENDENCY %(self.current_type.name, self.current_type.name) + raise SemanticError(error_text, *node.pos) + current = current.parent + except SemanticError as e: + parent = ErrorType() + self.errors.append(e) + self.current_type.set_parent(parent) + + for feature in node.features: + self.visit(feature) + + + @visitor.when(FuncDeclarationNode) + def visit(self, node:FuncDeclarationNode): + args_names = [] + args_types = [] + for name, type_ in node.params: + if name in args_names: + error_text = SemanticError.PARAMETER_MULTY_DEFINED % name + self.errors.append(SemanticError(error_text, *type_.pos)) + args_names.append(name) + + try: + arg_type = self.context.get_type(type_.value, type_.pos) + except SemanticError: + error_text = TypesError.PARAMETER_UNDEFINED % (type_.value, type_.value) + self.errors.append(TypesError(error_text, *type_.pos)) + arg_type = ErrorType() + args_types.append(arg_type) + + try: + return_type = self.context.get_type(node.type, node.type_pos) + except SemanticError as e: + error_text = TypesError.RETURN_TYPE_UNDEFINED % (node.type, node.id) + self.errors.append(TypesError(error_text, *node.type_pos)) + return_type = ErrorType(node.type_pos) + + try: + self.current_type.define_method(node.id, args_names, args_types, return_type, node.pos) + except SemanticError as e: + self.errors.append(e) + + @visitor.when(AttrDeclarationNode) + def visit(self, node:AttrDeclarationNode): + try: + attr_type = self.context.get_type(node.type, node.pos) + except SemanticError as e: + error_text = TypesError.ATTR_TYPE_UNDEFINED %(node.type, node.id) + attr_type = ErrorType(node.type_pos) + self.errors.append(TypesError(error_text, *node.type_pos)) + + if node.id == 'self': + self.errors.append(SemanticError(SemanticError.SELF_ATTR, *node.pos)) + + try: + self.current_type.define_attribute(node.id, attr_type, node.pos) + except SemanticError as e: + self.errors.append(e) \ No newline at end of file diff --git a/src/semantic/visitors/type_checker.py b/src/semantic/visitors/type_checker.py new file mode 100644 index 00000000..662d28c5 --- /dev/null +++ b/src/semantic/visitors/type_checker.py @@ -0,0 +1,385 @@ +from utils import visitor +from semantic.tools import * +from semantic.types import * +from utils.ast import * +from utils.errors import SemanticError, AttributesError, TypesError, NamesError +from utils import get_type, get_common_basetype + + +class TypeChecker: + def __init__(self, context:Context, errors=[]): + self.context:Context = context + self.current_type:Type = None + self.current_method:Method = None + self.errors = errors + self.current_index = None # Lleva el índice del scope en el que se está + + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(ProgramNode) + def visit(self, node:ProgramNode, scope:Scope): + for declaration, new_scope in zip(node.declarations, scope.children): + self.visit(declaration, new_scope) + + def _get_type(self, ntype:str, pos): + try: + return self.context.get_type(ntype, pos) + except SemanticError as e: + self.errors.append(e) + return ErrorType() + + def _get_method(self, typex:Type, name:str, pos) -> Method: + try: + return typex.get_method(name, pos) + except SemanticError as e: + if type(typex) != ErrorType and type(typex) != AutoType: + error_text = AttributesError.DISPATCH_UNDEFINED % name + self.errors.append(AttributesError(error_text, *pos)) + return MethodError(name, [], [], ErrorType()) + + + @visitor.when(ClassDeclarationNode) + def visit(self, node:ClassDeclarationNode, scope:Scope): + self.current_type = self.context.get_type(node.id, node.pos) + + fd = [feat for feat in node.features if isinstance(feat, FuncDeclarationNode)] + + for feat in node.features: + if isinstance(feat, AttrDeclarationNode): + self.visit(feat, scope) + + for feat, child_scope in zip(fd, scope.functions.values()): + self.visit(feat, child_scope) + + + @visitor.when(AttrDeclarationNode) + def visit(self, node:AttrDeclarationNode, scope:Scope): + attr = self.current_type.get_attribute(node.id, node.pos) + vartype = get_type(attr.type, self.current_type) + + self.current_index = attr.index + typex = self.visit(node.expr, scope) + self.current_index = None + + if not typex.conforms_to(vartype): + error_text = TypesError.ATTR_TYPE_ERROR %(typex.name, attr.name, vartype.name) + self.errors.append(TypesError(error_text, *node.pos)) + return ErrorType() + return typex + + + @visitor.when(FuncDeclarationNode) + def visit(self, node:FuncDeclarationNode, scope:Scope): + parent = self.current_type.parent + + self.current_method = method = self.current_type.get_method(node.id, node.pos) + if parent is not None: + try: + old_meth = parent.get_method(node.id, node.pos) + if old_meth.return_type.name != method.return_type.name: + error_text = SemanticError.WRONG_SIGNATURE_RETURN % (node.id, method.return_type.name, old_meth.return_type.name) + self.errors.append(SemanticError(error_text, *node.type_pos)) + if len(method.param_names) != len(old_meth.param_names): + error_text = SemanticError.WRONG_NUMBER_PARAM % node.id + self.errors.append(SemanticError(error_text, *node.pos)) + for (name, param), type1, type2 in zip(node.params, method.param_types, old_meth.param_types): + if type1.name != type2.name: + error_text = SemanticError.WRONG_SIGNATURE_PARAMETER % (name, type1.name, type2.name) + self.errors.append(SemanticError(error_text, *param.pos)) + except SemanticError: + pass + + result = self.visit(node.body, scope) + + return_type = get_type(method.return_type, self.current_type) + + if not result.conforms_to(return_type): + error_text = TypesError.RETURN_TYPE_ERROR %(result.name, return_type.name) + self.errors.append(TypesError(error_text, *node.type_pos)) + + + @visitor.when(VarDeclarationNode) + def visit(self, node:VarDeclarationNode, scope:Scope): + + vtype = self._get_type(node.type, node.type_pos) + vtype = get_type(vtype, self.current_type) + + if node.expr != None: + typex = self.visit(node.expr, scope) + if not typex.conforms_to(vtype): + error_text = TypesError.UNCONFORMS_TYPE %(typex.name, node.id, vtype.name) + self.errors.append(TypesError(error_text, *node.type_pos)) + return typex + return vtype + + + @visitor.when(AssignNode) + def visit(self, node:AssignNode, scope:Scope): + vinfo = self.find_variable(scope, node.id) + vtype = get_type(vinfo.type, self.current_type) + + typex = self.visit(node.expr, scope) + + if not typex.conforms_to(vtype): + error_text = TypesError.UNCONFORMS_TYPE %(typex.name, node.id, vtype.name) + self.errors.append(TypesError(error_text, *node.pos)) + return typex + + + def _check_args(self, meth:Method, scope:Scope, args, pos): + arg_types = [self.visit(arg, scope) for arg in args] + + if len(arg_types) > len(meth.param_types): + error_text = SemanticError.ARGUMENT_ERROR % meth.name + self.errors.append(SemanticError(error_text, *pos)) + elif len(arg_types) < len(meth.param_types): + for arg, arg_info in zip(meth.param_names[len(arg_types):], args[len(arg_types):]): + error_text = SemanticError.ARGUMENT_ERROR % (meth.name) + self.errors.append(SemanticError(error_text, *arg_info.pos)) + + for atype, ptype, param_name in zip(arg_types, meth.param_types, meth.param_names): + if not atype.conforms_to(ptype): + error_text = TypesError.INCOSISTENT_ARG_TYPE % (meth.name, atype.name, param_name, ptype.name) + self.errors.append(TypesError(error_text, *pos)) + + + @visitor.when(CallNode) + def visit(self, node:CallNode, scope:Scope): + stype = self.visit(node.obj, scope) + + meth = self._get_method(stype, node.id, node.pos) + if not isinstance(meth, MethodError): + self._check_args(meth, scope, node.args, node.pos) + + return get_type(meth.return_type, stype) + + + @visitor.when(BaseCallNode) + def visit(self, node:BaseCallNode, scope:Scope): + obj = self.visit(node.obj, scope) + typex = self._get_type(node.type, node.type_pos) + + if not obj.conforms_to(typex): + error_text = TypesError.INCOMPATIBLE_TYPES_DISPATCH % (typex.name, obj.name) + self.errors.append(TypesError(error_text, *node.type_pos)) + return ErrorType() + + meth = self._get_method(typex, node.id, node.pos) + if not isinstance(meth, MethodError): + self._check_args(meth, scope, node.args, node.pos) + + return get_type(meth.return_type, typex) + + + @visitor.when(StaticCallNode) + def visit(self, node:StaticCallNode, scope:Scope): + typex = self.current_type + + meth = self._get_method(typex, node.id, node.pos) + if not isinstance(meth, MethodError): + self._check_args(meth, scope, node.args, node.pos) + + return get_type(meth.return_type, typex) + + + @visitor.when(ConstantNumNode) + def visit(self, node:ConstantNumNode, scope:Scope): + return IntType(node.pos) + + + @visitor.when(ConstantBoolNode) + def visit(self, node:ConstantBoolNode, scope:Scope): + return BoolType(node.pos) + + + @visitor.when(ConstantStrNode) + def visit(self, node:ConstantStrNode, scope:Scope): + return StringType(node.pos) + + @visitor.when(ConstantVoidNode) + def visit(self, node:ConstantVoidNode, scope:Scope): + return VoidType(node.pos) + + def find_variable(self, scope, lex): + var_info = scope.find_local(lex) + if var_info is None: + var_info = scope.find_attribute(lex) + if lex in self.current_type.attributes and var_info is None: + return VariableInfo(lex, VoidType()) + return var_info + + @visitor.when(VariableNode) + def visit(self, node:VariableNode, scope:Scope): + typex = self.find_variable(scope, node.lex).type + return get_type(typex, self.current_type) + + + @visitor.when(InstantiateNode) + def visit(self, node:InstantiateNode, scope:Scope): + try: + type_ = self.context.get_type(node.lex, node.pos) + except SemanticError: + type_ = ErrorType() + error_text = TypesError.NEW_UNDEFINED_CLASS % node.lex + self.errors.append(TypesError(error_text, *node.pos)) + + return get_type(type_, self.current_type) + + + @visitor.when(WhileNode) + def visit(self, node:WhileNode, scope:Scope): + cond = self.visit(node.cond, scope) + + if cond.name != 'Bool': + self.errors.append(TypesError(TypesError.LOOP_CONDITION_ERROR, *node.pos)) + + self.visit(node.expr, scope) + return ObjectType() + + @visitor.when(IsVoidNode) + def visit(self, node:IsVoidNode, scope:Scope): + self.visit(node.expr, scope) + return BoolType() + + + @visitor.when(ConditionalNode) + def visit(self, node:ConditionalNode, scope:Scope): + cond = self.visit(node.cond, scope) + + if cond.name != 'Bool': + error_text = TypesError.PREDICATE_ERROR % ('if', 'Bool') + self.errors.append(TypesError(error_text, *node.pos)) + + true_type = self.visit(node.stm, scope) + false_type = self.visit(node.else_stm, scope) + + return get_common_basetype([false_type, true_type]) + # if true_type.conforms_to(false_type): + # return false_type + # elif false_type.conforms_to(true_type): + # return true_type + # else: + # error_text = TypesError.INCOMPATIBLE_TYPES % (false_type.name, true_type.name) + # self.errors.append(TypesError(error_text, *node.pos)) + # return ErrorType() + + + @visitor.when(BlockNode) + def visit(self, node:BlockNode, scope:Scope): + value = None + for exp in node.expr_list: + value = self.visit(exp, scope) + return value + + + @visitor.when(LetNode) + def visit(self, node:LetNode, scope:Scope): + child_scope = scope.expr_dict[node] + for init in node.init_list: + self.visit(init, child_scope) + return self.visit(node.expr, child_scope) + + + @visitor.when(CaseNode) + def visit(self, node:CaseNode, scope:Scope): + type_expr = self.visit(node.expr, scope) + + new_scope = scope.expr_dict[node] + types = [] + var_types = [] + for case, c_scope in zip(node.case_list, new_scope.children): + case: OptionNode + t, vt = self.visit(case, c_scope) + types.append(t) + if case.typex in var_types: + error_text = SemanticError.DUPLICATE_CASE_BRANCH % case.typex + self.errors.append(SemanticError(error_text, *case.type_pos)) + var_types.append(case.typex) + + # for t in var_types: + # if not type_expr.conforms_to(t): + # error_text = TypesError.INCOMPATIBLE_TYPES % (t.name, type_expr.name) + # self.errors.append(TypesError(error_text, *node.pos)) + # return ErrorType() + + return get_common_basetype(types) + + + @visitor.when(OptionNode) + def visit(self, node:OptionNode, scope:Scope): + var_info = self.find_variable(scope, node.id) + typex = self.visit(node.expr, scope) + return typex, var_info.type + + + def binary_operation(self, node, scope, operator): + ltype = self.visit(node.left, scope) + rtype = self.visit(node.right, scope) + int_type = IntType() + if ltype != int_type or rtype != int_type: + error_text = TypesError.BOPERATION_NOT_DEFINED %(ltype.name, operator, rtype.name) + self.errors.append(TypesError(error_text, *node.pos)) + return ErrorType() + if operator == '<' or operator == '<=': + return BoolType() + return int_type + + @visitor.when(PlusNode) + def visit(self, node:PlusNode, scope:Scope): + return self.binary_operation(node, scope, '+') + + @visitor.when(MinusNode) + def visit(self, node:MinusNode, scope:Scope): + return self.binary_operation(node, scope, '-') + + @visitor.when(StarNode) + def visit(self, node:StarNode, scope:Scope): + return self.binary_operation(node, scope, '*') + + @visitor.when(DivNode) + def visit(self, node:DivNode, scope:Scope): + return self.binary_operation(node, scope, '/') + + @visitor.when(LessEqNode) + def visit(self, node:DivNode, scope:Scope): + return self.binary_operation(node, scope, '<=') + + @visitor.when(LessNode) + def visit(self, node:DivNode, scope:Scope): + return self.binary_operation(node, scope, '<') + + + @visitor.when(EqualNode) + def visit(self, node:EqualNode, scope:Scope): + ltype = self.visit(node.left, scope) + rtype = self.visit(node.right, scope) + if (ltype == IntType() or rtype == IntType() or ltype == StringType() or rtype == StringType() or ltype == BoolType() or rtype == BoolType()) and ltype != rtype: + error_text = TypesError.COMPARISON_ERROR + self.errors.append(TypesError(error_text, *node.pos)) + return ErrorType() + else: + return BoolType() + + + @visitor.when(NotNode) + def visit(self, node:NotNode, scope:Scope): + ltype = self.visit(node.expr, scope) + typex = BoolType() + if ltype != typex: + error_text = TypesError.UOPERATION_NOT_DEFINED %('not', ltype.name, typex.name) + self.errors.append(TypesError(error_text, *node.pos)) + return ErrorType() + return typex + + + @visitor.when(BinaryNotNode) + def visit(self, node:BinaryNotNode, scope:Scope): + ltype = self.visit(node.expr, scope) + int_type = IntType() + if ltype != int_type: + error_text = TypesError.UOPERATION_NOT_DEFINED %('~', ltype.name, int_type.name) + self.errors.append(TypesError(error_text, *node.pos)) + return ErrorType() + return int_type \ No newline at end of file diff --git a/src/semantic/visitors/type_collector.py b/src/semantic/visitors/type_collector.py new file mode 100644 index 00000000..1f65f418 --- /dev/null +++ b/src/semantic/visitors/type_collector.py @@ -0,0 +1,40 @@ +from utils.errors import SemanticError +from semantic.tools import Context +from utils import visitor +from semantic.types import * +from utils.ast import * + +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:ProgramNode): + self.context = Context() + self.context.types['String'] = StringType() + self.context.types['Int'] = IntType() + self.context.types['Object'] = ObjectType() + self.context.types['Bool'] = BoolType() + self.context.types['SELF_TYPE'] = SelfType() + self.context.types['IO'] = IOType() + # self.context.create_type('SELF_TYPE', (0, 0)) + for dec in node.declarations: + self.visit(dec) + + @visitor.when(ClassDeclarationNode) + def visit(self, node:ClassDeclarationNode): + if node.id in ['String', 'Int', 'Object', 'Bool', 'SELF_TYPE', 'IO']: + error = SemanticError.REDEFINITION_ERROR % node.id + self.errors.append(SemanticError(error, *node.pos)) + try: + self.context.create_type(node.id, node.pos) + except SemanticError as e: + self.errors.append(e) + # añade un como padre Object si este no tiene + if not node.parent: + node.parent = 'Object' diff --git a/src/semantic/visitors/var_collector.py b/src/semantic/visitors/var_collector.py new file mode 100644 index 00000000..5a61e086 --- /dev/null +++ b/src/semantic/visitors/var_collector.py @@ -0,0 +1,249 @@ +from utils import visitor +from semantic.tools import * +from semantic.types import Type, ErrorType, IntType, StringType, BoolType +from utils.errors import SemanticError, AttributesError, TypesError, NamesError +from utils.ast import * +from ply.lex import LexToken + +class VarCollector: + def __init__(self, context=Context, errors=[]): + self.context = context + self.current_type = None + self.current_method = None + self.errors = errors + self.current_index = None # Lleva + + @visitor.on('node') + def visit(self, node, scope): + pass + + @visitor.when(ProgramNode) + def visit(self, node:ProgramNode, scope:Scope=None): + scope = Scope() + for declaration in node.declarations: + self.visit(declaration, scope.create_child()) + return scope + + + def copy_scope(self, scope:Scope, parent:Type): + if parent is None: + return + for attr in parent.attributes.values(): + if scope.find_variable(attr.name) is None: + scope.define_attribute(attr) + self.copy_scope(scope, parent.parent) + + + @visitor.when(ClassDeclarationNode) + def visit(self, node:ClassDeclarationNode, scope:Scope): + self.current_type = self._get_type(node.id, node.pos) + scope.define_variable('self', self.current_type) + + for feat in node.features: + if isinstance(feat, AttrDeclarationNode): + self.visit(feat, scope) + + for attr, _ in self.current_type.all_attributes(): + if scope.find_attribute(attr.name) is None: + scope.define_attribute(attr) + # self.copy_scope(scope, self.current_type.parent) + + for feat in node.features: + if isinstance(feat, FuncDeclarationNode): + self.visit(feat, scope) + + + + def _define_default_value(self, typex, node): + if typex == IntType(): + node.expr = ConstantNumNode(0) + elif typex == StringType(): + node.expr = ConstantStrNode("") + elif typex == BoolType(): + node.expr = ConstantBoolNode('false') + else: + node.expr = ConstantVoidNode(node.id) + + @visitor.when(AttrDeclarationNode) + def visit(self, node:AttrDeclarationNode, scope:Scope): + attr = self.current_type.get_attribute(node.id, node.pos) + if node.expr is None: + self._define_default_value(attr.type, node) + else: + self.visit(node.expr, scope) + attr.expr = node.expr + scope.define_attribute(attr) + + + @visitor.when(FuncDeclarationNode) + def visit(self, node:FuncDeclarationNode, scope:Scope): + # Ver si el método está definido en el padre + parent = self.current_type.parent + pnames = [param[0] for param in node.params] + ptypes = [param[1] for param in node.params] + + self.current_method = self.current_type.get_method(node.id, node.pos) + + new_scope = scope.create_child() + scope.functions[node.id] = new_scope + + # Añadir las variables de argumento + for pname, ptype in node.params: + if pname == 'self': + self.errors.append(SemanticError(SemanticError.SELF_PARAM, *ptype.pos)) + new_scope.define_variable(pname, self._get_type(ptype.value, ptype.pos)) + + self.visit(node.body, new_scope) + + + def _get_type(self, ntype, pos): + try: + return self.context.get_type(ntype, pos) + except SemanticError as e: + self.errors.append(e) + return ErrorType() + + + @visitor.when(VarDeclarationNode) + def visit(self, node:VarDeclarationNode, scope:Scope): + if node.id == 'self': + error_text = SemanticError.SELF_IN_LET + self.errors.append(SemanticError(error_text, *node.pos)) + return + + try: + vtype = self.context.get_type(node.type, node.pos) + except SemanticError: + error_text = TypesError.UNDEFINED_TYPE_LET % (node.type, node.id) + self.errors.append(TypesError(error_text, *node.type_pos)) + vtype = ErrorType() + + vtype = self._get_type(node.type, node.type_pos) + var_info = scope.define_variable(node.id, vtype) + + if node.expr is not None: + self.visit(node.expr, scope) + else: + self._define_default_value(vtype, node) + + + @visitor.when(AssignNode) + def visit(self, node:AssignNode, scope:Scope): + if node.id == 'self': + error_text = SemanticError.SELF_IS_READONLY + self.errors.append(SemanticError(error_text, *node.pos)) + return + + vinfo = scope.find_variable(node.id) + if vinfo is None: + var_info = scope.find_attribute(node.id) + if var_info is None: + error_text = NamesError.VARIABLE_NOT_DEFINED %(node.id) + self.errors.append(NamesError(error_text, *node.pos)) + vtype = ErrorType() + scope.define_variable(node.id, vtype) + + self.visit(node.expr, scope) + + @visitor.when(BlockNode) + def visit(self, node:BlockNode, scope:Scope): + for exp in node.expr_list: + self.visit(exp, scope) + + + @visitor.when(LetNode) + def visit(self, node:LetNode, scope:Scope): + n_scope = scope.create_child() + scope.expr_dict[node] = n_scope + for init in node.init_list: + self.visit(init, n_scope) + + self.visit(node.expr, n_scope) + + #no necesario + @visitor.when(BinaryNode) + def visit(self, node:BinaryNode, scope:Scope): + self.visit(node.left, scope) + self.visit(node.right, scope) + + + @visitor.when(UnaryNode) + def visit(self, node:UnaryNode, scope:Scope): + self.visit(node.expr, scope) + + + @visitor.when(VariableNode) + def visit(self, node:VariableNode, scope:Scope): + try: + return self.current_type.get_attribute(node.lex, node.pos).type + except AttributesError: + if not scope.is_defined(node.lex): + error_text = NamesError.VARIABLE_NOT_DEFINED %(node.lex) + self.errors.append(NamesError(error_text, *node.pos)) + vinfo = scope.define_variable(node.lex, ErrorType(node.pos)) + else: + vinfo = scope.find_variable(node.lex) + return vinfo.type + + + @visitor.when(WhileNode) + def visit(self, node:WhileNode, scope:Scope): + self.visit(node.cond, scope) + self.visit(node.expr, scope) + + + @visitor.when(ConditionalNode) + def visit(self, node:ConditionalNode, scope:Scope): + self.visit(node.cond, scope) + self.visit(node.stm, scope) + self.visit(node.else_stm, scope) + + @visitor.when(IsVoidNode) + def visit(self, node:IsVoidNode, scope:Scope): + self.visit(node.expr, scope) + + @visitor.when(CallNode) + def visit(self, node:CallNode, scope:Scope): + self.visit(node.obj, scope) + for arg in node.args: + self.visit(arg, scope) + + + @visitor.when(BaseCallNode) + def visit(self, node:BaseCallNode, scope:Scope): + self.visit(node.obj, scope) + for arg in node.args: + self.visit(arg, scope) + + + @visitor.when(StaticCallNode) + def visit(self, node:StaticCallNode, scope:Scope): + for arg in node.args: + self.visit(arg, scope) + + + @visitor.when(CaseNode) + def visit(self, node:CaseNode, scope:Scope): + self.visit(node.expr, scope) + + new_scp = scope.create_child() + scope.expr_dict[node] = new_scp + + for case in node.case_list: + self.visit(case, new_scp.create_child()) + + + @visitor.when(OptionNode) + def visit(self, node:OptionNode, scope:Scope): + try: + typex = self.context.get_type(node.typex, node.type_pos) + except TypesError: + error_txt = TypesError.CLASS_CASE_BRANCH_UNDEFINED % node.typex + self.errors.append(TypesError(error_txt, *node.type_pos)) + typex = ErrorType() + + scope.define_variable(node.id, typex) + self.visit(node.expr, scope) + + + \ No newline at end of file diff --git a/src/test.mips b/src/test.mips new file mode 100644 index 00000000..405a0a47 --- /dev/null +++ b/src/test.mips @@ -0,0 +1,1320 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_n_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_a_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# local_Main_Main_internal_1 <- Type of 1 +la $t0, type_Int +lw $t1, -12($fp) +# Saves in local_Main_Main_internal_2 data_0 +la $t1, data_0 +# local_Main_Main_internal_1 <- local_Main_Main_internal_1 = local_Main_Main_internal_2 +move $t8, $t0 +move $t9, $t1 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t0, $v0 +# If local_Main_Main_internal_1 goto error__50 +sw $t0, -8($fp) +sw $t1, -12($fp) +bnez $t0, error__50 +lw $t0, -16($fp) +# Comparing value types in case node +la $t9, type_Object +la $t8, type_Main +beq $t9, $t8, true_7 +la $t9, type_Int +beq $t9, $t8, true_7 +li $t0, 0 +j end_7 +true_7: +li $t0, 1 +end_7: +# If not local_Main_Main_internal_3 goto next__56_0 +sw $t0, -16($fp) +beqz $t0, next__56_0 +lw $t0, -20($fp) +# Moving 1 to local_Main_Main_n_4 +li $t0, 1 +sw $t0, -20($fp) +lw $t1, -28($fp) +# local_Main_Main_internal_6 <- Type of local_Main_Main_n_4 +la $t1, type_Int +lw $t2, -32($fp) +# Saves in local_Main_Main_internal_7 data_0 +la $t2, data_0 +# local_Main_Main_internal_6 <- local_Main_Main_internal_6 = local_Main_Main_internal_7 +move $t8, $t1 +move $t9, $t2 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t1, $v0 +# If not local_Main_Main_internal_6 goto continue__63 +sw $t0, -20($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +beqz $t1, continue__63 +la $a0, dispatch_error +j .raise +continue__63: +lw $t0, -20($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Main_Main_internal_5 to local_Main_Main_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -24($fp) +sw $t1, -4($fp) +j end__50 +next__56_0: +lw $t0, -36($fp) +# Comparing value types in case node +la $t9, type_Object +la $t8, type_Int +beq $t9, $t8, true_9 +la $t9, type_Int +beq $t9, $t8, true_9 +li $t0, 0 +j end_9 +true_9: +li $t0, 1 +end_9: +# If not local_Main_Main_internal_8 goto next__76_1 +sw $t0, -36($fp) +beqz $t0, next__76_1 +lw $t0, -40($fp) +# Moving 1 to local_Main_Main_a_9 +li $t0, 1 +sw $t0, -40($fp) +lw $t1, -48($fp) +# local_Main_Main_internal_11 <- Type of local_Main_Main_a_9 +la $t1, type_Int +lw $t2, -52($fp) +# Saves in local_Main_Main_internal_12 data_0 +la $t2, data_0 +# local_Main_Main_internal_11 <- local_Main_Main_internal_11 = local_Main_Main_internal_12 +move $t8, $t1 +move $t9, $t2 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t1, $v0 +# If not local_Main_Main_internal_11 goto continue__83 +sw $t0, -40($fp) +sw $t1, -48($fp) +sw $t2, -52($fp) +beqz $t1, continue__83 +la $a0, dispatch_error +j .raise +continue__83: +lw $t0, -44($fp) +# Static Dispatch of the method type_name +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -40($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -40($fp) +# This function will consume the arguments +jal function_type_name_Int +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Main_Main_internal_10 to local_Main_Main_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -44($fp) +sw $t1, -4($fp) +j end__50 +next__76_1: +la $a0, case_error +j .raise +error__50: +la $a0, case_void_error +j .raise +end__50: +lw $t0, -4($fp) +lw $t1, -0($fp) +# self . a <- SET local_Main_Main_internal_0 +sw $t0, 12($t1) +lw $t2, -56($fp) +# Moving self to local_Main_Main_internal_13 +move $t2, $t1 +sw $t2, -56($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -56($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_a_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_main_Main_a_0 <- GET self . a +lw $t1, 12($t0) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/src/utils/__init__.py b/src/utils/__init__.py new file mode 100644 index 00000000..172e19fb --- /dev/null +++ b/src/utils/__init__.py @@ -0,0 +1 @@ +from utils.utils import get_common_basetype, get_type, find_column, path_to_objet, is_basic_type \ No newline at end of file diff --git a/src/utils/__pycache__/visitor.cpython-37.pyc b/src/utils/__pycache__/visitor.cpython-37.pyc new file mode 100644 index 00000000..55a64898 Binary files /dev/null and b/src/utils/__pycache__/visitor.cpython-37.pyc differ diff --git a/src/utils/ast.py b/src/utils/ast.py new file mode 100644 index 00000000..1ab0b92b --- /dev/null +++ b/src/utils/ast.py @@ -0,0 +1,231 @@ +from ply.lex import LexToken + +class Node: + pass + +class ProgramNode(Node): + def __init__(self, declarations): + self.declarations = declarations + +class DeclarationNode(Node): + pass + +class ExpressionNode(Node): + pass + +class ErrorNode(Node): + pass + +class ClassDeclarationNode(DeclarationNode): + def __init__(self, idx:LexToken, features, parent=None): + self.id = idx.value + self.pos = (idx.lineno, idx.column) + if parent: + self.parent = parent.value + self.parent_pos = (parent.lineno, parent.column) + else: + self.parent = None + self.parent_pos = (0, 0) + self.features = features + self.token = idx + +class _Param: + def __init__(self, tok): + self.value = tok.value + self.pos = (tok.lineno, tok.column) + +class FuncDeclarationNode(DeclarationNode): + def __init__(self, idx:LexToken, params, return_type:LexToken, body): + self.id = idx.value + self.pos = (idx.lineno, idx.column) + self.params = [(pname.value, _Param(ptype)) for pname, ptype in params] + self.type = return_type.value + self.type_pos = (return_type.lineno, return_type.column) + self.body = body + + +class AttrDeclarationNode(DeclarationNode): + def __init__(self, idx:LexToken, typex, expr=None): + self.id = idx.value + self.pos = (idx.lineno, idx.column) + self.type = typex.value + self.type_pos = (typex.lineno, typex.column) + self.expr = expr + self.token = idx + +class VarDeclarationNode(ExpressionNode): + def __init__(self, idx:LexToken, typex, expr=None): + self.id = idx.value + self.pos = (idx.lineno, idx.column) + self.type = typex.value + self.type_pos = (typex.lineno, typex.column) + self.expr = expr + +class AssignNode(ExpressionNode): + def __init__(self, idx:LexToken, expr): + if isinstance(idx, LexToken): + self.id = idx.value + self.pos = (idx.lineno, idx.column) + else: + self.id = idx + self.pos = None + self.expr = expr + +class CallNode(ExpressionNode): + def __init__(self, obj, idx:LexToken, args): + self.obj = obj + self.id = idx.value + self.pos = (idx.lineno, idx.column) + self.args = args + +class BlockNode(ExpressionNode): + def __init__(self, expr_list, tok): + self.expr_list = expr_list + self.pos = (tok.lineno, tok.column) + self.token = tok + +class BaseCallNode(ExpressionNode): + def __init__(self, obj, typex:LexToken, idx:LexToken, args): + self.obj = obj + self.id = idx.value + self.pos = (idx.lineno, idx.column) + self.args = args + self.type = typex.value + self.type_pos = (typex.lineno, typex.column) + + +class StaticCallNode(ExpressionNode): + def __init__(self, idx:LexToken, args): + self.id = idx.value + self.pos = (idx.lineno, idx.column) + self.args = args + + +class AtomicNode(ExpressionNode): + def __init__(self, lex): + try: + self.lex = lex.value + self.pos = (lex.lineno, lex.column) + except AttributeError: + self.lex = lex + self.pos = (0, 0) + +class BinaryNode(ExpressionNode): + def __init__(self, left, right): + self.left = left + self.right = right + self.pos = left.pos + +class BinaryLogicalNode(BinaryNode): + pass + +class BinaryArithNode(BinaryNode): + pass + +class UnaryNode(ExpressionNode): + def __init__(self, expr, tok): + self.expr = expr + self.pos = (tok.lineno, tok.column) + +class UnaryLogicalNode(UnaryNode): + pass + +class UnaryArithNode(UnaryNode): + pass + +# -------- + +class WhileNode(ExpressionNode): + def __init__(self, cond, expr, tok): + self.cond = cond + self.expr = expr + self.pos = (tok.lineno, tok.column) + +class ConditionalNode(ExpressionNode): + def __init__(self, cond, stm, else_stm, tok): + self.cond = cond + self.stm = stm + self.else_stm = else_stm + self.pos = (tok.lineno, tok.column) + +class CaseNode(ExpressionNode): + def __init__(self, expr, case_list, tok): + self.expr = expr + self.case_list = case_list + self.pos = (tok.lineno, tok.column) + + def __hash__(self): + return id(self) + +class OptionNode(ExpressionNode): + def __init__(self, idx:LexToken, typex, expr): + self.id = idx.value + self.pos = (idx.lineno, idx.column) + self.typex = typex.value + self.type_pos = (typex.lineno, typex.column) + self.expr = expr + + +class LetNode(ExpressionNode): + def __init__(self, init_list, expr, tok): + self.init_list = init_list + self.expr = expr + self.pos = (tok.lineno, tok.column) + + def __hash__(self): + return id(self) + +class ConstantNumNode(AtomicNode): + pass + +class ConstantBoolNode(AtomicNode): + pass + +class ConstantStrNode(AtomicNode): + pass + +class ConstantVoidNode(AtomicNode): + def __init__(self, obj): + super().__init__(obj) + +class SelfNode(Node): + pass + +class VariableNode(AtomicNode): + pass + +class TypeNode(AtomicNode): + pass + +class InstantiateNode(AtomicNode): + pass + +class BinaryNotNode(UnaryArithNode): + pass + +class NotNode(UnaryLogicalNode): + pass + +class IsVoidNode(UnaryLogicalNode): + pass + +class PlusNode(BinaryArithNode): + pass + +class MinusNode(BinaryArithNode): + pass + +class StarNode(BinaryArithNode): + pass + +class DivNode(BinaryArithNode): + pass + +class LessNode(BinaryLogicalNode): + pass + +class LessEqNode(BinaryLogicalNode): + pass + +class EqualNode(BinaryLogicalNode): + pass \ No newline at end of file diff --git a/src/utils/errors.py b/src/utils/errors.py new file mode 100644 index 00000000..0b12465c --- /dev/null +++ b/src/utils/errors.py @@ -0,0 +1,145 @@ +class CoolError(Exception): + def __init__(self, text, line, column): + super().__init__(text) + self.line = line + self.column = column + + @property + def error_type(self): + return 'CoolError' + + @property + def text(self): + return self.args[0] + + def __str__(self): + return f'({self.line}, {self.column}) - {self.error_type}: {self.text}' + + def __repr__(self): + return str(self) + + +class CompilerError(CoolError): + 'Se reporta al presentar alguna anomalia con la entrada del compilador' + + UNKNOWN_FILE = 'The file "%s" does not exist' + + @property + def error_type(self): + return 'CompilerError' + + +class LexicographicError(CoolError): + 'Errores detectados por el lexer' + + UNKNOWN_TOKEN = 'ERROR "%s"' + UNDETERMINATED_STRING = 'Undeterminated string constant' + EOF_COMMENT = 'EOF in comment' + EOF_STRING = 'EOF in string constant' + NULL_STRING = 'String contains null character' + + @property + def error_type(self): + return 'LexicographicError' + + +class SyntaticError(CoolError): + 'Errores detectados en el cool_parser' + + ERROR = 'ERROR at or near "%s"' + + @property + def error_type(self): + return 'SyntacticError' + + +class SemanticError(CoolError): + 'Otros errores semanticos' + + SELF_IS_READONLY = 'Cannot assign to \'self\'.' + SELF_IN_LET = '\'self\' cannot be bound in a \'let\' expression.' + SELF_PARAM = "'self' cannot be the name of a formal parameter." + SELF_ATTR = "'self' cannot be the name of an attribute." + + LOCAL_ALREADY_DEFINED = 'Variable "%s" is already defined in method "%s".' + ARGUMENT_ERROR = 'Method %s called with wrong number of arguments.' + + REDEFINITION_ERROR = 'Redefinition of basic class %s' + INHERIT_ERROR = 'Class %s cannot inherit class %s.' + + DUPLICATE_CASE_BRANCH = 'Duplicate branch %s in case statement.' + TYPE_ALREADY_DEFINED = 'Classes may not be redefined.' + + ATTRIBUTE_ALREADY_DEFINED = 'Attribute "%s" is multiply defined in class.' + ATTR_DEFINED_PARENT = 'Attribute %s is an attribute of an inherited class.' + + METHOD_ALREADY_DEFINED = 'Method "%s" is multiply defined.' + + CIRCULAR_DEPENDENCY = 'Class %s, or an ancestor of %s, is involved in an inheritance cycle.' + + WRONG_SIGNATURE_RETURN = 'In redefined method %s, return type %s is different from original return type %s.' + WRONG_NUMBER_PARAM = 'Incompatible number of formal parameters in redefined method %s.' + + PARAMETER_MULTY_DEFINED = 'Formal parameter %s is multiply defined.' + WRONG_SIGNATURE_PARAMETER = 'In redefined method %s, parameter type %s is different from original type %s.' + + + @property + def error_type(self): + return 'SemanticError' + + +class NamesError(SemanticError): + 'Se reporta al referenciar a un identificador en un ambito en el que no es visible' + + VARIABLE_NOT_DEFINED = 'Undeclared identifier %s.' + + @property + def error_type(self): + return 'NameError' + + +class TypesError(SemanticError): + 'Se reporta al detectar un problema de tipos' + + INCOMPATIBLE_TYPES = 'Cannot convert "%s" into "%s".' + + ATTR_TYPE_ERROR = 'Inferred type %s of initialization of attribute %s does not conform to declared type %s.' + ATTR_TYPE_UNDEFINED = 'Class %s of attribute %s is undefined.' + BOPERATION_NOT_DEFINED = 'non-Int arguments: %s %s %s.' + COMPARISON_ERROR = 'Illegal comparison with a basic type.' + UOPERATION_NOT_DEFINED = 'Argument of \'%s\' has type %s instead of %s.' + CLASS_CASE_BRANCH_UNDEFINED = 'Class %s of case branch is undefined.' + PREDICATE_ERROR = 'Predicate of \'%s\' does not have type %s.' + INCOSISTENT_ARG_TYPE = 'In call of method %s, type %s of parameter %s does not conform to declared type %s.' + INCOMPATIBLE_TYPES_DISPATCH = 'Expression type %s does not conform to declared static dispatch type %s.' + INHERIT_UNDEFINED = 'Class %s inherits from an undefined class %s.' + UNCONFORMS_TYPE = 'Inferred type %s of initialization of %s does not conform to identifier\'s declared type %s.' + UNDEFINED_TYPE_LET = 'Class %s of let-bound identifier %s is undefined.' + LOOP_CONDITION_ERROR = 'Loop condition does not have type Bool.' + RETURN_TYPE_ERROR = 'Inferred return type %s of method test does not conform to declared return type %s.' + PARAMETER_UNDEFINED = 'Class %s of formal parameter %s is undefined.' + RETURN_TYPE_UNDEFINED = 'Undefined return type %s in method %s.' + NEW_UNDEFINED_CLASS = '\'new\' used with undefined class %s.' + + PARENT_ALREADY_DEFINED = 'Parent type is already set for "%s"' + TYPE_NOT_DEFINED = 'Type "%s" is not defined.' + + @property + def error_type(self): + return 'TypeError' + + +class AttributesError(SemanticError): + 'Se reporta cuando un atributo o método se referencia pero no está definido' + + DISPATCH_UNDEFINED = 'Dispatch to undefined method %s.' + + + METHOD_NOT_DEFINED = 'Method "%s" is not defined in "%s"' + ATTRIBUTE_NOT_DEFINED = 'Attribute "%s" is not defined in %s' + + @property + def error_type(self): + return 'AttributeError' + \ No newline at end of file diff --git a/src/utils/tokens.py b/src/utils/tokens.py new file mode 100644 index 00000000..747cc5f1 --- /dev/null +++ b/src/utils/tokens.py @@ -0,0 +1,61 @@ +reserved = { + 'class': 'class', + 'else': 'else', + 'false': 'false', + 'fi': 'fi', + 'if': 'if', + 'in': 'in', + 'inherits': 'inherits', + 'isvoid': 'isvoid', + 'let': 'let', + 'loop': 'loop', + 'pool': 'pool', + 'then': 'then', + 'while': 'while', + 'case': 'case', + 'esac': 'esac', + 'new': 'new', + 'of': 'of', + 'not': 'not', + 'true': 'true' +} + +tokens = [ + 'semi', # '; ' + 'colon', # ': ' + 'comma', # ', ' + 'dot', # '. ' + 'opar', # '( ' + 'cpar', # ') ' + 'ocur', # '{' + 'ccur', # '} ' + 'larrow', # '<-' + 'arroba', # '@' + 'rarrow', # '=> ' + 'nox', # '~' + 'equal', # '=' + 'plus', # '+' + 'minus', # '-' + 'star', # '\*' + 'div', # '/ ' + 'less', # '<' + 'lesseq', # '<=' + 'id', + 'type', + 'num', + 'string' +] + list(reserved.values()) + + +class Token: + def __init__(self, lex, type_, lineno, pos): + self.lex = lex + self.type = type_ + self.lineno = lineno + self.pos = pos + + def __str__(self): + return f'{self.type}: {self.lex} ({self.lineno}, {self.pos})' + + def __repr__(self): + return str(self) \ No newline at end of file diff --git a/src/utils/utils.py b/src/utils/utils.py new file mode 100644 index 00000000..91dcba9a --- /dev/null +++ b/src/utils/utils.py @@ -0,0 +1,39 @@ +import itertools +from semantic.types import Type, SelfType + + +def find_column(lexer, token): + line_start = lexer.lexdata.rfind('\n', 0, token.lexpos) + return token.lexpos - line_start + + +def path_to_objet(typex): + path = [] + c_type = typex + + while c_type: + path.append(c_type) + + c_type = c_type.parent + + path.reverse() + return path + + +def get_common_basetype(types): + paths = [path_to_objet(typex) for typex in types] + tuples = zip(*paths) + + for i, t in enumerate(tuples): + gr = itertools.groupby(t) + if len(list(gr)) > 1: + return paths[0][i-1] + + return paths[0][-1] + + +def get_type(typex: Type, current_type: Type) -> Type: + return current_type if typex == SelfType() else typex + +def is_basic_type(type_name:str): + return type_name in ['String', 'Int', 'Object', 'Bool', 'SELF_TYPE', 'IO'] \ No newline at end of file diff --git a/src/utils/visitor.py b/src/utils/visitor.py new file mode 100644 index 00000000..500298bc --- /dev/null +++ b/src/utils/visitor.py @@ -0,0 +1,80 @@ +# The MIT License (MIT) +# +# Copyright (c) 2013 Curtis Schlak +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +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/tests/.gitignore b/tests/.gitignore new file mode 100644 index 00000000..e799beb0 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,395 @@ +# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig + +# Created by https://www.gitignore.io/api/visualstudiocode,linux,latex,python +# Edit at https://www.gitignore.io/?templates=visualstudiocode,linux,latex,python + +### LaTeX ### +## Core latex/pdflatex auxiliary files: +*.aux +*.lof +*.log +*.lot +*.fls +*.out +*.toc +*.fmt +*.fot +*.cb +*.cb2 +.*.lb + +## Intermediate documents: +*.dvi +*.xdv +*-converted-to.* +# these rules might exclude image files for figures etc. +# *.ps +# *.eps +# *.pdf + +## Generated if empty string is given at "Please type another file name for output:" +.pdf + +## Bibliography auxiliary files (bibtex/biblatex/biber): +*.bbl +*.bcf +*.blg +*-blx.aux +*-blx.bib +*.run.xml + +## Build tool auxiliary files: +*.fdb_latexmk +*.synctex +*.synctex(busy) +*.synctex.gz +*.synctex.gz(busy) +*.pdfsync + +## Build tool directories for auxiliary files +# latexrun +latex.out/ + +## Auxiliary and intermediate files from other packages: +# algorithms +*.alg +*.loa + +# achemso +acs-*.bib + +# amsthm +*.thm + +# beamer +*.nav +*.pre +*.snm +*.vrb + +# changes +*.soc + +# comment +*.cut + +# cprotect +*.cpt + +# elsarticle (documentclass of Elsevier journals) +*.spl + +# endnotes +*.ent + +# fixme +*.lox + +# feynmf/feynmp +*.mf +*.mp +*.t[1-9] +*.t[1-9][0-9] +*.tfm + +#(r)(e)ledmac/(r)(e)ledpar +*.end +*.?end +*.[1-9] +*.[1-9][0-9] +*.[1-9][0-9][0-9] +*.[1-9]R +*.[1-9][0-9]R +*.[1-9][0-9][0-9]R +*.eledsec[1-9] +*.eledsec[1-9]R +*.eledsec[1-9][0-9] +*.eledsec[1-9][0-9]R +*.eledsec[1-9][0-9][0-9] +*.eledsec[1-9][0-9][0-9]R + +# glossaries +*.acn +*.acr +*.glg +*.glo +*.gls +*.glsdefs + +# uncomment this for glossaries-extra (will ignore makeindex's style files!) +# *.ist + +# gnuplottex +*-gnuplottex-* + +# gregoriotex +*.gaux +*.gtex + +# htlatex +*.4ct +*.4tc +*.idv +*.lg +*.trc +*.xref + +# hyperref +*.brf + +# knitr +*-concordance.tex +# TODO Comment the next line if you want to keep your tikz graphics files +*.tikz +*-tikzDictionary + +# listings +*.lol + +# luatexja-ruby +*.ltjruby + +# makeidx +*.idx +*.ilg +*.ind + +# minitoc +*.maf +*.mlf +*.mlt +*.mtc[0-9]* +*.slf[0-9]* +*.slt[0-9]* +*.stc[0-9]* + +# minted +_minted* +*.pyg + +# morewrites +*.mw + +# nomencl +*.nlg +*.nlo +*.nls + +# pax +*.pax + +# pdfpcnotes +*.pdfpc + +# sagetex +*.sagetex.sage +*.sagetex.py +*.sagetex.scmd + +# scrwfile +*.wrt + +# sympy +*.sout +*.sympy +sympy-plots-for-*.tex/ + +# pdfcomment +*.upa +*.upb + +# pythontex +*.pytxcode +pythontex-files-*/ + +# tcolorbox +*.listing + +# thmtools +*.loe + +# TikZ & PGF +*.dpth +*.md5 +*.auxlock + +# todonotes +*.tdo + +# vhistory +*.hst +*.ver + +# easy-todo +*.lod + +# xcolor +*.xcp + +# xmpincl +*.xmpi + +# xindy +*.xdy + +# xypic precompiled matrices +*.xyc + +# endfloat +*.ttt +*.fff + +# Latexian +TSWLatexianTemp* + +## Editors: +# WinEdt +*.bak +*.sav + +# Texpad +.texpadtmp + +# LyX +*.lyx~ + +# Kile +*.backup + +# KBibTeX +*~[0-9]* + +# auto folder when using emacs and auctex +./auto/* +*.el + +# expex forward references with \gathertags +*-tags.tex + +# standalone packages +*.sta + +### LaTeX Patch ### +# glossaries +*.glstex + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ diff --git a/tests/codegen/arith.cl b/tests/codegen/arith.cl old mode 100755 new mode 100644 index af5951cf..0d9f5dd3 --- a/tests/codegen/arith.cl +++ b/tests/codegen/arith.cl @@ -1,430 +1,430 @@ -(* - * A contribution from Anne Sheets (sheets@cory) - * - * Tests the arithmetic operations and various other things - *) - -class A { - - var : Int <- 0; - - value() : Int { var }; - - set_var(num : Int) : A{ - { - var <- num; - self; - } - }; - - method1(num : Int) : A { -- same - self - }; - - method2(num1 : Int, num2 : Int) : A { -- plus - (let x : Int in - { - x <- num1 + num2; - (new B).set_var(x); - } - ) - }; - - method3(num : Int) : A { -- negate - (let x : Int in - { - x <- ~num; - (new C).set_var(x); - } - ) - }; - - method4(num1 : Int, num2 : Int) : A { -- diff - if num2 < num1 then - (let x : Int in - { - x <- num1 - num2; - (new D).set_var(x); - } - ) - else - (let x : Int in - { - x <- num2 - num1; - (new D).set_var(x); - } - ) - fi - }; - - method5(num : Int) : A { -- factorial - (let x : Int <- 1 in - { - (let y : Int <- 1 in - while y <= num loop - { - x <- x * y; - y <- y + 1; - } - pool - ); - (new E).set_var(x); - } - ) - }; - -}; - -class B inherits A { -- B is a number squared - - method5(num : Int) : A { -- square - (let x : Int in - { - x <- num * num; - (new E).set_var(x); - } - ) - }; - -}; - -class C inherits B { - - method6(num : Int) : A { -- negate - (let x : Int in - { - x <- ~num; - (new A).set_var(x); - } - ) - }; - - method5(num : Int) : A { -- cube - (let x : Int in - { - x <- num * num * num; - (new E).set_var(x); - } - ) - }; - -}; - -class D inherits B { - - method7(num : Int) : Bool { -- divisible by 3 - (let x : Int <- num in - if x < 0 then method7(~x) else - if 0 = x then true else - if 1 = x then false else - if 2 = x then false else - method7(x - 3) - fi fi fi fi - ) - }; - -}; - -class E inherits D { - - method6(num : Int) : A { -- division - (let x : Int in - { - x <- num / 8; - (new A).set_var(x); - } - ) - }; - -}; - -(* The following code is from atoi.cl in ~cs164/examples *) - -(* - The class A2I provides integer-to-string and string-to-integer -conversion routines. To use these routines, either inherit them -in the class where needed, have a dummy variable bound to -something of type A2I, or simpl write (new A2I).method(argument). -*) - - -(* - c2i Converts a 1-character string to an integer. Aborts - if the string is not "0" through "9" -*) -class A2I { - - c2i(char : String) : Int { - if char = "0" then 0 else - if char = "1" then 1 else - if char = "2" then 2 else - if char = "3" then 3 else - if char = "4" then 4 else - if char = "5" then 5 else - if char = "6" then 6 else - if char = "7" then 7 else - if char = "8" then 8 else - if char = "9" then 9 else - { abort(); 0; } (* the 0 is needed to satisfy the - typchecker *) - fi fi fi fi fi fi fi fi fi fi - }; - -(* - i2c is the inverse of c2i. -*) - i2c(i : Int) : String { - if i = 0 then "0" else - if i = 1 then "1" else - if i = 2 then "2" else - if i = 3 then "3" else - if i = 4 then "4" else - if i = 5 then "5" else - if i = 6 then "6" else - if i = 7 then "7" else - if i = 8 then "8" else - if i = 9 then "9" else - { abort(); ""; } -- the "" is needed to satisfy the typchecker - fi fi fi fi fi fi fi fi fi fi - }; - -(* - a2i converts an ASCII string into an integer. The empty string -is converted to 0. Signed and unsigned strings are handled. The -method aborts if the string does not represent an integer. Very -long strings of digits produce strange answers because of arithmetic -overflow. - -*) - a2i(s : String) : Int { - if s.length() = 0 then 0 else - if s.substr(0,1) = "-" then ~a2i_aux(s.substr(1,s.length()-1)) else - if s.substr(0,1) = "+" then a2i_aux(s.substr(1,s.length()-1)) else - a2i_aux(s) - fi fi fi - }; - -(* a2i_aux converts the usigned portion of the string. As a - programming example, this method is written iteratively. *) - - - a2i_aux(s : String) : Int { - (let int : Int <- 0 in - { - (let j : Int <- s.length() in - (let i : Int <- 0 in - while i < j loop - { - int <- int * 10 + c2i(s.substr(i,1)); - i <- i + 1; - } - pool - ) - ); - int; - } - ) - }; - -(* i2a converts an integer to a string. Positive and negative - numbers are handled correctly. *) - - i2a(i : Int) : String { - if i = 0 then "0" else - if 0 < i then i2a_aux(i) else - "-".concat(i2a_aux(i * ~1)) - fi fi - }; - -(* i2a_aux is an example using recursion. *) - - i2a_aux(i : Int) : String { - if i = 0 then "" else - (let next : Int <- i / 10 in - i2a_aux(next).concat(i2c(i - next * 10)) - ) - fi - }; - -}; - -class Main inherits IO { - - char : String; - avar : A; - a_var : A; - flag : Bool <- true; - - - menu() : String { - { - out_string("\n\tTo add a number to "); - print(avar); - out_string("...enter a:\n"); - out_string("\tTo negate "); - print(avar); - out_string("...enter b:\n"); - out_string("\tTo find the difference between "); - print(avar); - out_string("and another number...enter c:\n"); - out_string("\tTo find the factorial of "); - print(avar); - out_string("...enter d:\n"); - out_string("\tTo square "); - print(avar); - out_string("...enter e:\n"); - out_string("\tTo cube "); - print(avar); - out_string("...enter f:\n"); - out_string("\tTo find out if "); - print(avar); - out_string("is a multiple of 3...enter g:\n"); - out_string("\tTo divide "); - print(avar); - out_string("by 8...enter h:\n"); - out_string("\tTo get a new number...enter j:\n"); - out_string("\tTo quit...enter q:\n\n"); - in_string(); - } - }; - - prompt() : String { - { - out_string("\n"); - out_string("Please enter a number... "); - in_string(); - } - }; - - get_int() : Int { - { - (let z : A2I <- new A2I in - (let s : String <- prompt() in - z.a2i(s) - ) - ); - } - }; - - is_even(num : Int) : Bool { - (let x : Int <- num in - if x < 0 then is_even(~x) else - if 0 = x then true else - if 1 = x then false else - is_even(x - 2) - fi fi fi - ) - }; - - class_type(var : A) : IO { - case var of - a : A => out_string("Class type is now A\n"); - b : B => out_string("Class type is now B\n"); - c : C => out_string("Class type is now C\n"); - d : D => out_string("Class type is now D\n"); - e : E => out_string("Class type is now E\n"); - o : Object => out_string("Oooops\n"); - esac - }; - - print(var : A) : IO { - (let z : A2I <- new A2I in - { - out_string(z.i2a(var.value())); - out_string(" "); - } - ) - }; - - main() : Object { - { - avar <- (new A); - while flag loop - { - -- avar <- (new A).set_var(get_int()); - out_string("number "); - print(avar); - if is_even(avar.value()) then - out_string("is even!\n") - else - out_string("is odd!\n") - fi; - -- print(avar); -- prints out answer - class_type(avar); - char <- menu(); - if char = "a" then -- add - { - a_var <- (new A).set_var(get_int()); - avar <- (new B).method2(avar.value(), a_var.value()); - } else - if char = "b" then -- negate - case avar of - c : C => avar <- c.method6(c.value()); - a : A => avar <- a.method3(a.value()); - o : Object => { - out_string("Oooops\n"); - abort(); 0; - }; - esac else - if char = "c" then -- diff - { - a_var <- (new A).set_var(get_int()); - avar <- (new D).method4(avar.value(), a_var.value()); - } else - if char = "d" then avar <- (new C)@A.method5(avar.value()) else - -- factorial - if char = "e" then avar <- (new C)@B.method5(avar.value()) else - -- square - if char = "f" then avar <- (new C)@C.method5(avar.value()) else - -- cube - if char = "g" then -- multiple of 3? - if ((new D).method7(avar.value())) - then -- avar <- (new A).method1(avar.value()) - { - out_string("number "); - print(avar); - out_string("is divisible by 3.\n"); - } - else -- avar <- (new A).set_var(0) - { - out_string("number "); - print(avar); - out_string("is not divisible by 3.\n"); - } - fi else - if char = "h" then - (let x : A in - { - x <- (new E).method6(avar.value()); - (let r : Int <- (avar.value() - (x.value() * 8)) in - { - out_string("number "); - print(avar); - out_string("is equal to "); - print(x); - out_string("times 8 with a remainder of "); - (let a : A2I <- new A2I in - { - out_string(a.i2a(r)); - out_string("\n"); - } - ); -- end let a: - } - ); -- end let r: - avar <- x; - } - ) -- end let x: - else - if char = "j" then avar <- (new A) - else - if char = "q" then flag <- false - else - avar <- (new A).method1(avar.value()) -- divide/8 - fi fi fi fi fi fi fi fi fi fi; - } - pool; - } - }; - -}; - +(* + * A contribution from Anne Sheets (sheets@cory) + * + * Tests the arithmetic operations and various other things + *) + +class A { + + var : Int <- 0; + + value() : Int { var }; + + set_var(num : Int) : A{ + { + var <- num; + self; + } + }; + + method1(num : Int) : A { -- same + self + }; + + method2(num1 : Int, num2 : Int) : A { -- plus + (let x : Int in + { + x <- num1 + num2; + (new B).set_var(x); + } + ) + }; + + method3(num : Int) : A { -- negate + (let x : Int in + { + x <- ~num; + (new C).set_var(x); + } + ) + }; + + method4(num1 : Int, num2 : Int) : A { -- diff + if num2 < num1 then + (let x : Int in + { + x <- num1 - num2; + (new D).set_var(x); + } + ) + else + (let x : Int in + { + x <- num2 - num1; + (new D).set_var(x); + } + ) + fi + }; + + method5(num : Int) : A { -- factorial + (let x : Int <- 1 in + { + (let y : Int <- 1 in + while y <= num loop + { + x <- x * y; + y <- y + 1; + } + pool + ); + (new E).set_var(x); + } + ) + }; + +}; + +class B inherits A { -- B is a number squared + + method5(num : Int) : A { -- square + (let x : Int in + { + x <- num * num; + (new E).set_var(x); + } + ) + }; + +}; + +class C inherits B { + + method6(num : Int) : A { -- negate + (let x : Int in + { + x <- ~num; + (new A).set_var(x); + } + ) + }; + + method5(num : Int) : A { -- cube + (let x : Int in + { + x <- num * num * num; + (new E).set_var(x); + } + ) + }; + +}; + +class D inherits B { + + method7(num : Int) : Bool { -- divisible by 3 + (let x : Int <- num in + if x < 0 then method7(~x) else + if 0 = x then true else + if 1 = x then false else + if 2 = x then false else + method7(x - 3) + fi fi fi fi + ) + }; + +}; + +class E inherits D { + + method6(num : Int) : A { -- division + (let x : Int in + { + x <- num / 8; + (new A).set_var(x); + } + ) + }; + +}; + +(* The following code is from atoi.cl in ~cs164/examples *) + +(* + The class A2I provides integer-to-string and string-to-integer +conversion routines. To use these routines, either inherit them +in the class where needed, have a dummy variable bound to +something of type A2I, or simpl write (new A2I).method(argument). +*) + + +(* + c2i Converts a 1-character string to an integer. Aborts + if the string is not "0" through "9" +*) +class A2I { + + c2i(char : String) : Int { + if char = "0" then 0 else + if char = "1" then 1 else + if char = "2" then 2 else + if char = "3" then 3 else + if char = "4" then 4 else + if char = "5" then 5 else + if char = "6" then 6 else + if char = "7" then 7 else + if char = "8" then 8 else + if char = "9" then 9 else + { abort(); 0; } (* the 0 is needed to satisfy the + typchecker *) + fi fi fi fi fi fi fi fi fi fi + }; + +(* + i2c is the inverse of c2i. +*) + i2c(i : Int) : String { + if i = 0 then "0" else + if i = 1 then "1" else + if i = 2 then "2" else + if i = 3 then "3" else + if i = 4 then "4" else + if i = 5 then "5" else + if i = 6 then "6" else + if i = 7 then "7" else + if i = 8 then "8" else + if i = 9 then "9" else + { abort(); ""; } -- the "" is needed to satisfy the typchecker + fi fi fi fi fi fi fi fi fi fi + }; + +(* + a2i converts an ASCII string into an integer. The empty string +is converted to 0. Signed and unsigned strings are handled. The +method aborts if the string does not represent an integer. Very +long strings of digits produce strange answers because of arithmetic +overflow. + +*) + a2i(s : String) : Int { + if s.length() = 0 then 0 else + if s.substr(0,1) = "-" then ~a2i_aux(s.substr(1,s.length()-1)) else + if s.substr(0,1) = "+" then a2i_aux(s.substr(1,s.length()-1)) else + a2i_aux(s) + fi fi fi + }; + +(* a2i_aux converts the usigned portion of the string. As a + programming example, this method is written iteratively. *) + + + a2i_aux(s : String) : Int { + (let int : Int <- 0 in + { + (let j : Int <- s.length() in + (let i : Int <- 0 in + while i < j loop + { + int <- int * 10 + c2i(s.substr(i,1)); + i <- i + 1; + } + pool + ) + ); + int; + } + ) + }; + +(* i2a converts an integer to a string. Positive and negative + numbers are handled correctly. *) + + i2a(i : Int) : String { + if i = 0 then "0" else + if 0 < i then i2a_aux(i) else + "-".concat(i2a_aux(i * ~1)) + fi fi + }; + +(* i2a_aux is an example using recursion. *) + + i2a_aux(i : Int) : String { + if i = 0 then "" else + (let next : Int <- i / 10 in + i2a_aux(next).concat(i2c(i - next * 10)) + ) + fi + }; + +}; + +class Main inherits IO { + + char : String; + avar : A; + a_var : A; + flag : Bool <- true; + + + menu() : String { + { + out_string("\n\tTo add a number to "); + print(avar); + out_string("...enter a:\n"); + out_string("\tTo negate "); + print(avar); + out_string("...enter b:\n"); + out_string("\tTo find the difference between "); + print(avar); + out_string("and another number...enter c:\n"); + out_string("\tTo find the factorial of "); + print(avar); + out_string("...enter d:\n"); + out_string("\tTo square "); + print(avar); + out_string("...enter e:\n"); + out_string("\tTo cube "); + print(avar); + out_string("...enter f:\n"); + out_string("\tTo find out if "); + print(avar); + out_string("is a multiple of 3...enter g:\n"); + out_string("\tTo divide "); + print(avar); + out_string("by 8...enter h:\n"); + out_string("\tTo get a new number...enter j:\n"); + out_string("\tTo quit...enter q:\n\n"); + in_string(); + } + }; + + prompt() : String { + { + out_string("\n"); + out_string("Please enter a number... "); + in_string(); + } + }; + + get_int() : Int { + { + (let z : A2I <- new A2I in + (let s : String <- prompt() in + z.a2i(s) + ) + ); + } + }; + + is_even(num : Int) : Bool { + (let x : Int <- num in + if x < 0 then is_even(~x) else + if 0 = x then true else + if 1 = x then false else + is_even(x - 2) + fi fi fi + ) + }; + + class_type(var : A) : IO { + case var of + a : A => out_string("Class type is now A\n"); + b : B => out_string("Class type is now B\n"); + c : C => out_string("Class type is now C\n"); + d : D => out_string("Class type is now D\n"); + e : E => out_string("Class type is now E\n"); + o : Object => out_string("Oooops\n"); + esac + }; + + print(var : A) : IO { + (let z : A2I <- new A2I in + { + out_string(z.i2a(var.value())); + out_string(" "); + } + ) + }; + + main() : Object { + { + avar <- (new A); + while flag loop + { + -- avar <- (new A).set_var(get_int()); + out_string("number "); + print(avar); + if is_even(avar.value()) then + out_string("is even!\n") + else + out_string("is odd!\n") + fi; + -- print(avar); -- prints out answer + class_type(avar); + char <- menu(); + if char = "a" then -- add + { + a_var <- (new A).set_var(get_int()); + avar <- (new B).method2(avar.value(), a_var.value()); + } else + if char = "b" then -- negate + case avar of + c : C => avar <- c.method6(c.value()); + a : A => avar <- a.method3(a.value()); + o : Object => { + out_string("Oooops\n"); + abort(); 0; + }; + esac else + if char = "c" then -- diff + { + a_var <- (new A).set_var(get_int()); + avar <- (new D).method4(avar.value(), a_var.value()); + } else + if char = "d" then avar <- (new C)@A.method5(avar.value()) else + -- factorial + if char = "e" then avar <- (new C)@B.method5(avar.value()) else + -- square + if char = "f" then avar <- (new C)@C.method5(avar.value()) else + -- cube + if char = "g" then -- multiple of 3? + if ((new D).method7(avar.value())) + then -- avar <- (new A).method1(avar.value()) + { + out_string("number "); + print(avar); + out_string("is divisible by 3.\n"); + } + else -- avar <- (new A).set_var(0) + { + out_string("number "); + print(avar); + out_string("is not divisible by 3.\n"); + } + fi else + if char = "h" then + (let x : A in + { + x <- (new E).method6(avar.value()); + (let r : Int <- (avar.value() - (x.value() * 8)) in + { + out_string("number "); + print(avar); + out_string("is equal to "); + print(x); + out_string("times 8 with a remainder of "); + (let a : A2I <- new A2I in + { + out_string(a.i2a(r)); + out_string("\n"); + } + ); -- end let a: + } + ); -- end let r: + avar <- x; + } + ) -- end let x: + else + if char = "j" then avar <- (new A) + else + if char = "q" then flag <- false + else + avar <- (new A).method1(avar.value()) -- divide/8 + fi fi fi fi fi fi fi fi fi fi; + } + pool; + } + }; + +}; + diff --git a/tests/codegen/arith.mips b/tests/codegen/arith.mips new file mode 100644 index 00000000..e2ff092c --- /dev/null +++ b/tests/codegen/arith.mips @@ -0,0 +1,13265 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_A_A +sw $t9, 80($v0) +la $t9, function_value_A +sw $t9, 84($v0) +la $t9, function_set_var_A +sw $t9, 88($v0) +la $t9, function_method1_A +sw $t9, 92($v0) +la $t9, function_method2_A +sw $t9, 96($v0) +la $t9, function_method3_A +sw $t9, 100($v0) +la $t9, function_method4_A +sw $t9, 104($v0) +la $t9, function_method5_A +sw $t9, 108($v0) +la $t9, function_B_B +sw $t9, 112($v0) +la $t9, function_method5_B +sw $t9, 116($v0) +la $t9, function_C_C +sw $t9, 120($v0) +la $t9, function_method6_C +sw $t9, 124($v0) +la $t9, function_method5_C +sw $t9, 128($v0) +la $t9, function_D_D +sw $t9, 132($v0) +la $t9, function_method7_D +sw $t9, 136($v0) +la $t9, function_E_E +sw $t9, 140($v0) +la $t9, function_method6_E +sw $t9, 144($v0) +la $t9, function_c2i_A2I +sw $t9, 148($v0) +la $t9, function_i2c_A2I +sw $t9, 152($v0) +la $t9, function_a2i_A2I +sw $t9, 156($v0) +la $t9, function_a2i_aux_A2I +sw $t9, 160($v0) +la $t9, function_i2a_A2I +sw $t9, 164($v0) +la $t9, function_i2a_aux_A2I +sw $t9, 168($v0) +la $t9, function_Main_Main +sw $t9, 172($v0) +la $t9, function_menu_Main +sw $t9, 176($v0) +la $t9, function_prompt_Main +sw $t9, 180($v0) +la $t9, function_get_int_Main +sw $t9, 184($v0) +la $t9, function_is_even_Main +sw $t9, 188($v0) +la $t9, function_class_type_Main +sw $t9, 192($v0) +la $t9, function_print_Main +sw $t9, 196($v0) +la $t9, function_main_Main +sw $t9, 200($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 48 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_value_A in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_set_var_A in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_method1_A in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_method2_A in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_method3_A in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_method4_A in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_method5_A in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_A_A in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 52 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_value_A in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_set_var_A in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_method1_A in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_method2_A in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_method3_A in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_method4_A in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_method5_B in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_A_A in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_B_B in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 60 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_value_A in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_set_var_A in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_method1_A in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_method2_A in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_method3_A in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_method4_A in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_method5_C in a0 +lw $a0, 128($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_A_A in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_B_B in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_method6_C in a0 +lw $a0, 124($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_C_C in a0 +lw $a0, 120($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_D +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 60 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_value_A in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_set_var_A in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_method1_A in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_method2_A in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_method3_A in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_method4_A in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_method5_B in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_A_A in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_B_B in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_method7_D in a0 +lw $a0, 136($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_D_D in a0 +lw $a0, 132($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_E +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 36($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 68 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_value_A in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_set_var_A in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_method1_A in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_method2_A in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_method3_A in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_method4_A in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_method5_B in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_A_A in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_B_B in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_method7_D in a0 +lw $a0, 136($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_D_D in a0 +lw $a0, 132($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_method6_E in a0 +lw $a0, 144($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_E_E in a0 +lw $a0, 140($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A2I +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 40($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_c2i_A2I in a0 +lw $a0, 148($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_i2c_A2I in a0 +lw $a0, 152($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_a2i_A2I in a0 +lw $a0, 156($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_a2i_aux_A2I in a0 +lw $a0, 160($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_i2a_A2I in a0 +lw $a0, 164($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_i2a_aux_A2I in a0 +lw $a0, 168($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 44($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 64 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_menu_Main in a0 +lw $a0, 176($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_prompt_Main in a0 +lw $a0, 180($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_get_int_Main in a0 +lw $a0, 184($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_is_even_Main in a0 +lw $a0, 188($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_class_type_Main in a0 +lw $a0, 192($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_print_Main in a0 +lw $a0, 196($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 200($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 172($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 36($t9) +lw $t8, 32($t9) +sw $t8, 4($v0) +lw $v0, 40($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 44($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 28 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 28 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 44($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_A_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_A_A_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . var <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Moving self to local_A_A_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_value_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_value_A_var_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_value_A_var_0 <- GET self . var +lw $t1, 12($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_set_var_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_set_var_A_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# self . var <- SET num +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_set_var_A_internal_0 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_method1_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +lw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_method2_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num1 +addiu $fp, $fp, 4 +# Pops the register with the param value num2 +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method2_A_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method2_A_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method2_A_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method2_A_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method2_A_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method2_A_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method2_A_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +# Moving 0 to local_method2_A_x_0 +li $t0, 0 +sw $t0, -12($fp) +lw $t1, -4($fp) +lw $t2, -0($fp) +lw $t3, -16($fp) +# local_method2_A_internal_1 <- num1 + num2 +add $t3, $t1, $t2 +# Moving local_method2_A_internal_1 to local_method2_A_x_0 +move $t0, $t3 +sw $t0, -12($fp) +lw $t4, -20($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t4) +# Static Dispatch of the method B +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -4($fp) +sw $t2, -0($fp) +sw $t3, -16($fp) +sw $t4, -20($fp) +# This function will consume the arguments +jal function_B_B +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# local_method2_A_internal_4 <- Type of local_method2_A_internal_2 +lw $t1, 0($t0) +lw $t2, -32($fp) +# Saves in local_method2_A_internal_5 data_0 +la $t2, data_0 +# local_method2_A_internal_4 <- local_method2_A_internal_4 = local_method2_A_internal_5 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_method2_A_internal_4 goto continue__84 +sw $t0, -20($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +beqz $t1, continue__84 +la $a0, dispatch_error +j .raise +continue__84: +lw $t0, -20($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -12($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# Moving local_method2_A_internal_3 to local_method2_A_internal_6 +move $t1, $t0 +sw $t1, -36($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -36($fp) +# Removing all locals from stack +addiu $sp, $sp, 40 +jr $ra + + +function_method3_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method3_A_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method3_A_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method3_A_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method3_A_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method3_A_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method3_A_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method3_A_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 0 to local_method3_A_x_0 +li $t0, 0 +sw $t0, -8($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# local_method3_A_internal_1 <- ~num +not $t2, $t1 +addi $t2, $t2, 1 +# Moving local_method3_A_internal_1 to local_method3_A_x_0 +move $t0, $t2 +sw $t0, -8($fp) +lw $t3, -16($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t3) +# Static Dispatch of the method C +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal function_C_C +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_method3_A_internal_4 <- Type of local_method3_A_internal_2 +lw $t1, 0($t0) +lw $t2, -28($fp) +# Saves in local_method3_A_internal_5 data_0 +la $t2, data_0 +# local_method3_A_internal_4 <- local_method3_A_internal_4 = local_method3_A_internal_5 +move $t8, $t1 +move $t9, $t2 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t1, $v0 +# If not local_method3_A_internal_4 goto continue__111 +sw $t0, -16($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +beqz $t1, continue__111 +la $a0, dispatch_error +j .raise +continue__111: +lw $t0, -16($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_method3_A_internal_3 to local_method3_A_internal_6 +move $t1, $t0 +sw $t1, -32($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -32($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_method4_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num1 +addiu $fp, $fp, 4 +# Pops the register with the param value num2 +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method4_A_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_x_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_x_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method4_A_internal_15 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t2, -12($fp) +# local_method4_A_internal_0 <- num2 < num1 +slt $t2, $t0, $t1 +# If local_method4_A_internal_0 goto true__130 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +bnez $t2, true__130 +lw $t0, -20($fp) +# Moving 0 to local_method4_A_x_2 +li $t0, 0 +sw $t0, -20($fp) +lw $t1, -0($fp) +lw $t2, -4($fp) +lw $t3, -24($fp) +# local_method4_A_internal_3 <- num2 - num1 +sub $t3, $t1, $t2 +# Moving local_method4_A_internal_3 to local_method4_A_x_2 +move $t0, $t3 +sw $t0, -20($fp) +lw $t4, -28($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_D +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t4) +# Static Dispatch of the method D +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -0($fp) +sw $t2, -4($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal function_D_D +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# local_method4_A_internal_6 <- Type of local_method4_A_internal_4 +lw $t1, 0($t0) +lw $t2, -40($fp) +# Saves in local_method4_A_internal_7 data_0 +la $t2, data_0 +# local_method4_A_internal_6 <- local_method4_A_internal_6 = local_method4_A_internal_7 +move $t8, $t1 +move $t9, $t2 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t1, $v0 +# If not local_method4_A_internal_6 goto continue__143 +sw $t0, -28($fp) +sw $t1, -36($fp) +sw $t2, -40($fp) +beqz $t1, continue__143 +la $a0, dispatch_error +j .raise +continue__143: +lw $t0, -28($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -20($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Moving local_method4_A_internal_5 to local_method4_A_internal_8 +move $t1, $t0 +sw $t1, -44($fp) +lw $t2, -16($fp) +# Moving local_method4_A_internal_8 to local_method4_A_internal_1 +move $t2, $t1 +sw $t2, -16($fp) +sw $t0, -32($fp) +sw $t1, -44($fp) +sw $t2, -16($fp) +j end__130 +true__130: +lw $t0, -48($fp) +# Moving 0 to local_method4_A_x_9 +li $t0, 0 +sw $t0, -48($fp) +lw $t1, -4($fp) +lw $t2, -0($fp) +lw $t3, -52($fp) +# local_method4_A_internal_10 <- num1 - num2 +sub $t3, $t1, $t2 +# Moving local_method4_A_internal_10 to local_method4_A_x_9 +move $t0, $t3 +sw $t0, -48($fp) +lw $t4, -56($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_D +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t4) +# Static Dispatch of the method D +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -4($fp) +sw $t2, -0($fp) +sw $t3, -52($fp) +sw $t4, -56($fp) +# This function will consume the arguments +jal function_D_D +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# local_method4_A_internal_13 <- Type of local_method4_A_internal_11 +lw $t1, 0($t0) +lw $t2, -68($fp) +# Saves in local_method4_A_internal_14 data_0 +la $t2, data_0 +# local_method4_A_internal_13 <- local_method4_A_internal_13 = local_method4_A_internal_14 +move $t8, $t1 +move $t9, $t2 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t1, $v0 +# If not local_method4_A_internal_13 goto continue__169 +sw $t0, -56($fp) +sw $t1, -64($fp) +sw $t2, -68($fp) +beqz $t1, continue__169 +la $a0, dispatch_error +j .raise +continue__169: +lw $t0, -56($fp) +lw $t1, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -48($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -60($fp) +sw $t2, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Moving local_method4_A_internal_12 to local_method4_A_internal_15 +move $t1, $t0 +sw $t1, -72($fp) +lw $t2, -16($fp) +# Moving local_method4_A_internal_15 to local_method4_A_internal_1 +move $t2, $t1 +sw $t2, -16($fp) +sw $t0, -60($fp) +sw $t1, -72($fp) +sw $t2, -16($fp) +end__130: +lw $t0, -16($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 76 +jr $ra + + +function_method5_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method5_A_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_y_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_A_internal_11 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 1 to local_method5_A_x_0 +li $t0, 1 +sw $t0, -8($fp) +lw $t1, -12($fp) +# Moving 1 to local_method5_A_y_1 +li $t1, 1 +sw $t1, -12($fp) +lw $t2, -16($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t2, $v0 +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +start__191: +lw $t0, -12($fp) +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_method5_A_internal_3 <- local_method5_A_y_1 <= num +sle $t2, $t0, $t1 +# If not local_method5_A_internal_3 goto end__191 +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +beqz $t2, end__191 +lw $t0, -8($fp) +lw $t1, -12($fp) +lw $t2, -24($fp) +# local_method5_A_internal_4 <- local_method5_A_x_0 * local_method5_A_y_1 +mult $t0, $t1 +mflo $t2 +# Moving local_method5_A_internal_4 to local_method5_A_x_0 +move $t0, $t2 +sw $t0, -8($fp) +lw $t3, -28($fp) +# local_method5_A_internal_5 <- local_method5_A_y_1 + 1 +addi $t3, $t1, 1 +# Moving local_method5_A_internal_5 to local_method5_A_y_1 +move $t1, $t3 +sw $t1, -12($fp) +lw $t4, -32($fp) +# Moving local_method5_A_internal_5 to local_method5_A_internal_6 +move $t4, $t3 +sw $t4, -32($fp) +lw $t5, -16($fp) +# Moving local_method5_A_internal_6 to local_method5_A_internal_2 +move $t5, $t4 +sw $t5, -16($fp) +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -24($fp) +sw $t3, -28($fp) +sw $t4, -32($fp) +sw $t5, -16($fp) +j start__191 +end__191: +lw $t0, -36($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_E +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t0) +# Static Dispatch of the method E +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +# This function will consume the arguments +jal function_E_E +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# local_method5_A_internal_9 <- Type of local_method5_A_internal_7 +lw $t1, 0($t0) +lw $t2, -48($fp) +# Saves in local_method5_A_internal_10 data_0 +la $t2, data_0 +# local_method5_A_internal_9 <- local_method5_A_internal_9 = local_method5_A_internal_10 +move $t8, $t1 +move $t9, $t2 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t1, $v0 +# If not local_method5_A_internal_9 goto continue__214 +sw $t0, -36($fp) +sw $t1, -44($fp) +sw $t2, -48($fp) +beqz $t1, continue__214 +la $a0, dispatch_error +j .raise +continue__214: +lw $t0, -36($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Moving local_method5_A_internal_8 to local_method5_A_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -52($fp) +# Removing all locals from stack +addiu $sp, $sp, 56 +jr $ra + + +function_B_B: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_B_B_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . var <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Moving self to local_B_B_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_method5_B: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method5_B_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_B_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_B_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_B_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_B_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_B_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_B_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 0 to local_method5_B_x_0 +li $t0, 0 +sw $t0, -8($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# local_method5_B_internal_1 <- num * num +mult $t1, $t1 +mflo $t2 +# Moving local_method5_B_internal_1 to local_method5_B_x_0 +move $t0, $t2 +sw $t0, -8($fp) +lw $t3, -16($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_E +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t3) +# Static Dispatch of the method E +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal function_E_E +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_method5_B_internal_4 <- Type of local_method5_B_internal_2 +lw $t1, 0($t0) +lw $t2, -28($fp) +# Saves in local_method5_B_internal_5 data_0 +la $t2, data_0 +# local_method5_B_internal_4 <- local_method5_B_internal_4 = local_method5_B_internal_5 +move $t8, $t1 +move $t9, $t2 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t1, $v0 +# If not local_method5_B_internal_4 goto continue__247 +sw $t0, -16($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +beqz $t1, continue__247 +la $a0, dispatch_error +j .raise +continue__247: +lw $t0, -16($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_method5_B_internal_3 to local_method5_B_internal_6 +move $t1, $t0 +sw $t1, -32($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -32($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_C_C: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_C_C_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . var <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Moving self to local_C_C_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_method6_C: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method6_C_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_C_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_C_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_C_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_C_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_C_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_C_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 0 to local_method6_C_x_0 +li $t0, 0 +sw $t0, -8($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# local_method6_C_internal_1 <- ~num +not $t2, $t1 +addi $t2, $t2, 1 +# Moving local_method6_C_internal_1 to local_method6_C_x_0 +move $t0, $t2 +sw $t0, -8($fp) +lw $t3, -16($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_method6_C_internal_4 <- Type of local_method6_C_internal_2 +lw $t1, 0($t0) +lw $t2, -28($fp) +# Saves in local_method6_C_internal_5 data_0 +la $t2, data_0 +# local_method6_C_internal_4 <- local_method6_C_internal_4 = local_method6_C_internal_5 +move $t8, $t1 +move $t9, $t2 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t1, $v0 +# If not local_method6_C_internal_4 goto continue__280 +sw $t0, -16($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +beqz $t1, continue__280 +la $a0, dispatch_error +j .raise +continue__280: +lw $t0, -16($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_method6_C_internal_3 to local_method6_C_internal_6 +move $t1, $t0 +sw $t1, -32($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -32($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_method5_C: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method5_C_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_C_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_C_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_C_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_C_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_C_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_C_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method5_C_internal_7 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 0 to local_method5_C_x_0 +li $t0, 0 +sw $t0, -8($fp) +lw $t1, -0($fp) +lw $t2, -16($fp) +# local_method5_C_internal_2 <- num * num +mult $t1, $t1 +mflo $t2 +lw $t3, -12($fp) +# local_method5_C_internal_1 <- local_method5_C_internal_2 * num +mult $t2, $t1 +mflo $t3 +# Moving local_method5_C_internal_1 to local_method5_C_x_0 +move $t0, $t3 +sw $t0, -8($fp) +lw $t4, -20($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_E +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t4) +# Static Dispatch of the method E +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -20($fp) +# This function will consume the arguments +jal function_E_E +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# local_method5_C_internal_5 <- Type of local_method5_C_internal_3 +lw $t1, 0($t0) +lw $t2, -32($fp) +# Saves in local_method5_C_internal_6 data_0 +la $t2, data_0 +# local_method5_C_internal_5 <- local_method5_C_internal_5 = local_method5_C_internal_6 +move $t8, $t1 +move $t9, $t2 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t1, $v0 +# If not local_method5_C_internal_5 goto continue__309 +sw $t0, -20($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +beqz $t1, continue__309 +la $a0, dispatch_error +j .raise +continue__309: +lw $t0, -20($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# Moving local_method5_C_internal_4 to local_method5_C_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -36($fp) +# Removing all locals from stack +addiu $sp, $sp, 40 +jr $ra + + +function_D_D: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_D_D_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . var <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Moving self to local_D_D_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_method7_D: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method7_D_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method7_D_internal_12 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# Moving num to local_method7_D_x_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -12($fp) +# local_method7_D_internal_1 <- local_method7_D_x_0 < 0 +li $t9, 0 +slt $t2, $t1, $t9 +# If local_method7_D_internal_1 goto true__335 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +bnez $t2, true__335 +lw $t0, -8($fp) +lw $t1, -20($fp) +# local_method7_D_internal_3 <- 0 = local_method7_D_x_0 +li $t9, 0 +seq $t1, $t9, $t0 +# If local_method7_D_internal_3 goto true__339 +sw $t0, -8($fp) +sw $t1, -20($fp) +bnez $t1, true__339 +lw $t0, -8($fp) +lw $t1, -28($fp) +# local_method7_D_internal_5 <- 1 = local_method7_D_x_0 +li $t9, 1 +seq $t1, $t9, $t0 +# If local_method7_D_internal_5 goto true__343 +sw $t0, -8($fp) +sw $t1, -28($fp) +bnez $t1, true__343 +lw $t0, -8($fp) +lw $t1, -36($fp) +# local_method7_D_internal_7 <- 2 = local_method7_D_x_0 +li $t9, 2 +seq $t1, $t9, $t0 +# If local_method7_D_internal_7 goto true__347 +sw $t0, -8($fp) +sw $t1, -36($fp) +bnez $t1, true__347 +lw $t0, -8($fp) +lw $t1, -44($fp) +# local_method7_D_internal_9 <- local_method7_D_x_0 - 3 +addi $t1, $t0, -3 +lw $t2, -4($fp) +lw $t3, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method7_D +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -44($fp) +sw $t2, -4($fp) +sw $t3, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Moving local_method7_D_internal_10 to local_method7_D_internal_8 +move $t1, $t0 +sw $t1, -40($fp) +sw $t0, -48($fp) +sw $t1, -40($fp) +j end__347 +true__347: +lw $t0, -40($fp) +# Moving 0 to local_method7_D_internal_8 +li $t0, 0 +sw $t0, -40($fp) +sw $t0, -40($fp) +end__347: +lw $t0, -40($fp) +lw $t1, -32($fp) +# Moving local_method7_D_internal_8 to local_method7_D_internal_6 +move $t1, $t0 +sw $t1, -32($fp) +sw $t0, -40($fp) +sw $t1, -32($fp) +j end__343 +true__343: +lw $t0, -32($fp) +# Moving 0 to local_method7_D_internal_6 +li $t0, 0 +sw $t0, -32($fp) +sw $t0, -32($fp) +end__343: +lw $t0, -32($fp) +lw $t1, -24($fp) +# Moving local_method7_D_internal_6 to local_method7_D_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -32($fp) +sw $t1, -24($fp) +j end__339 +true__339: +lw $t0, -24($fp) +# Moving 1 to local_method7_D_internal_4 +li $t0, 1 +sw $t0, -24($fp) +sw $t0, -24($fp) +end__339: +lw $t0, -24($fp) +lw $t1, -16($fp) +# Moving local_method7_D_internal_4 to local_method7_D_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -24($fp) +sw $t1, -16($fp) +j end__335 +true__335: +lw $t0, -8($fp) +lw $t1, -52($fp) +# local_method7_D_internal_11 <- ~local_method7_D_x_0 +not $t1, $t0 +addi $t1, $t1, 1 +lw $t2, -4($fp) +lw $t3, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method7_D +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -52($fp) +sw $t2, -4($fp) +sw $t3, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Moving local_method7_D_internal_12 to local_method7_D_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -56($fp) +sw $t1, -16($fp) +end__335: +lw $t0, -16($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_E_E: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_E_E_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . var <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Moving self to local_E_E_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_method6_E: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_method6_E_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_E_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_E_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_E_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_E_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_E_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_method6_E_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 0 to local_method6_E_x_0 +li $t0, 0 +sw $t0, -8($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# local_method6_E_internal_1 <- num / 8 +li $t9, 8 +la $a0, zero_error +beqz $t9, .raise +div $t1, $t9 +mflo $t2 +# Moving local_method6_E_internal_1 to local_method6_E_x_0 +move $t0, $t2 +sw $t0, -8($fp) +lw $t3, -16($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_method6_E_internal_4 <- Type of local_method6_E_internal_2 +lw $t1, 0($t0) +lw $t2, -28($fp) +# Saves in local_method6_E_internal_5 data_0 +la $t2, data_0 +# local_method6_E_internal_4 <- local_method6_E_internal_4 = local_method6_E_internal_5 +move $t8, $t1 +move $t9, $t2 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t1, $v0 +# If not local_method6_E_internal_4 goto continue__402 +sw $t0, -16($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +beqz $t1, continue__402 +la $a0, dispatch_error +j .raise +continue__402: +lw $t0, -16($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_method6_E_internal_3 to local_method6_E_internal_6 +move $t1, $t0 +sw $t1, -32($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -32($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_c2i_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value char +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_c2i_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_31 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +# Saves in local_c2i_A2I_internal_1 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# local_c2i_A2I_internal_0 <- char = local_c2i_A2I_internal_1 +move $t8, $t1 +move $t9, $t0 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t2, $v0 +# If local_c2i_A2I_internal_0 goto true__423 +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +bnez $t2, true__423 +lw $t0, -24($fp) +# Saves in local_c2i_A2I_internal_4 data_2 +la $t0, data_2 +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_c2i_A2I_internal_3 <- char = local_c2i_A2I_internal_4 +move $t8, $t1 +move $t9, $t0 +loop_16: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_16 +beqz $a1, mismatch_16 +seq $v0, $a0, $a1 +beqz $v0, mismatch_16 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_16 +mismatch_16: +li $v0, 0 +j end_16 +check_16: +bnez $a1, mismatch_16 +li $v0, 1 +end_16: +move $t2, $v0 +# If local_c2i_A2I_internal_3 goto true__430 +sw $t0, -24($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +bnez $t2, true__430 +lw $t0, -36($fp) +# Saves in local_c2i_A2I_internal_7 data_3 +la $t0, data_3 +lw $t1, -0($fp) +lw $t2, -32($fp) +# local_c2i_A2I_internal_6 <- char = local_c2i_A2I_internal_7 +move $t8, $t1 +move $t9, $t0 +loop_17: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_17 +beqz $a1, mismatch_17 +seq $v0, $a0, $a1 +beqz $v0, mismatch_17 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_17 +mismatch_17: +li $v0, 0 +j end_17 +check_17: +bnez $a1, mismatch_17 +li $v0, 1 +end_17: +move $t2, $v0 +# If local_c2i_A2I_internal_6 goto true__437 +sw $t0, -36($fp) +sw $t1, -0($fp) +sw $t2, -32($fp) +bnez $t2, true__437 +lw $t0, -48($fp) +# Saves in local_c2i_A2I_internal_10 data_4 +la $t0, data_4 +lw $t1, -0($fp) +lw $t2, -44($fp) +# local_c2i_A2I_internal_9 <- char = local_c2i_A2I_internal_10 +move $t8, $t1 +move $t9, $t0 +loop_18: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_18 +beqz $a1, mismatch_18 +seq $v0, $a0, $a1 +beqz $v0, mismatch_18 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_18 +mismatch_18: +li $v0, 0 +j end_18 +check_18: +bnez $a1, mismatch_18 +li $v0, 1 +end_18: +move $t2, $v0 +# If local_c2i_A2I_internal_9 goto true__444 +sw $t0, -48($fp) +sw $t1, -0($fp) +sw $t2, -44($fp) +bnez $t2, true__444 +lw $t0, -60($fp) +# Saves in local_c2i_A2I_internal_13 data_5 +la $t0, data_5 +lw $t1, -0($fp) +lw $t2, -56($fp) +# local_c2i_A2I_internal_12 <- char = local_c2i_A2I_internal_13 +move $t8, $t1 +move $t9, $t0 +loop_19: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_19 +beqz $a1, mismatch_19 +seq $v0, $a0, $a1 +beqz $v0, mismatch_19 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_19 +mismatch_19: +li $v0, 0 +j end_19 +check_19: +bnez $a1, mismatch_19 +li $v0, 1 +end_19: +move $t2, $v0 +# If local_c2i_A2I_internal_12 goto true__451 +sw $t0, -60($fp) +sw $t1, -0($fp) +sw $t2, -56($fp) +bnez $t2, true__451 +lw $t0, -72($fp) +# Saves in local_c2i_A2I_internal_16 data_6 +la $t0, data_6 +lw $t1, -0($fp) +lw $t2, -68($fp) +# local_c2i_A2I_internal_15 <- char = local_c2i_A2I_internal_16 +move $t8, $t1 +move $t9, $t0 +loop_20: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_20 +beqz $a1, mismatch_20 +seq $v0, $a0, $a1 +beqz $v0, mismatch_20 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_20 +mismatch_20: +li $v0, 0 +j end_20 +check_20: +bnez $a1, mismatch_20 +li $v0, 1 +end_20: +move $t2, $v0 +# If local_c2i_A2I_internal_15 goto true__458 +sw $t0, -72($fp) +sw $t1, -0($fp) +sw $t2, -68($fp) +bnez $t2, true__458 +lw $t0, -84($fp) +# Saves in local_c2i_A2I_internal_19 data_7 +la $t0, data_7 +lw $t1, -0($fp) +lw $t2, -80($fp) +# local_c2i_A2I_internal_18 <- char = local_c2i_A2I_internal_19 +move $t8, $t1 +move $t9, $t0 +loop_21: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_21 +beqz $a1, mismatch_21 +seq $v0, $a0, $a1 +beqz $v0, mismatch_21 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_21 +mismatch_21: +li $v0, 0 +j end_21 +check_21: +bnez $a1, mismatch_21 +li $v0, 1 +end_21: +move $t2, $v0 +# If local_c2i_A2I_internal_18 goto true__465 +sw $t0, -84($fp) +sw $t1, -0($fp) +sw $t2, -80($fp) +bnez $t2, true__465 +lw $t0, -96($fp) +# Saves in local_c2i_A2I_internal_22 data_8 +la $t0, data_8 +lw $t1, -0($fp) +lw $t2, -92($fp) +# local_c2i_A2I_internal_21 <- char = local_c2i_A2I_internal_22 +move $t8, $t1 +move $t9, $t0 +loop_22: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_22 +beqz $a1, mismatch_22 +seq $v0, $a0, $a1 +beqz $v0, mismatch_22 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_22 +mismatch_22: +li $v0, 0 +j end_22 +check_22: +bnez $a1, mismatch_22 +li $v0, 1 +end_22: +move $t2, $v0 +# If local_c2i_A2I_internal_21 goto true__472 +sw $t0, -96($fp) +sw $t1, -0($fp) +sw $t2, -92($fp) +bnez $t2, true__472 +lw $t0, -108($fp) +# Saves in local_c2i_A2I_internal_25 data_9 +la $t0, data_9 +lw $t1, -0($fp) +lw $t2, -104($fp) +# local_c2i_A2I_internal_24 <- char = local_c2i_A2I_internal_25 +move $t8, $t1 +move $t9, $t0 +loop_23: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_23 +beqz $a1, mismatch_23 +seq $v0, $a0, $a1 +beqz $v0, mismatch_23 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_23 +mismatch_23: +li $v0, 0 +j end_23 +check_23: +bnez $a1, mismatch_23 +li $v0, 1 +end_23: +move $t2, $v0 +# If local_c2i_A2I_internal_24 goto true__479 +sw $t0, -108($fp) +sw $t1, -0($fp) +sw $t2, -104($fp) +bnez $t2, true__479 +lw $t0, -120($fp) +# Saves in local_c2i_A2I_internal_28 data_10 +la $t0, data_10 +lw $t1, -0($fp) +lw $t2, -116($fp) +# local_c2i_A2I_internal_27 <- char = local_c2i_A2I_internal_28 +move $t8, $t1 +move $t9, $t0 +loop_24: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_24 +beqz $a1, mismatch_24 +seq $v0, $a0, $a1 +beqz $v0, mismatch_24 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_24 +mismatch_24: +li $v0, 0 +j end_24 +check_24: +bnez $a1, mismatch_24 +li $v0, 1 +end_24: +move $t2, $v0 +# If local_c2i_A2I_internal_27 goto true__486 +sw $t0, -120($fp) +sw $t1, -0($fp) +sw $t2, -116($fp) +bnez $t2, true__486 +lw $t0, -4($fp) +lw $t1, -128($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -128($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -128($fp) +# saves the return value +move $t0, $v0 +lw $t1, -132($fp) +# Moving 0 to local_c2i_A2I_internal_31 +li $t1, 0 +sw $t1, -132($fp) +lw $t2, -124($fp) +# Moving local_c2i_A2I_internal_31 to local_c2i_A2I_internal_29 +move $t2, $t1 +sw $t2, -124($fp) +sw $t0, -128($fp) +sw $t1, -132($fp) +sw $t2, -124($fp) +j end__486 +true__486: +lw $t0, -124($fp) +# Moving 9 to local_c2i_A2I_internal_29 +li $t0, 9 +sw $t0, -124($fp) +sw $t0, -124($fp) +end__486: +lw $t0, -124($fp) +lw $t1, -112($fp) +# Moving local_c2i_A2I_internal_29 to local_c2i_A2I_internal_26 +move $t1, $t0 +sw $t1, -112($fp) +sw $t0, -124($fp) +sw $t1, -112($fp) +j end__479 +true__479: +lw $t0, -112($fp) +# Moving 8 to local_c2i_A2I_internal_26 +li $t0, 8 +sw $t0, -112($fp) +sw $t0, -112($fp) +end__479: +lw $t0, -112($fp) +lw $t1, -100($fp) +# Moving local_c2i_A2I_internal_26 to local_c2i_A2I_internal_23 +move $t1, $t0 +sw $t1, -100($fp) +sw $t0, -112($fp) +sw $t1, -100($fp) +j end__472 +true__472: +lw $t0, -100($fp) +# Moving 7 to local_c2i_A2I_internal_23 +li $t0, 7 +sw $t0, -100($fp) +sw $t0, -100($fp) +end__472: +lw $t0, -100($fp) +lw $t1, -88($fp) +# Moving local_c2i_A2I_internal_23 to local_c2i_A2I_internal_20 +move $t1, $t0 +sw $t1, -88($fp) +sw $t0, -100($fp) +sw $t1, -88($fp) +j end__465 +true__465: +lw $t0, -88($fp) +# Moving 6 to local_c2i_A2I_internal_20 +li $t0, 6 +sw $t0, -88($fp) +sw $t0, -88($fp) +end__465: +lw $t0, -88($fp) +lw $t1, -76($fp) +# Moving local_c2i_A2I_internal_20 to local_c2i_A2I_internal_17 +move $t1, $t0 +sw $t1, -76($fp) +sw $t0, -88($fp) +sw $t1, -76($fp) +j end__458 +true__458: +lw $t0, -76($fp) +# Moving 5 to local_c2i_A2I_internal_17 +li $t0, 5 +sw $t0, -76($fp) +sw $t0, -76($fp) +end__458: +lw $t0, -76($fp) +lw $t1, -64($fp) +# Moving local_c2i_A2I_internal_17 to local_c2i_A2I_internal_14 +move $t1, $t0 +sw $t1, -64($fp) +sw $t0, -76($fp) +sw $t1, -64($fp) +j end__451 +true__451: +lw $t0, -64($fp) +# Moving 4 to local_c2i_A2I_internal_14 +li $t0, 4 +sw $t0, -64($fp) +sw $t0, -64($fp) +end__451: +lw $t0, -64($fp) +lw $t1, -52($fp) +# Moving local_c2i_A2I_internal_14 to local_c2i_A2I_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -64($fp) +sw $t1, -52($fp) +j end__444 +true__444: +lw $t0, -52($fp) +# Moving 3 to local_c2i_A2I_internal_11 +li $t0, 3 +sw $t0, -52($fp) +sw $t0, -52($fp) +end__444: +lw $t0, -52($fp) +lw $t1, -40($fp) +# Moving local_c2i_A2I_internal_11 to local_c2i_A2I_internal_8 +move $t1, $t0 +sw $t1, -40($fp) +sw $t0, -52($fp) +sw $t1, -40($fp) +j end__437 +true__437: +lw $t0, -40($fp) +# Moving 2 to local_c2i_A2I_internal_8 +li $t0, 2 +sw $t0, -40($fp) +sw $t0, -40($fp) +end__437: +lw $t0, -40($fp) +lw $t1, -28($fp) +# Moving local_c2i_A2I_internal_8 to local_c2i_A2I_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -40($fp) +sw $t1, -28($fp) +j end__430 +true__430: +lw $t0, -28($fp) +# Moving 1 to local_c2i_A2I_internal_5 +li $t0, 1 +sw $t0, -28($fp) +sw $t0, -28($fp) +end__430: +lw $t0, -28($fp) +lw $t1, -16($fp) +# Moving local_c2i_A2I_internal_5 to local_c2i_A2I_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -28($fp) +sw $t1, -16($fp) +j end__423 +true__423: +lw $t0, -16($fp) +# Moving 0 to local_c2i_A2I_internal_2 +li $t0, 0 +sw $t0, -16($fp) +sw $t0, -16($fp) +end__423: +lw $t0, -16($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 136 +jr $ra + + +function_i2c_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_i2c_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_32 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_i2c_A2I_internal_0 <- i = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_0 goto true__549 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__549 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_i2c_A2I_internal_2 <- i = 1 +li $t9, 1 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_2 goto true__553 +sw $t0, -0($fp) +sw $t1, -16($fp) +bnez $t1, true__553 +lw $t0, -0($fp) +lw $t1, -24($fp) +# local_i2c_A2I_internal_4 <- i = 2 +li $t9, 2 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_4 goto true__557 +sw $t0, -0($fp) +sw $t1, -24($fp) +bnez $t1, true__557 +lw $t0, -0($fp) +lw $t1, -32($fp) +# local_i2c_A2I_internal_6 <- i = 3 +li $t9, 3 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_6 goto true__561 +sw $t0, -0($fp) +sw $t1, -32($fp) +bnez $t1, true__561 +lw $t0, -0($fp) +lw $t1, -40($fp) +# local_i2c_A2I_internal_8 <- i = 4 +li $t9, 4 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_8 goto true__565 +sw $t0, -0($fp) +sw $t1, -40($fp) +bnez $t1, true__565 +lw $t0, -0($fp) +lw $t1, -48($fp) +# local_i2c_A2I_internal_10 <- i = 5 +li $t9, 5 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_10 goto true__569 +sw $t0, -0($fp) +sw $t1, -48($fp) +bnez $t1, true__569 +lw $t0, -0($fp) +lw $t1, -56($fp) +# local_i2c_A2I_internal_12 <- i = 6 +li $t9, 6 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_12 goto true__573 +sw $t0, -0($fp) +sw $t1, -56($fp) +bnez $t1, true__573 +lw $t0, -0($fp) +lw $t1, -64($fp) +# local_i2c_A2I_internal_14 <- i = 7 +li $t9, 7 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_14 goto true__577 +sw $t0, -0($fp) +sw $t1, -64($fp) +bnez $t1, true__577 +lw $t0, -0($fp) +lw $t1, -72($fp) +# local_i2c_A2I_internal_16 <- i = 8 +li $t9, 8 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_16 goto true__581 +sw $t0, -0($fp) +sw $t1, -72($fp) +bnez $t1, true__581 +lw $t0, -0($fp) +lw $t1, -80($fp) +# local_i2c_A2I_internal_18 <- i = 9 +li $t9, 9 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_18 goto true__585 +sw $t0, -0($fp) +sw $t1, -80($fp) +bnez $t1, true__585 +lw $t0, -4($fp) +lw $t1, -88($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -88($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Saves in local_i2c_A2I_internal_21 data_11 +la $t1, data_11 +lw $t2, -96($fp) +# Moving local_i2c_A2I_internal_21 to local_i2c_A2I_internal_22 +move $t2, $t1 +sw $t2, -96($fp) +lw $t3, -84($fp) +# Moving local_i2c_A2I_internal_22 to local_i2c_A2I_internal_19 +move $t3, $t2 +sw $t3, -84($fp) +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -96($fp) +sw $t3, -84($fp) +j end__585 +true__585: +lw $t0, -100($fp) +# Saves in local_i2c_A2I_internal_23 data_12 +la $t0, data_12 +lw $t1, -84($fp) +# Moving local_i2c_A2I_internal_23 to local_i2c_A2I_internal_19 +move $t1, $t0 +sw $t1, -84($fp) +sw $t0, -100($fp) +sw $t1, -84($fp) +end__585: +lw $t0, -84($fp) +lw $t1, -76($fp) +# Moving local_i2c_A2I_internal_19 to local_i2c_A2I_internal_17 +move $t1, $t0 +sw $t1, -76($fp) +sw $t0, -84($fp) +sw $t1, -76($fp) +j end__581 +true__581: +lw $t0, -104($fp) +# Saves in local_i2c_A2I_internal_24 data_13 +la $t0, data_13 +lw $t1, -76($fp) +# Moving local_i2c_A2I_internal_24 to local_i2c_A2I_internal_17 +move $t1, $t0 +sw $t1, -76($fp) +sw $t0, -104($fp) +sw $t1, -76($fp) +end__581: +lw $t0, -76($fp) +lw $t1, -68($fp) +# Moving local_i2c_A2I_internal_17 to local_i2c_A2I_internal_15 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -76($fp) +sw $t1, -68($fp) +j end__577 +true__577: +lw $t0, -108($fp) +# Saves in local_i2c_A2I_internal_25 data_14 +la $t0, data_14 +lw $t1, -68($fp) +# Moving local_i2c_A2I_internal_25 to local_i2c_A2I_internal_15 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -108($fp) +sw $t1, -68($fp) +end__577: +lw $t0, -68($fp) +lw $t1, -60($fp) +# Moving local_i2c_A2I_internal_15 to local_i2c_A2I_internal_13 +move $t1, $t0 +sw $t1, -60($fp) +sw $t0, -68($fp) +sw $t1, -60($fp) +j end__573 +true__573: +lw $t0, -112($fp) +# Saves in local_i2c_A2I_internal_26 data_15 +la $t0, data_15 +lw $t1, -60($fp) +# Moving local_i2c_A2I_internal_26 to local_i2c_A2I_internal_13 +move $t1, $t0 +sw $t1, -60($fp) +sw $t0, -112($fp) +sw $t1, -60($fp) +end__573: +lw $t0, -60($fp) +lw $t1, -52($fp) +# Moving local_i2c_A2I_internal_13 to local_i2c_A2I_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -60($fp) +sw $t1, -52($fp) +j end__569 +true__569: +lw $t0, -116($fp) +# Saves in local_i2c_A2I_internal_27 data_16 +la $t0, data_16 +lw $t1, -52($fp) +# Moving local_i2c_A2I_internal_27 to local_i2c_A2I_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -116($fp) +sw $t1, -52($fp) +end__569: +lw $t0, -52($fp) +lw $t1, -44($fp) +# Moving local_i2c_A2I_internal_11 to local_i2c_A2I_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -52($fp) +sw $t1, -44($fp) +j end__565 +true__565: +lw $t0, -120($fp) +# Saves in local_i2c_A2I_internal_28 data_17 +la $t0, data_17 +lw $t1, -44($fp) +# Moving local_i2c_A2I_internal_28 to local_i2c_A2I_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -120($fp) +sw $t1, -44($fp) +end__565: +lw $t0, -44($fp) +lw $t1, -36($fp) +# Moving local_i2c_A2I_internal_9 to local_i2c_A2I_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -44($fp) +sw $t1, -36($fp) +j end__561 +true__561: +lw $t0, -124($fp) +# Saves in local_i2c_A2I_internal_29 data_18 +la $t0, data_18 +lw $t1, -36($fp) +# Moving local_i2c_A2I_internal_29 to local_i2c_A2I_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -124($fp) +sw $t1, -36($fp) +end__561: +lw $t0, -36($fp) +lw $t1, -28($fp) +# Moving local_i2c_A2I_internal_7 to local_i2c_A2I_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -36($fp) +sw $t1, -28($fp) +j end__557 +true__557: +lw $t0, -128($fp) +# Saves in local_i2c_A2I_internal_30 data_19 +la $t0, data_19 +lw $t1, -28($fp) +# Moving local_i2c_A2I_internal_30 to local_i2c_A2I_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -128($fp) +sw $t1, -28($fp) +end__557: +lw $t0, -28($fp) +lw $t1, -20($fp) +# Moving local_i2c_A2I_internal_5 to local_i2c_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -28($fp) +sw $t1, -20($fp) +j end__553 +true__553: +lw $t0, -132($fp) +# Saves in local_i2c_A2I_internal_31 data_20 +la $t0, data_20 +lw $t1, -20($fp) +# Moving local_i2c_A2I_internal_31 to local_i2c_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -132($fp) +sw $t1, -20($fp) +end__553: +lw $t0, -20($fp) +lw $t1, -12($fp) +# Moving local_i2c_A2I_internal_3 to local_i2c_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -20($fp) +sw $t1, -12($fp) +j end__549 +true__549: +lw $t0, -136($fp) +# Saves in local_i2c_A2I_internal_32 data_21 +la $t0, data_21 +lw $t1, -12($fp) +# Moving local_i2c_A2I_internal_32 to local_i2c_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -136($fp) +sw $t1, -12($fp) +end__549: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 140 +jr $ra + + +function_a2i_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value s +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_a2i_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_34 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_a2i_A2I_internal_2 <- Type of s +la $t1, type_String +lw $t2, -20($fp) +# Saves in local_a2i_A2I_internal_3 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_2 <- local_a2i_A2I_internal_2 = local_a2i_A2I_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_25: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_25 +beqz $a1, mismatch_25 +seq $v0, $a0, $a1 +beqz $v0, mismatch_25 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_25 +mismatch_25: +li $v0, 0 +j end_25 +check_25: +bnez $a1, mismatch_25 +li $v0, 1 +end_25: +move $t1, $v0 +# If not local_a2i_A2I_internal_2 goto continue__682 +sw $t0, -0($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +beqz $t1, continue__682 +la $a0, dispatch_error +j .raise +continue__682: +lw $t0, -12($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# local_a2i_A2I_internal_0 <- local_a2i_A2I_internal_1 = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_a2i_A2I_internal_0 goto true__693 +sw $t0, -12($fp) +sw $t1, -8($fp) +bnez $t1, true__693 +lw $t0, -0($fp) +lw $t1, -36($fp) +# local_a2i_A2I_internal_7 <- Type of s +la $t1, type_String +lw $t2, -40($fp) +# Saves in local_a2i_A2I_internal_8 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_7 <- local_a2i_A2I_internal_7 = local_a2i_A2I_internal_8 +move $t8, $t1 +move $t9, $t2 +loop_26: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_26 +beqz $a1, mismatch_26 +seq $v0, $a0, $a1 +beqz $v0, mismatch_26 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_26 +mismatch_26: +li $v0, 0 +j end_26 +check_26: +bnez $a1, mismatch_26 +li $v0, 1 +end_26: +move $t1, $v0 +# If not local_a2i_A2I_internal_7 goto continue__700 +sw $t0, -0($fp) +sw $t1, -36($fp) +sw $t2, -40($fp) +beqz $t1, continue__700 +la $a0, dispatch_error +j .raise +continue__700: +lw $t0, -32($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 0 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_a2i_A2I_internal_9 data_22 +la $t1, data_22 +lw $t2, -28($fp) +# local_a2i_A2I_internal_5 <- local_a2i_A2I_internal_6 = local_a2i_A2I_internal_9 +move $t8, $t0 +move $t9, $t1 +loop_27: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_27 +beqz $a1, mismatch_27 +seq $v0, $a0, $a1 +beqz $v0, mismatch_27 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_27 +mismatch_27: +li $v0, 0 +j end_27 +check_27: +bnez $a1, mismatch_27 +li $v0, 1 +end_27: +move $t2, $v0 +# If local_a2i_A2I_internal_5 goto true__714 +sw $t0, -32($fp) +sw $t1, -44($fp) +sw $t2, -28($fp) +bnez $t2, true__714 +lw $t0, -0($fp) +lw $t1, -60($fp) +# local_a2i_A2I_internal_13 <- Type of s +la $t1, type_String +lw $t2, -64($fp) +# Saves in local_a2i_A2I_internal_14 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_13 <- local_a2i_A2I_internal_13 = local_a2i_A2I_internal_14 +move $t8, $t1 +move $t9, $t2 +loop_28: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_28 +beqz $a1, mismatch_28 +seq $v0, $a0, $a1 +beqz $v0, mismatch_28 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_28 +mismatch_28: +li $v0, 0 +j end_28 +check_28: +bnez $a1, mismatch_28 +li $v0, 1 +end_28: +move $t1, $v0 +# If not local_a2i_A2I_internal_13 goto continue__721 +sw $t0, -0($fp) +sw $t1, -60($fp) +sw $t2, -64($fp) +beqz $t1, continue__721 +la $a0, dispatch_error +j .raise +continue__721: +lw $t0, -56($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 0 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Saves in local_a2i_A2I_internal_15 data_23 +la $t1, data_23 +lw $t2, -52($fp) +# local_a2i_A2I_internal_11 <- local_a2i_A2I_internal_12 = local_a2i_A2I_internal_15 +move $t8, $t0 +move $t9, $t1 +loop_29: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_29 +beqz $a1, mismatch_29 +seq $v0, $a0, $a1 +beqz $v0, mismatch_29 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_29 +mismatch_29: +li $v0, 0 +j end_29 +check_29: +bnez $a1, mismatch_29 +li $v0, 1 +end_29: +move $t2, $v0 +# If local_a2i_A2I_internal_11 goto true__735 +sw $t0, -56($fp) +sw $t1, -68($fp) +sw $t2, -52($fp) +bnez $t2, true__735 +lw $t0, -4($fp) +lw $t1, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_aux_A2I +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -76($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Moving local_a2i_A2I_internal_17 to local_a2i_A2I_internal_16 +move $t1, $t0 +sw $t1, -72($fp) +sw $t0, -76($fp) +sw $t1, -72($fp) +j end__735 +true__735: +lw $t0, -0($fp) +lw $t1, -88($fp) +# local_a2i_A2I_internal_20 <- Type of s +la $t1, type_String +lw $t2, -92($fp) +# Saves in local_a2i_A2I_internal_21 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_20 <- local_a2i_A2I_internal_20 = local_a2i_A2I_internal_21 +move $t8, $t1 +move $t9, $t2 +loop_30: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_30 +beqz $a1, mismatch_30 +seq $v0, $a0, $a1 +beqz $v0, mismatch_30 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_30 +mismatch_30: +li $v0, 0 +j end_30 +check_30: +bnez $a1, mismatch_30 +li $v0, 1 +end_30: +move $t1, $v0 +# If not local_a2i_A2I_internal_20 goto continue__749 +sw $t0, -0($fp) +sw $t1, -88($fp) +sw $t2, -92($fp) +beqz $t1, continue__749 +la $a0, dispatch_error +j .raise +continue__749: +lw $t0, -84($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# local_a2i_A2I_internal_18 <- local_a2i_A2I_internal_19 - 1 +addi $t1, $t0, -1 +lw $t2, -0($fp) +lw $t3, -100($fp) +# local_a2i_A2I_internal_23 <- Type of s +la $t3, type_String +lw $t4, -104($fp) +# Saves in local_a2i_A2I_internal_24 data_0 +la $t4, data_0 +# local_a2i_A2I_internal_23 <- local_a2i_A2I_internal_23 = local_a2i_A2I_internal_24 +move $t8, $t3 +move $t9, $t4 +loop_31: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_31 +beqz $a1, mismatch_31 +seq $v0, $a0, $a1 +beqz $v0, mismatch_31 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_31 +mismatch_31: +li $v0, 0 +j end_31 +check_31: +bnez $a1, mismatch_31 +li $v0, 1 +end_31: +move $t3, $v0 +# If not local_a2i_A2I_internal_23 goto continue__763 +sw $t0, -84($fp) +sw $t1, -80($fp) +sw $t2, -0($fp) +sw $t3, -100($fp) +sw $t4, -104($fp) +beqz $t3, continue__763 +la $a0, dispatch_error +j .raise +continue__763: +lw $t0, -96($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -80($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -80($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -108($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_aux_A2I +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -4($fp) +sw $t2, -108($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Moving local_a2i_A2I_internal_25 to local_a2i_A2I_internal_16 +move $t1, $t0 +sw $t1, -72($fp) +sw $t0, -108($fp) +sw $t1, -72($fp) +end__735: +lw $t0, -72($fp) +lw $t1, -48($fp) +# Moving local_a2i_A2I_internal_16 to local_a2i_A2I_internal_10 +move $t1, $t0 +sw $t1, -48($fp) +sw $t0, -72($fp) +sw $t1, -48($fp) +j end__714 +true__714: +lw $t0, -0($fp) +lw $t1, -124($fp) +# local_a2i_A2I_internal_29 <- Type of s +la $t1, type_String +lw $t2, -128($fp) +# Saves in local_a2i_A2I_internal_30 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_29 <- local_a2i_A2I_internal_29 = local_a2i_A2I_internal_30 +move $t8, $t1 +move $t9, $t2 +loop_32: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_32 +beqz $a1, mismatch_32 +seq $v0, $a0, $a1 +beqz $v0, mismatch_32 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_32 +mismatch_32: +li $v0, 0 +j end_32 +check_32: +bnez $a1, mismatch_32 +li $v0, 1 +end_32: +move $t1, $v0 +# If not local_a2i_A2I_internal_29 goto continue__787 +sw $t0, -0($fp) +sw $t1, -124($fp) +sw $t2, -128($fp) +beqz $t1, continue__787 +la $a0, dispatch_error +j .raise +continue__787: +lw $t0, -120($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -120($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -120($fp) +# saves the return value +move $t0, $v0 +lw $t1, -116($fp) +# local_a2i_A2I_internal_27 <- local_a2i_A2I_internal_28 - 1 +addi $t1, $t0, -1 +lw $t2, -0($fp) +lw $t3, -136($fp) +# local_a2i_A2I_internal_32 <- Type of s +la $t3, type_String +lw $t4, -140($fp) +# Saves in local_a2i_A2I_internal_33 data_0 +la $t4, data_0 +# local_a2i_A2I_internal_32 <- local_a2i_A2I_internal_32 = local_a2i_A2I_internal_33 +move $t8, $t3 +move $t9, $t4 +loop_33: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_33 +beqz $a1, mismatch_33 +seq $v0, $a0, $a1 +beqz $v0, mismatch_33 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_33 +mismatch_33: +li $v0, 0 +j end_33 +check_33: +bnez $a1, mismatch_33 +li $v0, 1 +end_33: +move $t3, $v0 +# If not local_a2i_A2I_internal_32 goto continue__801 +sw $t0, -120($fp) +sw $t1, -116($fp) +sw $t2, -0($fp) +sw $t3, -136($fp) +sw $t4, -140($fp) +beqz $t3, continue__801 +la $a0, dispatch_error +j .raise +continue__801: +lw $t0, -132($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -116($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -132($fp) +sw $t1, -116($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -132($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -144($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_aux_A2I +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -132($fp) +sw $t1, -4($fp) +sw $t2, -144($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -144($fp) +# saves the return value +move $t0, $v0 +lw $t1, -112($fp) +# local_a2i_A2I_internal_26 <- ~local_a2i_A2I_internal_34 +not $t1, $t0 +addi $t1, $t1, 1 +lw $t2, -48($fp) +# Moving local_a2i_A2I_internal_26 to local_a2i_A2I_internal_10 +move $t2, $t1 +sw $t2, -48($fp) +sw $t0, -144($fp) +sw $t1, -112($fp) +sw $t2, -48($fp) +end__714: +lw $t0, -48($fp) +lw $t1, -24($fp) +# Moving local_a2i_A2I_internal_10 to local_a2i_A2I_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -48($fp) +sw $t1, -24($fp) +j end__693 +true__693: +lw $t0, -24($fp) +# Moving 0 to local_a2i_A2I_internal_4 +li $t0, 0 +sw $t0, -24($fp) +sw $t0, -24($fp) +end__693: +lw $t0, -24($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 148 +jr $ra + + +function_a2i_aux_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value s +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_a2i_aux_A2I_int_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_j_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_i_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 0 to local_a2i_aux_A2I_int_0 +li $t0, 0 +sw $t0, -8($fp) +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_a2i_aux_A2I_internal_3 <- Type of s +la $t2, type_String +lw $t3, -24($fp) +# Saves in local_a2i_aux_A2I_internal_4 data_0 +la $t3, data_0 +# local_a2i_aux_A2I_internal_3 <- local_a2i_aux_A2I_internal_3 = local_a2i_aux_A2I_internal_4 +move $t8, $t2 +move $t9, $t3 +loop_34: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_34 +beqz $a1, mismatch_34 +seq $v0, $a0, $a1 +beqz $v0, mismatch_34 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_34 +mismatch_34: +li $v0, 0 +j end_34 +check_34: +bnez $a1, mismatch_34 +li $v0, 1 +end_34: +move $t2, $v0 +# If not local_a2i_aux_A2I_internal_3 goto continue__831 +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +sw $t3, -24($fp) +beqz $t2, continue__831 +la $a0, dispatch_error +j .raise +continue__831: +lw $t0, -16($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_a2i_aux_A2I_internal_2 to local_a2i_aux_A2I_j_1 +move $t1, $t0 +sw $t1, -12($fp) +lw $t2, -28($fp) +# Moving 0 to local_a2i_aux_A2I_i_5 +li $t2, 0 +sw $t2, -28($fp) +lw $t3, -32($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t3, $v0 +sw $t0, -16($fp) +sw $t1, -12($fp) +sw $t2, -28($fp) +sw $t3, -32($fp) +start__844: +lw $t0, -28($fp) +lw $t1, -12($fp) +lw $t2, -36($fp) +# local_a2i_aux_A2I_internal_7 <- local_a2i_aux_A2I_i_5 < local_a2i_aux_A2I_j_1 +slt $t2, $t0, $t1 +# If not local_a2i_aux_A2I_internal_7 goto end__844 +sw $t0, -28($fp) +sw $t1, -12($fp) +sw $t2, -36($fp) +beqz $t2, end__844 +lw $t0, -8($fp) +lw $t1, -44($fp) +# local_a2i_aux_A2I_internal_9 <- local_a2i_aux_A2I_int_0 * 10 +li $t9, 10 +mult $t0, $t9 +mflo $t1 +lw $t2, -0($fp) +lw $t3, -52($fp) +# local_a2i_aux_A2I_internal_11 <- Type of s +la $t3, type_String +lw $t4, -56($fp) +# Saves in local_a2i_aux_A2I_internal_12 data_0 +la $t4, data_0 +# local_a2i_aux_A2I_internal_11 <- local_a2i_aux_A2I_internal_11 = local_a2i_aux_A2I_internal_12 +move $t8, $t3 +move $t9, $t4 +loop_35: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_35 +beqz $a1, mismatch_35 +seq $v0, $a0, $a1 +beqz $v0, mismatch_35 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_35 +mismatch_35: +li $v0, 0 +j end_35 +check_35: +bnez $a1, mismatch_35 +li $v0, 1 +end_35: +move $t3, $v0 +# If not local_a2i_aux_A2I_internal_11 goto continue__858 +sw $t0, -8($fp) +sw $t1, -44($fp) +sw $t2, -0($fp) +sw $t3, -52($fp) +sw $t4, -56($fp) +beqz $t3, continue__858 +la $a0, dispatch_error +j .raise +continue__858: +lw $t0, -48($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -28($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -28($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_c2i_A2I +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +lw $t2, -40($fp) +# local_a2i_aux_A2I_internal_8 <- local_a2i_aux_A2I_internal_9 + local_a2i_aux_A2I_internal_13 +add $t2, $t1, $t0 +lw $t3, -8($fp) +# Moving local_a2i_aux_A2I_internal_8 to local_a2i_aux_A2I_int_0 +move $t3, $t2 +sw $t3, -8($fp) +lw $t4, -28($fp) +lw $t5, -64($fp) +# local_a2i_aux_A2I_internal_14 <- local_a2i_aux_A2I_i_5 + 1 +addi $t5, $t4, 1 +# Moving local_a2i_aux_A2I_internal_14 to local_a2i_aux_A2I_i_5 +move $t4, $t5 +sw $t4, -28($fp) +lw $t6, -68($fp) +# Moving local_a2i_aux_A2I_internal_14 to local_a2i_aux_A2I_internal_15 +move $t6, $t5 +sw $t6, -68($fp) +lw $t7, -32($fp) +# Moving local_a2i_aux_A2I_internal_15 to local_a2i_aux_A2I_internal_6 +move $t7, $t6 +sw $t7, -32($fp) +sw $t0, -60($fp) +sw $t1, -44($fp) +sw $t2, -40($fp) +sw $t3, -8($fp) +sw $t4, -28($fp) +sw $t5, -64($fp) +sw $t6, -68($fp) +sw $t7, -32($fp) +j start__844 +end__844: +lw $t0, -8($fp) +lw $t1, -72($fp) +# Moving local_a2i_aux_A2I_int_0 to local_a2i_aux_A2I_internal_16 +move $t1, $t0 +sw $t1, -72($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -72($fp) +# Removing all locals from stack +addiu $sp, $sp, 76 +jr $ra + + +function_i2a_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_i2a_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_i2a_A2I_internal_0 <- i = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_i2a_A2I_internal_0 goto true__889 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__889 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_i2a_A2I_internal_2 <- 0 < i +li $t9, 0 +slt $t1, $t9, $t0 +# If local_i2a_A2I_internal_2 goto true__893 +sw $t0, -0($fp) +sw $t1, -16($fp) +bnez $t1, true__893 +lw $t0, -24($fp) +# Saves in local_i2a_A2I_internal_4 data_24 +la $t0, data_24 +lw $t1, -32($fp) +li $t9, 1 +# local_i2a_A2I_internal_6 <- ~1 +not $t1, $t9 +addi $t1, $t1, 1 +lw $t2, -0($fp) +lw $t3, -28($fp) +# local_i2a_A2I_internal_5 <- i * local_i2a_A2I_internal_6 +mult $t2, $t1 +mflo $t3 +lw $t4, -4($fp) +lw $t5, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_aux_A2I +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -32($fp) +sw $t2, -0($fp) +sw $t3, -28($fp) +sw $t4, -4($fp) +sw $t5, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +lw $t2, -44($fp) +# local_i2a_A2I_internal_9 <- Type of local_i2a_A2I_internal_4 +la $t2, type_String +lw $t3, -48($fp) +# Saves in local_i2a_A2I_internal_10 data_0 +la $t3, data_0 +# local_i2a_A2I_internal_9 <- local_i2a_A2I_internal_9 = local_i2a_A2I_internal_10 +move $t8, $t2 +move $t9, $t3 +loop_36: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_36 +beqz $a1, mismatch_36 +seq $v0, $a0, $a1 +beqz $v0, mismatch_36 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_36 +mismatch_36: +li $v0, 0 +j end_36 +check_36: +bnez $a1, mismatch_36 +li $v0, 1 +end_36: +move $t2, $v0 +# If not local_i2a_A2I_internal_9 goto continue__909 +sw $t0, -36($fp) +sw $t1, -24($fp) +sw $t2, -44($fp) +sw $t3, -48($fp) +beqz $t2, continue__909 +la $a0, dispatch_error +j .raise +continue__909: +lw $t0, -40($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -36($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -36($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_i2a_A2I_internal_8 to local_i2a_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -40($fp) +sw $t1, -20($fp) +j end__893 +true__893: +lw $t0, -4($fp) +lw $t1, -52($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_aux_A2I +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -52($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_i2a_A2I_internal_11 to local_i2a_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -52($fp) +sw $t1, -20($fp) +end__893: +lw $t0, -20($fp) +lw $t1, -12($fp) +# Moving local_i2a_A2I_internal_3 to local_i2a_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -20($fp) +sw $t1, -12($fp) +j end__889 +true__889: +lw $t0, -56($fp) +# Saves in local_i2a_A2I_internal_12 data_25 +la $t0, data_25 +lw $t1, -12($fp) +# Moving local_i2a_A2I_internal_12 to local_i2a_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -56($fp) +sw $t1, -12($fp) +end__889: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_i2a_aux_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_i2a_aux_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_next_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_i2a_aux_A2I_internal_0 <- i = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_i2a_aux_A2I_internal_0 goto true__942 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__942 +lw $t0, -0($fp) +lw $t1, -20($fp) +# local_i2a_aux_A2I_internal_3 <- i / 10 +li $t9, 10 +la $a0, zero_error +beqz $t9, .raise +div $t0, $t9 +mflo $t1 +lw $t2, -16($fp) +# Moving local_i2a_aux_A2I_internal_3 to local_i2a_aux_A2I_next_2 +move $t2, $t1 +sw $t2, -16($fp) +lw $t3, -4($fp) +lw $t4, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_aux_A2I +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -20($fp) +sw $t2, -16($fp) +sw $t3, -4($fp) +sw $t4, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +lw $t2, -32($fp) +# local_i2a_aux_A2I_internal_6 <- local_i2a_aux_A2I_next_2 * 10 +li $t9, 10 +mult $t1, $t9 +mflo $t2 +lw $t3, -0($fp) +lw $t4, -28($fp) +# local_i2a_aux_A2I_internal_5 <- i - local_i2a_aux_A2I_internal_6 +sub $t4, $t3, $t2 +lw $t5, -4($fp) +lw $t6, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t5) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2c_A2I +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t5, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -16($fp) +sw $t2, -32($fp) +sw $t3, -0($fp) +sw $t4, -28($fp) +sw $t5, -4($fp) +sw $t6, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +lw $t2, -44($fp) +# local_i2a_aux_A2I_internal_9 <- Type of local_i2a_aux_A2I_internal_4 +la $t2, type_String +lw $t3, -48($fp) +# Saves in local_i2a_aux_A2I_internal_10 data_0 +la $t3, data_0 +# local_i2a_aux_A2I_internal_9 <- local_i2a_aux_A2I_internal_9 = local_i2a_aux_A2I_internal_10 +move $t8, $t2 +move $t9, $t3 +loop_37: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_37 +beqz $a1, mismatch_37 +seq $v0, $a0, $a1 +beqz $v0, mismatch_37 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_37 +mismatch_37: +li $v0, 0 +j end_37 +check_37: +bnez $a1, mismatch_37 +li $v0, 1 +end_37: +move $t2, $v0 +# If not local_i2a_aux_A2I_internal_9 goto continue__963 +sw $t0, -36($fp) +sw $t1, -24($fp) +sw $t2, -44($fp) +sw $t3, -48($fp) +beqz $t2, continue__963 +la $a0, dispatch_error +j .raise +continue__963: +lw $t0, -40($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -36($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -36($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_i2a_aux_A2I_internal_8 to local_i2a_aux_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -40($fp) +sw $t1, -12($fp) +j end__942 +true__942: +lw $t0, -52($fp) +# Saves in local_i2a_aux_A2I_internal_11 data_26 +la $t0, data_26 +lw $t1, -12($fp) +# Moving local_i2a_aux_A2I_internal_11 to local_i2a_aux_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -52($fp) +sw $t1, -12($fp) +end__942: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 56 +jr $ra + + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_avar_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_a_var_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_Main_Main_internal_0 data_27 +la $t0, data_27 +lw $t1, -0($fp) +# self . char <- SET local_Main_Main_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t2, $v0 +# self . avar <- SET local_Main_Main_avar_1 +sw $t2, 16($t1) +lw $t3, -12($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t3, $v0 +# self . a_var <- SET local_Main_Main_a_var_2 +sw $t3, 20($t1) +# self . flag <- SET 1 +li $t9, 1 +sw $t9, 24($t1) +lw $t4, -16($fp) +# Moving self to local_Main_Main_internal_3 +move $t4, $t1 +sw $t4, -16($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +sw $t4, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 20 +jr $ra + + +function_menu_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_menu_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_39 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_40 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_41 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_42 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_43 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_avar_44 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_45 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_46 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_47 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_48 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_49 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_50 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_51 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_52 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_menu_Main_internal_53 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_menu_Main_internal_0 data_28 +la $t0, data_28 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -12($fp) +# local_menu_Main_avar_2 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Saves in local_menu_Main_internal_4 data_29 +la $t1, data_29 +lw $t2, -0($fp) +lw $t3, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -0($fp) +sw $t3, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# Saves in local_menu_Main_internal_6 data_30 +la $t1, data_30 +lw $t2, -0($fp) +lw $t3, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -28($fp) +sw $t2, -0($fp) +sw $t3, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -36($fp) +# local_menu_Main_avar_8 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -0($fp) +sw $t2, -36($fp) +sw $t3, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_menu_Main_internal_10 data_31 +la $t1, data_31 +lw $t2, -0($fp) +lw $t3, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -44($fp) +sw $t2, -0($fp) +sw $t3, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Saves in local_menu_Main_internal_12 data_32 +la $t1, data_32 +lw $t2, -0($fp) +lw $t3, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -0($fp) +sw $t3, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -60($fp) +# local_menu_Main_avar_14 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -64($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +sw $t3, -64($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -64($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Saves in local_menu_Main_internal_16 data_33 +la $t1, data_33 +lw $t2, -0($fp) +lw $t3, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -64($fp) +sw $t1, -68($fp) +sw $t2, -0($fp) +sw $t3, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -76($fp) +# Saves in local_menu_Main_internal_18 data_34 +la $t1, data_34 +lw $t2, -0($fp) +lw $t3, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -72($fp) +sw $t1, -76($fp) +sw $t2, -0($fp) +sw $t3, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -84($fp) +# local_menu_Main_avar_20 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -88($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -80($fp) +sw $t1, -0($fp) +sw $t2, -84($fp) +sw $t3, -88($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Saves in local_menu_Main_internal_22 data_35 +la $t1, data_35 +lw $t2, -0($fp) +lw $t3, -96($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -0($fp) +sw $t3, -96($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -100($fp) +# Saves in local_menu_Main_internal_24 data_36 +la $t1, data_36 +lw $t2, -0($fp) +lw $t3, -104($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -100($fp) +sw $t2, -0($fp) +sw $t3, -104($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -104($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -108($fp) +# local_menu_Main_avar_26 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -112($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -104($fp) +sw $t1, -0($fp) +sw $t2, -108($fp) +sw $t3, -112($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -112($fp) +# saves the return value +move $t0, $v0 +lw $t1, -116($fp) +# Saves in local_menu_Main_internal_28 data_37 +la $t1, data_37 +lw $t2, -0($fp) +lw $t3, -120($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -112($fp) +sw $t1, -116($fp) +sw $t2, -0($fp) +sw $t3, -120($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -120($fp) +# saves the return value +move $t0, $v0 +lw $t1, -124($fp) +# Saves in local_menu_Main_internal_30 data_38 +la $t1, data_38 +lw $t2, -0($fp) +lw $t3, -128($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -120($fp) +sw $t1, -124($fp) +sw $t2, -0($fp) +sw $t3, -128($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -128($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -132($fp) +# local_menu_Main_avar_32 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -136($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -128($fp) +sw $t1, -0($fp) +sw $t2, -132($fp) +sw $t3, -136($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -136($fp) +# saves the return value +move $t0, $v0 +lw $t1, -140($fp) +# Saves in local_menu_Main_internal_34 data_39 +la $t1, data_39 +lw $t2, -0($fp) +lw $t3, -144($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -136($fp) +sw $t1, -140($fp) +sw $t2, -0($fp) +sw $t3, -144($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -144($fp) +# saves the return value +move $t0, $v0 +lw $t1, -148($fp) +# Saves in local_menu_Main_internal_36 data_40 +la $t1, data_40 +lw $t2, -0($fp) +lw $t3, -152($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -144($fp) +sw $t1, -148($fp) +sw $t2, -0($fp) +sw $t3, -152($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -152($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -156($fp) +# local_menu_Main_avar_38 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -160($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -152($fp) +sw $t1, -0($fp) +sw $t2, -156($fp) +sw $t3, -160($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -160($fp) +# saves the return value +move $t0, $v0 +lw $t1, -164($fp) +# Saves in local_menu_Main_internal_40 data_41 +la $t1, data_41 +lw $t2, -0($fp) +lw $t3, -168($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -160($fp) +sw $t1, -164($fp) +sw $t2, -0($fp) +sw $t3, -168($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -168($fp) +# saves the return value +move $t0, $v0 +lw $t1, -172($fp) +# Saves in local_menu_Main_internal_42 data_42 +la $t1, data_42 +lw $t2, -0($fp) +lw $t3, -176($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -168($fp) +sw $t1, -172($fp) +sw $t2, -0($fp) +sw $t3, -176($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -176($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -180($fp) +# local_menu_Main_avar_44 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -184($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -176($fp) +sw $t1, -0($fp) +sw $t2, -180($fp) +sw $t3, -184($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -184($fp) +# saves the return value +move $t0, $v0 +lw $t1, -188($fp) +# Saves in local_menu_Main_internal_46 data_43 +la $t1, data_43 +lw $t2, -0($fp) +lw $t3, -192($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -184($fp) +sw $t1, -188($fp) +sw $t2, -0($fp) +sw $t3, -192($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -192($fp) +# saves the return value +move $t0, $v0 +lw $t1, -196($fp) +# Saves in local_menu_Main_internal_48 data_44 +la $t1, data_44 +lw $t2, -0($fp) +lw $t3, -200($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -192($fp) +sw $t1, -196($fp) +sw $t2, -0($fp) +sw $t3, -200($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -200($fp) +# saves the return value +move $t0, $v0 +lw $t1, -204($fp) +# Saves in local_menu_Main_internal_50 data_45 +la $t1, data_45 +lw $t2, -0($fp) +lw $t3, -208($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -200($fp) +sw $t1, -204($fp) +sw $t2, -0($fp) +sw $t3, -208($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -208($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -212($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_string_IO +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -208($fp) +sw $t1, -0($fp) +sw $t2, -212($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -212($fp) +# saves the return value +move $t0, $v0 +lw $t1, -216($fp) +# Moving local_menu_Main_internal_52 to local_menu_Main_internal_53 +move $t1, $t0 +sw $t1, -216($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -212($fp) +sw $t1, -216($fp) +# Removing all locals from stack +addiu $sp, $sp, 220 +jr $ra + + +function_prompt_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_prompt_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_Main_internal_5 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_prompt_Main_internal_0 data_46 +la $t0, data_46 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Saves in local_prompt_Main_internal_2 data_47 +la $t1, data_47 +lw $t2, -0($fp) +lw $t3, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_string_IO +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Moving local_prompt_Main_internal_4 to local_prompt_Main_internal_5 +move $t1, $t0 +sw $t1, -24($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 28 +jr $ra + + +function_get_int_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_get_int_Main_z_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_get_int_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_get_int_Main_s_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_get_int_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_get_int_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_get_int_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_get_int_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_get_int_Main_internal_7 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A2I +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 40($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Moving local_get_int_Main_internal_1 to local_get_int_Main_z_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -0($fp) +lw $t3, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_prompt_Main +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -4($fp) +sw $t2, -0($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_get_int_Main_internal_3 to local_get_int_Main_s_2 +move $t1, $t0 +sw $t1, -12($fp) +lw $t2, -4($fp) +lw $t3, -24($fp) +# local_get_int_Main_internal_5 <- Type of local_get_int_Main_z_0 +lw $t3, 0($t2) +lw $t4, -28($fp) +# Saves in local_get_int_Main_internal_6 data_0 +la $t4, data_0 +# local_get_int_Main_internal_5 <- local_get_int_Main_internal_5 = local_get_int_Main_internal_6 +move $t8, $t3 +move $t9, $t4 +loop_38: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_38 +beqz $a1, mismatch_38 +seq $v0, $a0, $a1 +beqz $v0, mismatch_38 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_38 +mismatch_38: +li $v0, 0 +j end_38 +check_38: +bnez $a1, mismatch_38 +li $v0, 1 +end_38: +move $t3, $v0 +# If not local_get_int_Main_internal_5 goto continue__1216 +sw $t0, -16($fp) +sw $t1, -12($fp) +sw $t2, -4($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +beqz $t3, continue__1216 +la $a0, dispatch_error +j .raise +continue__1216: +lw $t0, -4($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_A2I +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -12($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -20($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_get_int_Main_internal_4 to local_get_int_Main_internal_7 +move $t1, $t0 +sw $t1, -32($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -32($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_is_even_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value num +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_is_even_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_is_even_Main_internal_10 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# Moving num to local_is_even_Main_x_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -12($fp) +# local_is_even_Main_internal_1 <- local_is_even_Main_x_0 < 0 +li $t9, 0 +slt $t2, $t1, $t9 +# If local_is_even_Main_internal_1 goto true__1236 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +bnez $t2, true__1236 +lw $t0, -8($fp) +lw $t1, -20($fp) +# local_is_even_Main_internal_3 <- 0 = local_is_even_Main_x_0 +li $t9, 0 +seq $t1, $t9, $t0 +# If local_is_even_Main_internal_3 goto true__1240 +sw $t0, -8($fp) +sw $t1, -20($fp) +bnez $t1, true__1240 +lw $t0, -8($fp) +lw $t1, -28($fp) +# local_is_even_Main_internal_5 <- 1 = local_is_even_Main_x_0 +li $t9, 1 +seq $t1, $t9, $t0 +# If local_is_even_Main_internal_5 goto true__1244 +sw $t0, -8($fp) +sw $t1, -28($fp) +bnez $t1, true__1244 +lw $t0, -8($fp) +lw $t1, -36($fp) +# local_is_even_Main_internal_7 <- local_is_even_Main_x_0 - 2 +addi $t1, $t0, -2 +lw $t2, -4($fp) +lw $t3, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_is_even_Main +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -36($fp) +sw $t2, -4($fp) +sw $t3, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_is_even_Main_internal_8 to local_is_even_Main_internal_6 +move $t1, $t0 +sw $t1, -32($fp) +sw $t0, -40($fp) +sw $t1, -32($fp) +j end__1244 +true__1244: +lw $t0, -32($fp) +# Moving 0 to local_is_even_Main_internal_6 +li $t0, 0 +sw $t0, -32($fp) +sw $t0, -32($fp) +end__1244: +lw $t0, -32($fp) +lw $t1, -24($fp) +# Moving local_is_even_Main_internal_6 to local_is_even_Main_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -32($fp) +sw $t1, -24($fp) +j end__1240 +true__1240: +lw $t0, -24($fp) +# Moving 1 to local_is_even_Main_internal_4 +li $t0, 1 +sw $t0, -24($fp) +sw $t0, -24($fp) +end__1240: +lw $t0, -24($fp) +lw $t1, -16($fp) +# Moving local_is_even_Main_internal_4 to local_is_even_Main_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -24($fp) +sw $t1, -16($fp) +j end__1236 +true__1236: +lw $t0, -8($fp) +lw $t1, -44($fp) +# local_is_even_Main_internal_9 <- ~local_is_even_Main_x_0 +not $t1, $t0 +addi $t1, $t1, 1 +lw $t2, -4($fp) +lw $t3, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_is_even_Main +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -44($fp) +sw $t2, -4($fp) +sw $t3, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Moving local_is_even_Main_internal_10 to local_is_even_Main_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -48($fp) +sw $t1, -16($fp) +end__1236: +lw $t0, -16($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 52 +jr $ra + + +function_class_type_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value var +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_class_type_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_e_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_c_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_d_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_b_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_a_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_o_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_class_type_Main_internal_26 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -12($fp) +# local_class_type_Main_internal_1 <- Type of var +lw $t1, 0($t0) +lw $t2, -16($fp) +# Saves in local_class_type_Main_internal_2 data_0 +la $t2, data_0 +# local_class_type_Main_internal_1 <- local_class_type_Main_internal_1 = local_class_type_Main_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_39: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_39 +beqz $a1, mismatch_39 +seq $v0, $a0, $a1 +beqz $v0, mismatch_39 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_39 +mismatch_39: +li $v0, 0 +j end_39 +check_39: +bnez $a1, mismatch_39 +li $v0, 1 +end_39: +move $t1, $v0 +# If local_class_type_Main_internal_1 goto error__1278 +sw $t0, -0($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +bnez $t1, error__1278 +lw $t0, -0($fp) +lw $t1, -20($fp) +la $t9, type_E +lw $v0, 8($t0) +loop_40: +move $t8, $v0 +beqz $t8, false_40 +lw $v1, 0($t8) +beq $t9, $v1, true_40 +lw $v0, 4($t8) +j loop_40 +true_40: +li $t1, 1 +j end_40 +false_40: +li $t1, 0 +end_40: +# If not local_class_type_Main_internal_3 goto next__1284_0 +sw $t0, -0($fp) +sw $t1, -20($fp) +beqz $t1, next__1284_0 +lw $t0, -0($fp) +lw $t1, -24($fp) +# Moving var to local_class_type_Main_e_4 +move $t1, $t0 +sw $t1, -24($fp) +lw $t2, -28($fp) +# Saves in local_class_type_Main_internal_5 data_48 +la $t2, data_48 +lw $t3, -4($fp) +lw $t4, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +sw $t3, -4($fp) +sw $t4, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_class_type_Main_internal_6 to local_class_type_Main_internal_0 +move $t1, $t0 +sw $t1, -8($fp) +sw $t0, -32($fp) +sw $t1, -8($fp) +j end__1278 +next__1284_0: +lw $t0, -0($fp) +lw $t1, -36($fp) +la $t9, type_C +lw $v0, 8($t0) +loop_41: +move $t8, $v0 +beqz $t8, false_41 +lw $v1, 0($t8) +beq $t9, $v1, true_41 +lw $v0, 4($t8) +j loop_41 +true_41: +li $t1, 1 +j end_41 +false_41: +li $t1, 0 +end_41: +# If not local_class_type_Main_internal_7 goto next__1299_1 +sw $t0, -0($fp) +sw $t1, -36($fp) +beqz $t1, next__1299_1 +lw $t0, -0($fp) +lw $t1, -40($fp) +# Moving var to local_class_type_Main_c_8 +move $t1, $t0 +sw $t1, -40($fp) +lw $t2, -44($fp) +# Saves in local_class_type_Main_internal_9 data_49 +la $t2, data_49 +lw $t3, -4($fp) +lw $t4, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +sw $t3, -4($fp) +sw $t4, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_class_type_Main_internal_10 to local_class_type_Main_internal_0 +move $t1, $t0 +sw $t1, -8($fp) +sw $t0, -48($fp) +sw $t1, -8($fp) +j end__1278 +next__1299_1: +lw $t0, -0($fp) +lw $t1, -52($fp) +la $t9, type_D +lw $v0, 8($t0) +loop_42: +move $t8, $v0 +beqz $t8, false_42 +lw $v1, 0($t8) +beq $t9, $v1, true_42 +lw $v0, 4($t8) +j loop_42 +true_42: +li $t1, 1 +j end_42 +false_42: +li $t1, 0 +end_42: +# If not local_class_type_Main_internal_11 goto next__1314_2 +sw $t0, -0($fp) +sw $t1, -52($fp) +beqz $t1, next__1314_2 +lw $t0, -0($fp) +lw $t1, -56($fp) +# Moving var to local_class_type_Main_d_12 +move $t1, $t0 +sw $t1, -56($fp) +lw $t2, -60($fp) +# Saves in local_class_type_Main_internal_13 data_50 +la $t2, data_50 +lw $t3, -4($fp) +lw $t4, -64($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -56($fp) +sw $t2, -60($fp) +sw $t3, -4($fp) +sw $t4, -64($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -64($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_class_type_Main_internal_14 to local_class_type_Main_internal_0 +move $t1, $t0 +sw $t1, -8($fp) +sw $t0, -64($fp) +sw $t1, -8($fp) +j end__1278 +next__1314_2: +lw $t0, -0($fp) +lw $t1, -68($fp) +la $t9, type_B +lw $v0, 8($t0) +loop_43: +move $t8, $v0 +beqz $t8, false_43 +lw $v1, 0($t8) +beq $t9, $v1, true_43 +lw $v0, 4($t8) +j loop_43 +true_43: +li $t1, 1 +j end_43 +false_43: +li $t1, 0 +end_43: +# If not local_class_type_Main_internal_15 goto next__1329_3 +sw $t0, -0($fp) +sw $t1, -68($fp) +beqz $t1, next__1329_3 +lw $t0, -0($fp) +lw $t1, -72($fp) +# Moving var to local_class_type_Main_b_16 +move $t1, $t0 +sw $t1, -72($fp) +lw $t2, -76($fp) +# Saves in local_class_type_Main_internal_17 data_51 +la $t2, data_51 +lw $t3, -4($fp) +lw $t4, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +sw $t3, -4($fp) +sw $t4, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_class_type_Main_internal_18 to local_class_type_Main_internal_0 +move $t1, $t0 +sw $t1, -8($fp) +sw $t0, -80($fp) +sw $t1, -8($fp) +j end__1278 +next__1329_3: +lw $t0, -0($fp) +lw $t1, -84($fp) +la $t9, type_A +lw $v0, 8($t0) +loop_44: +move $t8, $v0 +beqz $t8, false_44 +lw $v1, 0($t8) +beq $t9, $v1, true_44 +lw $v0, 4($t8) +j loop_44 +true_44: +li $t1, 1 +j end_44 +false_44: +li $t1, 0 +end_44: +# If not local_class_type_Main_internal_19 goto next__1344_4 +sw $t0, -0($fp) +sw $t1, -84($fp) +beqz $t1, next__1344_4 +lw $t0, -0($fp) +lw $t1, -88($fp) +# Moving var to local_class_type_Main_a_20 +move $t1, $t0 +sw $t1, -88($fp) +lw $t2, -92($fp) +# Saves in local_class_type_Main_internal_21 data_52 +la $t2, data_52 +lw $t3, -4($fp) +lw $t4, -96($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -88($fp) +sw $t2, -92($fp) +sw $t3, -4($fp) +sw $t4, -96($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_class_type_Main_internal_22 to local_class_type_Main_internal_0 +move $t1, $t0 +sw $t1, -8($fp) +sw $t0, -96($fp) +sw $t1, -8($fp) +j end__1278 +next__1344_4: +lw $t0, -0($fp) +lw $t1, -100($fp) +la $t9, type_Object +lw $v0, 8($t0) +loop_45: +move $t8, $v0 +beqz $t8, false_45 +lw $v1, 0($t8) +beq $t9, $v1, true_45 +lw $v0, 4($t8) +j loop_45 +true_45: +li $t1, 1 +j end_45 +false_45: +li $t1, 0 +end_45: +# If not local_class_type_Main_internal_23 goto next__1359_5 +sw $t0, -0($fp) +sw $t1, -100($fp) +beqz $t1, next__1359_5 +lw $t0, -0($fp) +lw $t1, -104($fp) +# Moving var to local_class_type_Main_o_24 +move $t1, $t0 +sw $t1, -104($fp) +lw $t2, -108($fp) +# Saves in local_class_type_Main_internal_25 data_53 +la $t2, data_53 +lw $t3, -4($fp) +lw $t4, -112($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -104($fp) +sw $t2, -108($fp) +sw $t3, -4($fp) +sw $t4, -112($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -112($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_class_type_Main_internal_26 to local_class_type_Main_internal_0 +move $t1, $t0 +sw $t1, -8($fp) +sw $t0, -112($fp) +sw $t1, -8($fp) +j end__1278 +next__1359_5: +la $a0, case_error +j .raise +error__1278: +la $a0, case_void_error +j .raise +end__1278: +lw $t0, -8($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 116 +jr $ra + + +function_print_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value var +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_Main_z_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Main_internal_11 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A2I +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 40($t8) +sw $v0, 8($t0) +lw $t1, -8($fp) +# Moving local_print_Main_internal_1 to local_print_Main_z_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +lw $t3, -20($fp) +# local_print_Main_internal_3 <- Type of var +lw $t3, 0($t2) +lw $t4, -24($fp) +# Saves in local_print_Main_internal_4 data_0 +la $t4, data_0 +# local_print_Main_internal_3 <- local_print_Main_internal_3 = local_print_Main_internal_4 +move $t8, $t3 +move $t9, $t4 +loop_46: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_46 +beqz $a1, mismatch_46 +seq $v0, $a0, $a1 +beqz $v0, mismatch_46 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_46 +mismatch_46: +li $v0, 0 +j end_46 +check_46: +bnez $a1, mismatch_46 +li $v0, 1 +end_46: +move $t3, $v0 +# If not local_print_Main_internal_3 goto continue__1390 +sw $t0, -12($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +sw $t3, -20($fp) +sw $t4, -24($fp) +beqz $t3, continue__1390 +la $a0, dispatch_error +j .raise +continue__1390: +lw $t0, -0($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +lw $t2, -32($fp) +# local_print_Main_internal_6 <- Type of local_print_Main_z_0 +lw $t2, 0($t1) +lw $t3, -36($fp) +# Saves in local_print_Main_internal_7 data_0 +la $t3, data_0 +# local_print_Main_internal_6 <- local_print_Main_internal_6 = local_print_Main_internal_7 +move $t8, $t2 +move $t9, $t3 +loop_47: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_47 +beqz $a1, mismatch_47 +seq $v0, $a0, $a1 +beqz $v0, mismatch_47 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_47 +mismatch_47: +li $v0, 0 +j end_47 +check_47: +bnez $a1, mismatch_47 +li $v0, 1 +end_47: +move $t2, $v0 +# If not local_print_Main_internal_6 goto continue__1402 +sw $t0, -16($fp) +sw $t1, -8($fp) +sw $t2, -32($fp) +sw $t3, -36($fp) +beqz $t2, continue__1402 +la $a0, dispatch_error +j .raise +continue__1402: +lw $t0, -8($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_A2I +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -16($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -28($fp) +sw $t2, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -4($fp) +sw $t2, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_print_Main_internal_9 data_54 +la $t1, data_54 +lw $t2, -4($fp) +lw $t3, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -44($fp) +sw $t2, -4($fp) +sw $t3, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Moving local_print_Main_internal_10 to local_print_Main_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +# Removing all locals from stack +addiu $sp, $sp, 56 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_flag_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_39 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_40 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_41 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_42 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_43 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_44 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_45 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_46 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_47 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_48 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_49 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_50 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_51 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_52 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_53 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_54 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_55 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_56 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_char_57 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_58 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_59 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_60 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_61 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_62 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_63 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_64 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_65 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_66 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_67 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_68 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_x_69 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_x_70 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_71 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_72 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_73 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_74 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_75 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_76 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_77 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_78 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_r_79 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_80 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_81 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_82 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_83 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_84 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_85 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_86 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_87 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_88 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_89 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_90 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_91 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_92 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_93 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_94 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_95 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_96 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_97 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_a_98 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_99 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_100 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_101 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_102 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_103 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_104 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_105 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_106 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_107 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_108 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_109 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_110 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_111 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_112 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_113 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_114 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_115 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_116 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_117 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_118 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_119 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_120 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_121 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_122 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_123 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_124 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_125 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_126 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_127 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_128 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_129 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_130 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_131 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_132 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_133 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_134 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_135 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_136 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_137 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_138 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_139 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_140 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_141 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_142 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_143 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_144 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_145 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_146 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_147 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_148 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_149 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_150 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_151 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_152 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_153 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_154 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_155 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_156 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_157 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_158 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_159 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_160 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_161 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_162 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_163 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_164 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_165 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_a_var_166 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_167 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_168 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_169 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_170 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_171 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_172 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_173 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_174 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_175 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_176 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_177 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_178 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_c_179 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_180 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_181 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_182 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_183 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_184 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_185 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_186 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_a_187 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_188 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_189 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_190 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_191 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_192 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_193 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_194 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_o_195 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_196 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_197 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_198 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_199 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_200 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_201 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_202 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_203 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_204 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_205 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_avar_206 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_207 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_208 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_209 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_a_var_210 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_211 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_212 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_213 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_214 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_215 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_216 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_217 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_218 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_219 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_0 +sw $t0, 16($t1) +lw $t2, -8($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t2, $v0 +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +start__1431: +lw $t0, -0($fp) +lw $t1, -12($fp) +# local_main_Main_flag_2 <- GET self . flag +lw $t1, 24($t0) +# If not local_main_Main_flag_2 goto end__1431 +sw $t0, -0($fp) +sw $t1, -12($fp) +beqz $t1, end__1431 +lw $t0, -16($fp) +# Saves in local_main_Main_internal_3 data_55 +la $t0, data_55 +lw $t1, -0($fp) +lw $t2, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -24($fp) +# local_main_Main_avar_5 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -0($fp) +sw $t2, -24($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -32($fp) +# local_main_Main_avar_7 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -40($fp) +# local_main_Main_internal_9 <- Type of local_main_Main_avar_7 +lw $t3, 0($t2) +lw $t4, -44($fp) +# Saves in local_main_Main_internal_10 data_0 +la $t4, data_0 +# local_main_Main_internal_9 <- local_main_Main_internal_9 = local_main_Main_internal_10 +move $t8, $t3 +move $t9, $t4 +loop_48: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_48 +beqz $a1, mismatch_48 +seq $v0, $a0, $a1 +beqz $v0, mismatch_48 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_48 +mismatch_48: +li $v0, 0 +j end_48 +check_48: +bnez $a1, mismatch_48 +li $v0, 1 +end_48: +move $t3, $v0 +# If not local_main_Main_internal_9 goto continue__1455 +sw $t0, -28($fp) +sw $t1, -0($fp) +sw $t2, -32($fp) +sw $t3, -40($fp) +sw $t4, -44($fp) +beqz $t3, continue__1455 +la $a0, dispatch_error +j .raise +continue__1455: +lw $t0, -32($fp) +lw $t1, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_is_even_Main +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -0($fp) +sw $t2, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +# If local_main_Main_internal_11 goto true__1468 +sw $t0, -48($fp) +bnez $t0, true__1468 +lw $t0, -56($fp) +# Saves in local_main_Main_internal_13 data_56 +la $t0, data_56 +lw $t1, -0($fp) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Moving local_main_Main_internal_14 to local_main_Main_internal_12 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -60($fp) +sw $t1, -52($fp) +j end__1468 +true__1468: +lw $t0, -64($fp) +# Saves in local_main_Main_internal_15 data_57 +la $t0, data_57 +lw $t1, -0($fp) +lw $t2, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -64($fp) +sw $t1, -0($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Moving local_main_Main_internal_16 to local_main_Main_internal_12 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -68($fp) +sw $t1, -52($fp) +end__1468: +lw $t0, -0($fp) +lw $t1, -72($fp) +# local_main_Main_avar_17 <- GET self . avar +lw $t1, 16($t0) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_class_type_Main +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_menu_Main +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -0($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . char <- SET local_main_Main_internal_19 +sw $t0, 12($t1) +lw $t2, -88($fp) +# local_main_Main_char_21 <- GET self . char +lw $t2, 12($t1) +lw $t3, -92($fp) +# Saves in local_main_Main_internal_22 data_58 +la $t3, data_58 +lw $t4, -84($fp) +# local_main_Main_internal_20 <- local_main_Main_char_21 = local_main_Main_internal_22 +move $t8, $t2 +move $t9, $t3 +loop_49: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_49 +beqz $a1, mismatch_49 +seq $v0, $a0, $a1 +beqz $v0, mismatch_49 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_49 +mismatch_49: +li $v0, 0 +j end_49 +check_49: +bnez $a1, mismatch_49 +li $v0, 1 +end_49: +move $t4, $v0 +# If local_main_Main_internal_20 goto true__1506 +sw $t0, -80($fp) +sw $t1, -0($fp) +sw $t2, -88($fp) +sw $t3, -92($fp) +sw $t4, -84($fp) +bnez $t4, true__1506 +lw $t0, -0($fp) +lw $t1, -104($fp) +# local_main_Main_char_25 <- GET self . char +lw $t1, 12($t0) +lw $t2, -108($fp) +# Saves in local_main_Main_internal_26 data_59 +la $t2, data_59 +lw $t3, -100($fp) +# local_main_Main_internal_24 <- local_main_Main_char_25 = local_main_Main_internal_26 +move $t8, $t1 +move $t9, $t2 +loop_50: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_50 +beqz $a1, mismatch_50 +seq $v0, $a0, $a1 +beqz $v0, mismatch_50 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_50 +mismatch_50: +li $v0, 0 +j end_50 +check_50: +bnez $a1, mismatch_50 +li $v0, 1 +end_50: +move $t3, $v0 +# If local_main_Main_internal_24 goto true__1515 +sw $t0, -0($fp) +sw $t1, -104($fp) +sw $t2, -108($fp) +sw $t3, -100($fp) +bnez $t3, true__1515 +lw $t0, -0($fp) +lw $t1, -120($fp) +# local_main_Main_char_29 <- GET self . char +lw $t1, 12($t0) +lw $t2, -124($fp) +# Saves in local_main_Main_internal_30 data_60 +la $t2, data_60 +lw $t3, -116($fp) +# local_main_Main_internal_28 <- local_main_Main_char_29 = local_main_Main_internal_30 +move $t8, $t1 +move $t9, $t2 +loop_51: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_51 +beqz $a1, mismatch_51 +seq $v0, $a0, $a1 +beqz $v0, mismatch_51 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_51 +mismatch_51: +li $v0, 0 +j end_51 +check_51: +bnez $a1, mismatch_51 +li $v0, 1 +end_51: +move $t3, $v0 +# If local_main_Main_internal_28 goto true__1524 +sw $t0, -0($fp) +sw $t1, -120($fp) +sw $t2, -124($fp) +sw $t3, -116($fp) +bnez $t3, true__1524 +lw $t0, -0($fp) +lw $t1, -136($fp) +# local_main_Main_char_33 <- GET self . char +lw $t1, 12($t0) +lw $t2, -140($fp) +# Saves in local_main_Main_internal_34 data_61 +la $t2, data_61 +lw $t3, -132($fp) +# local_main_Main_internal_32 <- local_main_Main_char_33 = local_main_Main_internal_34 +move $t8, $t1 +move $t9, $t2 +loop_52: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_52 +beqz $a1, mismatch_52 +seq $v0, $a0, $a1 +beqz $v0, mismatch_52 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_52 +mismatch_52: +li $v0, 0 +j end_52 +check_52: +bnez $a1, mismatch_52 +li $v0, 1 +end_52: +move $t3, $v0 +# If local_main_Main_internal_32 goto true__1533 +sw $t0, -0($fp) +sw $t1, -136($fp) +sw $t2, -140($fp) +sw $t3, -132($fp) +bnez $t3, true__1533 +lw $t0, -0($fp) +lw $t1, -152($fp) +# local_main_Main_char_37 <- GET self . char +lw $t1, 12($t0) +lw $t2, -156($fp) +# Saves in local_main_Main_internal_38 data_62 +la $t2, data_62 +lw $t3, -148($fp) +# local_main_Main_internal_36 <- local_main_Main_char_37 = local_main_Main_internal_38 +move $t8, $t1 +move $t9, $t2 +loop_53: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_53 +beqz $a1, mismatch_53 +seq $v0, $a0, $a1 +beqz $v0, mismatch_53 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_53 +mismatch_53: +li $v0, 0 +j end_53 +check_53: +bnez $a1, mismatch_53 +li $v0, 1 +end_53: +move $t3, $v0 +# If local_main_Main_internal_36 goto true__1542 +sw $t0, -0($fp) +sw $t1, -152($fp) +sw $t2, -156($fp) +sw $t3, -148($fp) +bnez $t3, true__1542 +lw $t0, -0($fp) +lw $t1, -168($fp) +# local_main_Main_char_41 <- GET self . char +lw $t1, 12($t0) +lw $t2, -172($fp) +# Saves in local_main_Main_internal_42 data_63 +la $t2, data_63 +lw $t3, -164($fp) +# local_main_Main_internal_40 <- local_main_Main_char_41 = local_main_Main_internal_42 +move $t8, $t1 +move $t9, $t2 +loop_54: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_54 +beqz $a1, mismatch_54 +seq $v0, $a0, $a1 +beqz $v0, mismatch_54 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_54 +mismatch_54: +li $v0, 0 +j end_54 +check_54: +bnez $a1, mismatch_54 +li $v0, 1 +end_54: +move $t3, $v0 +# If local_main_Main_internal_40 goto true__1551 +sw $t0, -0($fp) +sw $t1, -168($fp) +sw $t2, -172($fp) +sw $t3, -164($fp) +bnez $t3, true__1551 +lw $t0, -0($fp) +lw $t1, -184($fp) +# local_main_Main_char_45 <- GET self . char +lw $t1, 12($t0) +lw $t2, -188($fp) +# Saves in local_main_Main_internal_46 data_64 +la $t2, data_64 +lw $t3, -180($fp) +# local_main_Main_internal_44 <- local_main_Main_char_45 = local_main_Main_internal_46 +move $t8, $t1 +move $t9, $t2 +loop_55: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_55 +beqz $a1, mismatch_55 +seq $v0, $a0, $a1 +beqz $v0, mismatch_55 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_55 +mismatch_55: +li $v0, 0 +j end_55 +check_55: +bnez $a1, mismatch_55 +li $v0, 1 +end_55: +move $t3, $v0 +# If local_main_Main_internal_44 goto true__1560 +sw $t0, -0($fp) +sw $t1, -184($fp) +sw $t2, -188($fp) +sw $t3, -180($fp) +bnez $t3, true__1560 +lw $t0, -0($fp) +lw $t1, -200($fp) +# local_main_Main_char_49 <- GET self . char +lw $t1, 12($t0) +lw $t2, -204($fp) +# Saves in local_main_Main_internal_50 data_65 +la $t2, data_65 +lw $t3, -196($fp) +# local_main_Main_internal_48 <- local_main_Main_char_49 = local_main_Main_internal_50 +move $t8, $t1 +move $t9, $t2 +loop_56: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_56 +beqz $a1, mismatch_56 +seq $v0, $a0, $a1 +beqz $v0, mismatch_56 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_56 +mismatch_56: +li $v0, 0 +j end_56 +check_56: +bnez $a1, mismatch_56 +li $v0, 1 +end_56: +move $t3, $v0 +# If local_main_Main_internal_48 goto true__1569 +sw $t0, -0($fp) +sw $t1, -200($fp) +sw $t2, -204($fp) +sw $t3, -196($fp) +bnez $t3, true__1569 +lw $t0, -0($fp) +lw $t1, -216($fp) +# local_main_Main_char_53 <- GET self . char +lw $t1, 12($t0) +lw $t2, -220($fp) +# Saves in local_main_Main_internal_54 data_66 +la $t2, data_66 +lw $t3, -212($fp) +# local_main_Main_internal_52 <- local_main_Main_char_53 = local_main_Main_internal_54 +move $t8, $t1 +move $t9, $t2 +loop_57: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_57 +beqz $a1, mismatch_57 +seq $v0, $a0, $a1 +beqz $v0, mismatch_57 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_57 +mismatch_57: +li $v0, 0 +j end_57 +check_57: +bnez $a1, mismatch_57 +li $v0, 1 +end_57: +move $t3, $v0 +# If local_main_Main_internal_52 goto true__1578 +sw $t0, -0($fp) +sw $t1, -216($fp) +sw $t2, -220($fp) +sw $t3, -212($fp) +bnez $t3, true__1578 +lw $t0, -0($fp) +lw $t1, -232($fp) +# local_main_Main_char_57 <- GET self . char +lw $t1, 12($t0) +lw $t2, -236($fp) +# Saves in local_main_Main_internal_58 data_67 +la $t2, data_67 +lw $t3, -228($fp) +# local_main_Main_internal_56 <- local_main_Main_char_57 = local_main_Main_internal_58 +move $t8, $t1 +move $t9, $t2 +loop_58: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_58 +beqz $a1, mismatch_58 +seq $v0, $a0, $a1 +beqz $v0, mismatch_58 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_58 +mismatch_58: +li $v0, 0 +j end_58 +check_58: +bnez $a1, mismatch_58 +li $v0, 1 +end_58: +move $t3, $v0 +# If local_main_Main_internal_56 goto true__1587 +sw $t0, -0($fp) +sw $t1, -232($fp) +sw $t2, -236($fp) +sw $t3, -228($fp) +bnez $t3, true__1587 +lw $t0, -244($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -244($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -244($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -248($fp) +# local_main_Main_avar_61 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -256($fp) +# local_main_Main_internal_63 <- Type of local_main_Main_avar_61 +lw $t3, 0($t2) +lw $t4, -260($fp) +# Saves in local_main_Main_internal_64 data_0 +la $t4, data_0 +# local_main_Main_internal_63 <- local_main_Main_internal_63 = local_main_Main_internal_64 +move $t8, $t3 +move $t9, $t4 +loop_59: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_59 +beqz $a1, mismatch_59 +seq $v0, $a0, $a1 +beqz $v0, mismatch_59 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_59 +mismatch_59: +li $v0, 0 +j end_59 +check_59: +bnez $a1, mismatch_59 +li $v0, 1 +end_59: +move $t3, $v0 +# If not local_main_Main_internal_63 goto continue__1597 +sw $t0, -244($fp) +sw $t1, -0($fp) +sw $t2, -248($fp) +sw $t3, -256($fp) +sw $t4, -260($fp) +beqz $t3, continue__1597 +la $a0, dispatch_error +j .raise +continue__1597: +lw $t0, -248($fp) +lw $t1, -252($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -248($fp) +sw $t1, -252($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -252($fp) +# saves the return value +move $t0, $v0 +lw $t1, -244($fp) +lw $t2, -268($fp) +# local_main_Main_internal_66 <- Type of local_main_Main_internal_60 +lw $t2, 0($t1) +lw $t3, -272($fp) +# Saves in local_main_Main_internal_67 data_0 +la $t3, data_0 +# local_main_Main_internal_66 <- local_main_Main_internal_66 = local_main_Main_internal_67 +move $t8, $t2 +move $t9, $t3 +loop_60: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_60 +beqz $a1, mismatch_60 +seq $v0, $a0, $a1 +beqz $v0, mismatch_60 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_60 +mismatch_60: +li $v0, 0 +j end_60 +check_60: +bnez $a1, mismatch_60 +li $v0, 1 +end_60: +move $t2, $v0 +# If not local_main_Main_internal_66 goto continue__1609 +sw $t0, -252($fp) +sw $t1, -244($fp) +sw $t2, -268($fp) +sw $t3, -272($fp) +beqz $t2, continue__1609 +la $a0, dispatch_error +j .raise +continue__1609: +lw $t0, -244($fp) +lw $t1, -264($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method1_A +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -252($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -244($fp) +sw $t1, -264($fp) +sw $t2, -252($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -264($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_65 +sw $t0, 16($t1) +lw $t2, -240($fp) +# Moving local_main_Main_internal_65 to local_main_Main_internal_59 +move $t2, $t0 +sw $t2, -240($fp) +sw $t0, -264($fp) +sw $t1, -0($fp) +sw $t2, -240($fp) +j end__1587 +true__1587: +lw $t0, -0($fp) +# self . flag <- SET 0 +li $t9, 0 +sw $t9, 24($t0) +lw $t1, -240($fp) +# Moving 0 to local_main_Main_internal_59 +li $t1, 0 +sw $t1, -240($fp) +sw $t0, -0($fp) +sw $t1, -240($fp) +end__1587: +lw $t0, -240($fp) +lw $t1, -224($fp) +# Moving local_main_Main_internal_59 to local_main_Main_internal_55 +move $t1, $t0 +sw $t1, -224($fp) +sw $t0, -240($fp) +sw $t1, -224($fp) +j end__1578 +true__1578: +lw $t0, -276($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -276($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -276($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_68 +sw $t0, 16($t1) +lw $t2, -224($fp) +# Moving local_main_Main_internal_68 to local_main_Main_internal_55 +move $t2, $t0 +sw $t2, -224($fp) +sw $t0, -276($fp) +sw $t1, -0($fp) +sw $t2, -224($fp) +end__1578: +lw $t0, -224($fp) +lw $t1, -208($fp) +# Moving local_main_Main_internal_55 to local_main_Main_internal_51 +move $t1, $t0 +sw $t1, -208($fp) +sw $t0, -224($fp) +sw $t1, -208($fp) +j end__1569 +true__1569: +lw $t0, -284($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t0, $v0 +lw $t1, -280($fp) +# Moving local_main_Main_x_70 to local_main_Main_x_69 +move $t1, $t0 +sw $t1, -280($fp) +lw $t2, -288($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_E +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t2) +# Static Dispatch of the method E +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -284($fp) +sw $t1, -280($fp) +sw $t2, -288($fp) +# This function will consume the arguments +jal function_E_E +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -288($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -292($fp) +# local_main_Main_avar_72 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -300($fp) +# local_main_Main_internal_74 <- Type of local_main_Main_avar_72 +lw $t3, 0($t2) +lw $t4, -304($fp) +# Saves in local_main_Main_internal_75 data_0 +la $t4, data_0 +# local_main_Main_internal_74 <- local_main_Main_internal_74 = local_main_Main_internal_75 +move $t8, $t3 +move $t9, $t4 +loop_61: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_61 +beqz $a1, mismatch_61 +seq $v0, $a0, $a1 +beqz $v0, mismatch_61 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_61 +mismatch_61: +li $v0, 0 +j end_61 +check_61: +bnez $a1, mismatch_61 +li $v0, 1 +end_61: +move $t3, $v0 +# If not local_main_Main_internal_74 goto continue__1650 +sw $t0, -288($fp) +sw $t1, -0($fp) +sw $t2, -292($fp) +sw $t3, -300($fp) +sw $t4, -304($fp) +beqz $t3, continue__1650 +la $a0, dispatch_error +j .raise +continue__1650: +lw $t0, -292($fp) +lw $t1, -296($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -292($fp) +sw $t1, -296($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -296($fp) +# saves the return value +move $t0, $v0 +lw $t1, -288($fp) +lw $t2, -312($fp) +# local_main_Main_internal_77 <- Type of local_main_Main_internal_71 +lw $t2, 0($t1) +lw $t3, -316($fp) +# Saves in local_main_Main_internal_78 data_0 +la $t3, data_0 +# local_main_Main_internal_77 <- local_main_Main_internal_77 = local_main_Main_internal_78 +move $t8, $t2 +move $t9, $t3 +loop_62: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_62 +beqz $a1, mismatch_62 +seq $v0, $a0, $a1 +beqz $v0, mismatch_62 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_62 +mismatch_62: +li $v0, 0 +j end_62 +check_62: +bnez $a1, mismatch_62 +li $v0, 1 +end_62: +move $t2, $v0 +# If not local_main_Main_internal_77 goto continue__1662 +sw $t0, -296($fp) +sw $t1, -288($fp) +sw $t2, -312($fp) +sw $t3, -316($fp) +beqz $t2, continue__1662 +la $a0, dispatch_error +j .raise +continue__1662: +lw $t0, -288($fp) +lw $t1, -308($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method6_E +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -296($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -288($fp) +sw $t1, -308($fp) +sw $t2, -296($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -308($fp) +# saves the return value +move $t0, $v0 +lw $t1, -284($fp) +# Moving local_main_Main_internal_76 to local_main_Main_x_70 +move $t1, $t0 +sw $t1, -284($fp) +lw $t2, -0($fp) +lw $t3, -328($fp) +# local_main_Main_avar_81 <- GET self . avar +lw $t3, 16($t2) +lw $t4, -336($fp) +# local_main_Main_internal_83 <- Type of local_main_Main_avar_81 +lw $t4, 0($t3) +lw $t5, -340($fp) +# Saves in local_main_Main_internal_84 data_0 +la $t5, data_0 +# local_main_Main_internal_83 <- local_main_Main_internal_83 = local_main_Main_internal_84 +move $t8, $t4 +move $t9, $t5 +loop_63: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_63 +beqz $a1, mismatch_63 +seq $v0, $a0, $a1 +beqz $v0, mismatch_63 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_63 +mismatch_63: +li $v0, 0 +j end_63 +check_63: +bnez $a1, mismatch_63 +li $v0, 1 +end_63: +move $t4, $v0 +# If not local_main_Main_internal_83 goto continue__1679 +sw $t0, -308($fp) +sw $t1, -284($fp) +sw $t2, -0($fp) +sw $t3, -328($fp) +sw $t4, -336($fp) +sw $t5, -340($fp) +beqz $t4, continue__1679 +la $a0, dispatch_error +j .raise +continue__1679: +lw $t0, -328($fp) +lw $t1, -332($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -328($fp) +sw $t1, -332($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -332($fp) +# saves the return value +move $t0, $v0 +lw $t1, -284($fp) +lw $t2, -352($fp) +# local_main_Main_internal_87 <- Type of local_main_Main_x_70 +lw $t2, 0($t1) +lw $t3, -356($fp) +# Saves in local_main_Main_internal_88 data_0 +la $t3, data_0 +# local_main_Main_internal_87 <- local_main_Main_internal_87 = local_main_Main_internal_88 +move $t8, $t2 +move $t9, $t3 +loop_64: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_64 +beqz $a1, mismatch_64 +seq $v0, $a0, $a1 +beqz $v0, mismatch_64 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_64 +mismatch_64: +li $v0, 0 +j end_64 +check_64: +bnez $a1, mismatch_64 +li $v0, 1 +end_64: +move $t2, $v0 +# If not local_main_Main_internal_87 goto continue__1692 +sw $t0, -332($fp) +sw $t1, -284($fp) +sw $t2, -352($fp) +sw $t3, -356($fp) +beqz $t2, continue__1692 +la $a0, dispatch_error +j .raise +continue__1692: +lw $t0, -284($fp) +lw $t1, -348($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -284($fp) +sw $t1, -348($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -348($fp) +# saves the return value +move $t0, $v0 +lw $t1, -344($fp) +# local_main_Main_internal_85 <- local_main_Main_internal_86 * 8 +li $t9, 8 +mult $t0, $t9 +mflo $t1 +lw $t2, -332($fp) +lw $t3, -324($fp) +# local_main_Main_internal_80 <- local_main_Main_internal_82 - local_main_Main_internal_85 +sub $t3, $t2, $t1 +lw $t4, -320($fp) +# Moving local_main_Main_internal_80 to local_main_Main_r_79 +move $t4, $t3 +sw $t4, -320($fp) +lw $t5, -360($fp) +# Saves in local_main_Main_internal_89 data_68 +la $t5, data_68 +lw $t6, -0($fp) +lw $t7, -364($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t6) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t6, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -348($fp) +sw $t1, -344($fp) +sw $t2, -332($fp) +sw $t3, -324($fp) +sw $t4, -320($fp) +sw $t5, -360($fp) +sw $t6, -0($fp) +sw $t7, -364($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -364($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -368($fp) +# local_main_Main_avar_91 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -372($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -364($fp) +sw $t1, -0($fp) +sw $t2, -368($fp) +sw $t3, -372($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -372($fp) +# saves the return value +move $t0, $v0 +lw $t1, -376($fp) +# Saves in local_main_Main_internal_93 data_69 +la $t1, data_69 +lw $t2, -0($fp) +lw $t3, -380($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -372($fp) +sw $t1, -376($fp) +sw $t2, -0($fp) +sw $t3, -380($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -380($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -384($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t3, -284($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -380($fp) +sw $t1, -0($fp) +sw $t2, -384($fp) +sw $t3, -284($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -384($fp) +# saves the return value +move $t0, $v0 +lw $t1, -388($fp) +# Saves in local_main_Main_internal_96 data_70 +la $t1, data_70 +lw $t2, -0($fp) +lw $t3, -392($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -384($fp) +sw $t1, -388($fp) +sw $t2, -0($fp) +sw $t3, -392($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -392($fp) +# saves the return value +move $t0, $v0 +lw $t1, -400($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A2I +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 40($t8) +sw $v0, 8($t1) +lw $t2, -396($fp) +# Moving local_main_Main_internal_99 to local_main_Main_a_98 +move $t2, $t1 +sw $t2, -396($fp) +lw $t3, -408($fp) +# local_main_Main_internal_101 <- Type of local_main_Main_a_98 +lw $t3, 0($t2) +lw $t4, -412($fp) +# Saves in local_main_Main_internal_102 data_0 +la $t4, data_0 +# local_main_Main_internal_101 <- local_main_Main_internal_101 = local_main_Main_internal_102 +move $t8, $t3 +move $t9, $t4 +loop_65: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_65 +beqz $a1, mismatch_65 +seq $v0, $a0, $a1 +beqz $v0, mismatch_65 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_65 +mismatch_65: +li $v0, 0 +j end_65 +check_65: +bnez $a1, mismatch_65 +li $v0, 1 +end_65: +move $t3, $v0 +# If not local_main_Main_internal_101 goto continue__1744 +sw $t0, -392($fp) +sw $t1, -400($fp) +sw $t2, -396($fp) +sw $t3, -408($fp) +sw $t4, -412($fp) +beqz $t3, continue__1744 +la $a0, dispatch_error +j .raise +continue__1744: +lw $t0, -396($fp) +lw $t1, -404($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_A2I +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -320($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -396($fp) +sw $t1, -404($fp) +sw $t2, -320($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -404($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -416($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -404($fp) +sw $t1, -0($fp) +sw $t2, -416($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -416($fp) +# saves the return value +move $t0, $v0 +lw $t1, -420($fp) +# Saves in local_main_Main_internal_104 data_71 +la $t1, data_71 +lw $t2, -0($fp) +lw $t3, -424($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -416($fp) +sw $t1, -420($fp) +sw $t2, -0($fp) +sw $t3, -424($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -424($fp) +# saves the return value +move $t0, $v0 +lw $t1, -428($fp) +# Moving local_main_Main_internal_105 to local_main_Main_internal_106 +move $t1, $t0 +sw $t1, -428($fp) +lw $t2, -432($fp) +# Moving local_main_Main_internal_106 to local_main_Main_internal_107 +move $t2, $t1 +sw $t2, -432($fp) +lw $t3, -284($fp) +lw $t4, -0($fp) +# self . avar <- SET local_main_Main_x_70 +sw $t3, 16($t4) +lw $t5, -436($fp) +# Moving local_main_Main_x_70 to local_main_Main_internal_108 +move $t5, $t3 +sw $t5, -436($fp) +lw $t6, -208($fp) +# Moving local_main_Main_internal_108 to local_main_Main_internal_51 +move $t6, $t5 +sw $t6, -208($fp) +sw $t0, -424($fp) +sw $t1, -428($fp) +sw $t2, -432($fp) +sw $t3, -284($fp) +sw $t4, -0($fp) +sw $t5, -436($fp) +sw $t6, -208($fp) +end__1569: +lw $t0, -208($fp) +lw $t1, -192($fp) +# Moving local_main_Main_internal_51 to local_main_Main_internal_47 +move $t1, $t0 +sw $t1, -192($fp) +sw $t0, -208($fp) +sw $t1, -192($fp) +j end__1560 +true__1560: +lw $t0, -440($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_D +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method D +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -440($fp) +# This function will consume the arguments +jal function_D_D +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -440($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -444($fp) +# local_main_Main_avar_110 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -452($fp) +# local_main_Main_internal_112 <- Type of local_main_Main_avar_110 +lw $t3, 0($t2) +lw $t4, -456($fp) +# Saves in local_main_Main_internal_113 data_0 +la $t4, data_0 +# local_main_Main_internal_112 <- local_main_Main_internal_112 = local_main_Main_internal_113 +move $t8, $t3 +move $t9, $t4 +loop_66: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_66 +beqz $a1, mismatch_66 +seq $v0, $a0, $a1 +beqz $v0, mismatch_66 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_66 +mismatch_66: +li $v0, 0 +j end_66 +check_66: +bnez $a1, mismatch_66 +li $v0, 1 +end_66: +move $t3, $v0 +# If not local_main_Main_internal_112 goto continue__1784 +sw $t0, -440($fp) +sw $t1, -0($fp) +sw $t2, -444($fp) +sw $t3, -452($fp) +sw $t4, -456($fp) +beqz $t3, continue__1784 +la $a0, dispatch_error +j .raise +continue__1784: +lw $t0, -444($fp) +lw $t1, -448($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -444($fp) +sw $t1, -448($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -448($fp) +# saves the return value +move $t0, $v0 +lw $t1, -440($fp) +lw $t2, -464($fp) +# local_main_Main_internal_115 <- Type of local_main_Main_internal_109 +lw $t2, 0($t1) +lw $t3, -468($fp) +# Saves in local_main_Main_internal_116 data_0 +la $t3, data_0 +# local_main_Main_internal_115 <- local_main_Main_internal_115 = local_main_Main_internal_116 +move $t8, $t2 +move $t9, $t3 +loop_67: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_67 +beqz $a1, mismatch_67 +seq $v0, $a0, $a1 +beqz $v0, mismatch_67 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_67 +mismatch_67: +li $v0, 0 +j end_67 +check_67: +bnez $a1, mismatch_67 +li $v0, 1 +end_67: +move $t2, $v0 +# If not local_main_Main_internal_115 goto continue__1796 +sw $t0, -448($fp) +sw $t1, -440($fp) +sw $t2, -464($fp) +sw $t3, -468($fp) +beqz $t2, continue__1796 +la $a0, dispatch_error +j .raise +continue__1796: +lw $t0, -440($fp) +lw $t1, -460($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method7_D +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -448($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -440($fp) +sw $t1, -460($fp) +sw $t2, -448($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -460($fp) +# saves the return value +move $t0, $v0 +# If local_main_Main_internal_114 goto true__1806 +sw $t0, -460($fp) +bnez $t0, true__1806 +lw $t0, -476($fp) +# Saves in local_main_Main_internal_118 data_72 +la $t0, data_72 +lw $t1, -0($fp) +lw $t2, -480($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -476($fp) +sw $t1, -0($fp) +sw $t2, -480($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -480($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -484($fp) +# local_main_Main_avar_120 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -488($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -480($fp) +sw $t1, -0($fp) +sw $t2, -484($fp) +sw $t3, -488($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -488($fp) +# saves the return value +move $t0, $v0 +lw $t1, -492($fp) +# Saves in local_main_Main_internal_122 data_73 +la $t1, data_73 +lw $t2, -0($fp) +lw $t3, -496($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -488($fp) +sw $t1, -492($fp) +sw $t2, -0($fp) +sw $t3, -496($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -496($fp) +# saves the return value +move $t0, $v0 +lw $t1, -500($fp) +# Moving local_main_Main_internal_123 to local_main_Main_internal_124 +move $t1, $t0 +sw $t1, -500($fp) +lw $t2, -472($fp) +# Moving local_main_Main_internal_124 to local_main_Main_internal_117 +move $t2, $t1 +sw $t2, -472($fp) +sw $t0, -496($fp) +sw $t1, -500($fp) +sw $t2, -472($fp) +j end__1806 +true__1806: +lw $t0, -504($fp) +# Saves in local_main_Main_internal_125 data_74 +la $t0, data_74 +lw $t1, -0($fp) +lw $t2, -508($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -504($fp) +sw $t1, -0($fp) +sw $t2, -508($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -508($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -512($fp) +# local_main_Main_avar_127 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -516($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Main +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -508($fp) +sw $t1, -0($fp) +sw $t2, -512($fp) +sw $t3, -516($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -516($fp) +# saves the return value +move $t0, $v0 +lw $t1, -520($fp) +# Saves in local_main_Main_internal_129 data_75 +la $t1, data_75 +lw $t2, -0($fp) +lw $t3, -524($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -516($fp) +sw $t1, -520($fp) +sw $t2, -0($fp) +sw $t3, -524($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -524($fp) +# saves the return value +move $t0, $v0 +lw $t1, -528($fp) +# Moving local_main_Main_internal_130 to local_main_Main_internal_131 +move $t1, $t0 +sw $t1, -528($fp) +lw $t2, -472($fp) +# Moving local_main_Main_internal_131 to local_main_Main_internal_117 +move $t2, $t1 +sw $t2, -472($fp) +sw $t0, -524($fp) +sw $t1, -528($fp) +sw $t2, -472($fp) +end__1806: +lw $t0, -472($fp) +lw $t1, -192($fp) +# Moving local_main_Main_internal_117 to local_main_Main_internal_47 +move $t1, $t0 +sw $t1, -192($fp) +sw $t0, -472($fp) +sw $t1, -192($fp) +end__1560: +lw $t0, -192($fp) +lw $t1, -176($fp) +# Moving local_main_Main_internal_47 to local_main_Main_internal_43 +move $t1, $t0 +sw $t1, -176($fp) +sw $t0, -192($fp) +sw $t1, -176($fp) +j end__1551 +true__1551: +lw $t0, -532($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +# Static Dispatch of the method C +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -532($fp) +# This function will consume the arguments +jal function_C_C +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -532($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -536($fp) +# local_main_Main_avar_133 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -544($fp) +# local_main_Main_internal_135 <- Type of local_main_Main_avar_133 +lw $t3, 0($t2) +lw $t4, -548($fp) +# Saves in local_main_Main_internal_136 data_0 +la $t4, data_0 +# local_main_Main_internal_135 <- local_main_Main_internal_135 = local_main_Main_internal_136 +move $t8, $t3 +move $t9, $t4 +loop_68: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_68 +beqz $a1, mismatch_68 +seq $v0, $a0, $a1 +beqz $v0, mismatch_68 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_68 +mismatch_68: +li $v0, 0 +j end_68 +check_68: +bnez $a1, mismatch_68 +li $v0, 1 +end_68: +move $t3, $v0 +# If not local_main_Main_internal_135 goto continue__1870 +sw $t0, -532($fp) +sw $t1, -0($fp) +sw $t2, -536($fp) +sw $t3, -544($fp) +sw $t4, -548($fp) +beqz $t3, continue__1870 +la $a0, dispatch_error +j .raise +continue__1870: +lw $t0, -536($fp) +lw $t1, -540($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -536($fp) +sw $t1, -540($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -540($fp) +# saves the return value +move $t0, $v0 +lw $t1, -532($fp) +lw $t2, -556($fp) +# local_main_Main_internal_138 <- Type of local_main_Main_internal_132 +lw $t2, 0($t1) +lw $t3, -560($fp) +# Saves in local_main_Main_internal_139 data_0 +la $t3, data_0 +# local_main_Main_internal_138 <- local_main_Main_internal_138 = local_main_Main_internal_139 +move $t8, $t2 +move $t9, $t3 +loop_69: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_69 +beqz $a1, mismatch_69 +seq $v0, $a0, $a1 +beqz $v0, mismatch_69 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_69 +mismatch_69: +li $v0, 0 +j end_69 +check_69: +bnez $a1, mismatch_69 +li $v0, 1 +end_69: +move $t2, $v0 +# If not local_main_Main_internal_138 goto continue__1882 +sw $t0, -540($fp) +sw $t1, -532($fp) +sw $t2, -556($fp) +sw $t3, -560($fp) +beqz $t2, continue__1882 +la $a0, dispatch_error +j .raise +continue__1882: +lw $t0, -552($fp) +# Static Dispatch of the method method5 +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -540($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -532($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -552($fp) +sw $t1, -540($fp) +sw $t2, -532($fp) +# This function will consume the arguments +jal function_method5_C +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -552($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_137 +sw $t0, 16($t1) +lw $t2, -176($fp) +# Moving local_main_Main_internal_137 to local_main_Main_internal_43 +move $t2, $t0 +sw $t2, -176($fp) +sw $t0, -552($fp) +sw $t1, -0($fp) +sw $t2, -176($fp) +end__1551: +lw $t0, -176($fp) +lw $t1, -160($fp) +# Moving local_main_Main_internal_43 to local_main_Main_internal_39 +move $t1, $t0 +sw $t1, -160($fp) +sw $t0, -176($fp) +sw $t1, -160($fp) +j end__1542 +true__1542: +lw $t0, -564($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +# Static Dispatch of the method C +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -564($fp) +# This function will consume the arguments +jal function_C_C +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -564($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -568($fp) +# local_main_Main_avar_141 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -576($fp) +# local_main_Main_internal_143 <- Type of local_main_Main_avar_141 +lw $t3, 0($t2) +lw $t4, -580($fp) +# Saves in local_main_Main_internal_144 data_0 +la $t4, data_0 +# local_main_Main_internal_143 <- local_main_Main_internal_143 = local_main_Main_internal_144 +move $t8, $t3 +move $t9, $t4 +loop_70: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_70 +beqz $a1, mismatch_70 +seq $v0, $a0, $a1 +beqz $v0, mismatch_70 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_70 +mismatch_70: +li $v0, 0 +j end_70 +check_70: +bnez $a1, mismatch_70 +li $v0, 1 +end_70: +move $t3, $v0 +# If not local_main_Main_internal_143 goto continue__1906 +sw $t0, -564($fp) +sw $t1, -0($fp) +sw $t2, -568($fp) +sw $t3, -576($fp) +sw $t4, -580($fp) +beqz $t3, continue__1906 +la $a0, dispatch_error +j .raise +continue__1906: +lw $t0, -568($fp) +lw $t1, -572($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -568($fp) +sw $t1, -572($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -572($fp) +# saves the return value +move $t0, $v0 +lw $t1, -564($fp) +lw $t2, -588($fp) +# local_main_Main_internal_146 <- Type of local_main_Main_internal_140 +lw $t2, 0($t1) +lw $t3, -592($fp) +# Saves in local_main_Main_internal_147 data_0 +la $t3, data_0 +# local_main_Main_internal_146 <- local_main_Main_internal_146 = local_main_Main_internal_147 +move $t8, $t2 +move $t9, $t3 +loop_71: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_71 +beqz $a1, mismatch_71 +seq $v0, $a0, $a1 +beqz $v0, mismatch_71 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_71 +mismatch_71: +li $v0, 0 +j end_71 +check_71: +bnez $a1, mismatch_71 +li $v0, 1 +end_71: +move $t2, $v0 +# If not local_main_Main_internal_146 goto continue__1918 +sw $t0, -572($fp) +sw $t1, -564($fp) +sw $t2, -588($fp) +sw $t3, -592($fp) +beqz $t2, continue__1918 +la $a0, dispatch_error +j .raise +continue__1918: +lw $t0, -584($fp) +# Static Dispatch of the method method5 +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -572($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -564($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -584($fp) +sw $t1, -572($fp) +sw $t2, -564($fp) +# This function will consume the arguments +jal function_method5_B +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -584($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_145 +sw $t0, 16($t1) +lw $t2, -160($fp) +# Moving local_main_Main_internal_145 to local_main_Main_internal_39 +move $t2, $t0 +sw $t2, -160($fp) +sw $t0, -584($fp) +sw $t1, -0($fp) +sw $t2, -160($fp) +end__1542: +lw $t0, -160($fp) +lw $t1, -144($fp) +# Moving local_main_Main_internal_39 to local_main_Main_internal_35 +move $t1, $t0 +sw $t1, -144($fp) +sw $t0, -160($fp) +sw $t1, -144($fp) +j end__1533 +true__1533: +lw $t0, -596($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +# Static Dispatch of the method C +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -596($fp) +# This function will consume the arguments +jal function_C_C +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -596($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -600($fp) +# local_main_Main_avar_149 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -608($fp) +# local_main_Main_internal_151 <- Type of local_main_Main_avar_149 +lw $t3, 0($t2) +lw $t4, -612($fp) +# Saves in local_main_Main_internal_152 data_0 +la $t4, data_0 +# local_main_Main_internal_151 <- local_main_Main_internal_151 = local_main_Main_internal_152 +move $t8, $t3 +move $t9, $t4 +loop_72: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_72 +beqz $a1, mismatch_72 +seq $v0, $a0, $a1 +beqz $v0, mismatch_72 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_72 +mismatch_72: +li $v0, 0 +j end_72 +check_72: +bnez $a1, mismatch_72 +li $v0, 1 +end_72: +move $t3, $v0 +# If not local_main_Main_internal_151 goto continue__1942 +sw $t0, -596($fp) +sw $t1, -0($fp) +sw $t2, -600($fp) +sw $t3, -608($fp) +sw $t4, -612($fp) +beqz $t3, continue__1942 +la $a0, dispatch_error +j .raise +continue__1942: +lw $t0, -600($fp) +lw $t1, -604($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -600($fp) +sw $t1, -604($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -604($fp) +# saves the return value +move $t0, $v0 +lw $t1, -596($fp) +lw $t2, -620($fp) +# local_main_Main_internal_154 <- Type of local_main_Main_internal_148 +lw $t2, 0($t1) +lw $t3, -624($fp) +# Saves in local_main_Main_internal_155 data_0 +la $t3, data_0 +# local_main_Main_internal_154 <- local_main_Main_internal_154 = local_main_Main_internal_155 +move $t8, $t2 +move $t9, $t3 +loop_73: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_73 +beqz $a1, mismatch_73 +seq $v0, $a0, $a1 +beqz $v0, mismatch_73 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_73 +mismatch_73: +li $v0, 0 +j end_73 +check_73: +bnez $a1, mismatch_73 +li $v0, 1 +end_73: +move $t2, $v0 +# If not local_main_Main_internal_154 goto continue__1954 +sw $t0, -604($fp) +sw $t1, -596($fp) +sw $t2, -620($fp) +sw $t3, -624($fp) +beqz $t2, continue__1954 +la $a0, dispatch_error +j .raise +continue__1954: +lw $t0, -616($fp) +# Static Dispatch of the method method5 +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -604($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -596($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -616($fp) +sw $t1, -604($fp) +sw $t2, -596($fp) +# This function will consume the arguments +jal function_method5_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -616($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_153 +sw $t0, 16($t1) +lw $t2, -144($fp) +# Moving local_main_Main_internal_153 to local_main_Main_internal_35 +move $t2, $t0 +sw $t2, -144($fp) +sw $t0, -616($fp) +sw $t1, -0($fp) +sw $t2, -144($fp) +end__1533: +lw $t0, -144($fp) +lw $t1, -128($fp) +# Moving local_main_Main_internal_35 to local_main_Main_internal_31 +move $t1, $t0 +sw $t1, -128($fp) +sw $t0, -144($fp) +sw $t1, -128($fp) +j end__1524 +true__1524: +lw $t0, -628($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -628($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -628($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -632($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_get_int_Main +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -628($fp) +sw $t1, -0($fp) +sw $t2, -632($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -632($fp) +# saves the return value +move $t0, $v0 +lw $t1, -628($fp) +lw $t2, -640($fp) +# local_main_Main_internal_159 <- Type of local_main_Main_internal_156 +lw $t2, 0($t1) +lw $t3, -644($fp) +# Saves in local_main_Main_internal_160 data_0 +la $t3, data_0 +# local_main_Main_internal_159 <- local_main_Main_internal_159 = local_main_Main_internal_160 +move $t8, $t2 +move $t9, $t3 +loop_74: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_74 +beqz $a1, mismatch_74 +seq $v0, $a0, $a1 +beqz $v0, mismatch_74 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_74 +mismatch_74: +li $v0, 0 +j end_74 +check_74: +bnez $a1, mismatch_74 +li $v0, 1 +end_74: +move $t2, $v0 +# If not local_main_Main_internal_159 goto continue__1979 +sw $t0, -632($fp) +sw $t1, -628($fp) +sw $t2, -640($fp) +sw $t3, -644($fp) +beqz $t2, continue__1979 +la $a0, dispatch_error +j .raise +continue__1979: +lw $t0, -628($fp) +lw $t1, -636($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -632($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -628($fp) +sw $t1, -636($fp) +sw $t2, -632($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -636($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . a_var <- SET local_main_Main_internal_158 +sw $t0, 20($t1) +lw $t2, -648($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_D +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t2) +# Static Dispatch of the method D +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -636($fp) +sw $t1, -0($fp) +sw $t2, -648($fp) +# This function will consume the arguments +jal function_D_D +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -648($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -652($fp) +# local_main_Main_avar_162 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -660($fp) +# local_main_Main_internal_164 <- Type of local_main_Main_avar_162 +lw $t3, 0($t2) +lw $t4, -664($fp) +# Saves in local_main_Main_internal_165 data_0 +la $t4, data_0 +# local_main_Main_internal_164 <- local_main_Main_internal_164 = local_main_Main_internal_165 +move $t8, $t3 +move $t9, $t4 +loop_75: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_75 +beqz $a1, mismatch_75 +seq $v0, $a0, $a1 +beqz $v0, mismatch_75 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_75 +mismatch_75: +li $v0, 0 +j end_75 +check_75: +bnez $a1, mismatch_75 +li $v0, 1 +end_75: +move $t3, $v0 +# If not local_main_Main_internal_164 goto continue__1998 +sw $t0, -648($fp) +sw $t1, -0($fp) +sw $t2, -652($fp) +sw $t3, -660($fp) +sw $t4, -664($fp) +beqz $t3, continue__1998 +la $a0, dispatch_error +j .raise +continue__1998: +lw $t0, -652($fp) +lw $t1, -656($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -652($fp) +sw $t1, -656($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -656($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -668($fp) +# local_main_Main_a_var_166 <- GET self . a_var +lw $t2, 20($t1) +lw $t3, -676($fp) +# local_main_Main_internal_168 <- Type of local_main_Main_a_var_166 +lw $t3, 0($t2) +lw $t4, -680($fp) +# Saves in local_main_Main_internal_169 data_0 +la $t4, data_0 +# local_main_Main_internal_168 <- local_main_Main_internal_168 = local_main_Main_internal_169 +move $t8, $t3 +move $t9, $t4 +loop_76: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_76 +beqz $a1, mismatch_76 +seq $v0, $a0, $a1 +beqz $v0, mismatch_76 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_76 +mismatch_76: +li $v0, 0 +j end_76 +check_76: +bnez $a1, mismatch_76 +li $v0, 1 +end_76: +move $t3, $v0 +# If not local_main_Main_internal_168 goto continue__2012 +sw $t0, -656($fp) +sw $t1, -0($fp) +sw $t2, -668($fp) +sw $t3, -676($fp) +sw $t4, -680($fp) +beqz $t3, continue__2012 +la $a0, dispatch_error +j .raise +continue__2012: +lw $t0, -668($fp) +lw $t1, -672($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -668($fp) +sw $t1, -672($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -672($fp) +# saves the return value +move $t0, $v0 +lw $t1, -648($fp) +lw $t2, -688($fp) +# local_main_Main_internal_171 <- Type of local_main_Main_internal_161 +lw $t2, 0($t1) +lw $t3, -692($fp) +# Saves in local_main_Main_internal_172 data_0 +la $t3, data_0 +# local_main_Main_internal_171 <- local_main_Main_internal_171 = local_main_Main_internal_172 +move $t8, $t2 +move $t9, $t3 +loop_77: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_77 +beqz $a1, mismatch_77 +seq $v0, $a0, $a1 +beqz $v0, mismatch_77 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_77 +mismatch_77: +li $v0, 0 +j end_77 +check_77: +bnez $a1, mismatch_77 +li $v0, 1 +end_77: +move $t2, $v0 +# If not local_main_Main_internal_171 goto continue__2025 +sw $t0, -672($fp) +sw $t1, -648($fp) +sw $t2, -688($fp) +sw $t3, -692($fp) +beqz $t2, continue__2025 +la $a0, dispatch_error +j .raise +continue__2025: +lw $t0, -648($fp) +lw $t1, -684($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method4_A +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -672($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -656($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -648($fp) +sw $t1, -684($fp) +sw $t2, -672($fp) +sw $t3, -656($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -684($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_170 +sw $t0, 16($t1) +lw $t2, -696($fp) +# Moving local_main_Main_internal_170 to local_main_Main_internal_173 +move $t2, $t0 +sw $t2, -696($fp) +lw $t3, -128($fp) +# Moving local_main_Main_internal_173 to local_main_Main_internal_31 +move $t3, $t2 +sw $t3, -128($fp) +sw $t0, -684($fp) +sw $t1, -0($fp) +sw $t2, -696($fp) +sw $t3, -128($fp) +end__1524: +lw $t0, -128($fp) +lw $t1, -112($fp) +# Moving local_main_Main_internal_31 to local_main_Main_internal_27 +move $t1, $t0 +sw $t1, -112($fp) +sw $t0, -128($fp) +sw $t1, -112($fp) +j end__1515 +true__1515: +lw $t0, -0($fp) +lw $t1, -700($fp) +# local_main_Main_avar_174 <- GET self . avar +lw $t1, 16($t0) +lw $t2, -708($fp) +# local_main_Main_internal_176 <- Type of local_main_Main_avar_174 +lw $t2, 0($t1) +lw $t3, -712($fp) +# Saves in local_main_Main_internal_177 data_0 +la $t3, data_0 +# local_main_Main_internal_176 <- local_main_Main_internal_176 = local_main_Main_internal_177 +move $t8, $t2 +move $t9, $t3 +loop_78: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_78 +beqz $a1, mismatch_78 +seq $v0, $a0, $a1 +beqz $v0, mismatch_78 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_78 +mismatch_78: +li $v0, 0 +j end_78 +check_78: +bnez $a1, mismatch_78 +li $v0, 1 +end_78: +move $t2, $v0 +# If local_main_Main_internal_176 goto error__2046 +sw $t0, -0($fp) +sw $t1, -700($fp) +sw $t2, -708($fp) +sw $t3, -712($fp) +bnez $t2, error__2046 +lw $t0, -700($fp) +lw $t1, -716($fp) +la $t9, type_C +lw $v0, 8($t0) +loop_79: +move $t8, $v0 +beqz $t8, false_79 +lw $v1, 0($t8) +beq $t9, $v1, true_79 +lw $v0, 4($t8) +j loop_79 +true_79: +li $t1, 1 +j end_79 +false_79: +li $t1, 0 +end_79: +# If not local_main_Main_internal_178 goto next__2052_0 +sw $t0, -700($fp) +sw $t1, -716($fp) +beqz $t1, next__2052_0 +lw $t0, -700($fp) +lw $t1, -720($fp) +# Moving local_main_Main_avar_174 to local_main_Main_c_179 +move $t1, $t0 +sw $t1, -720($fp) +lw $t2, -728($fp) +# local_main_Main_internal_181 <- Type of local_main_Main_c_179 +lw $t2, 0($t1) +lw $t3, -732($fp) +# Saves in local_main_Main_internal_182 data_0 +la $t3, data_0 +# local_main_Main_internal_181 <- local_main_Main_internal_181 = local_main_Main_internal_182 +move $t8, $t2 +move $t9, $t3 +loop_80: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_80 +beqz $a1, mismatch_80 +seq $v0, $a0, $a1 +beqz $v0, mismatch_80 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_80 +mismatch_80: +li $v0, 0 +j end_80 +check_80: +bnez $a1, mismatch_80 +li $v0, 1 +end_80: +move $t2, $v0 +# If not local_main_Main_internal_181 goto continue__2060 +sw $t0, -700($fp) +sw $t1, -720($fp) +sw $t2, -728($fp) +sw $t3, -732($fp) +beqz $t2, continue__2060 +la $a0, dispatch_error +j .raise +continue__2060: +lw $t0, -720($fp) +lw $t1, -724($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -720($fp) +sw $t1, -724($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -724($fp) +# saves the return value +move $t0, $v0 +lw $t1, -720($fp) +lw $t2, -740($fp) +# local_main_Main_internal_184 <- Type of local_main_Main_c_179 +lw $t2, 0($t1) +lw $t3, -744($fp) +# Saves in local_main_Main_internal_185 data_0 +la $t3, data_0 +# local_main_Main_internal_184 <- local_main_Main_internal_184 = local_main_Main_internal_185 +move $t8, $t2 +move $t9, $t3 +loop_81: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_81 +beqz $a1, mismatch_81 +seq $v0, $a0, $a1 +beqz $v0, mismatch_81 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_81 +mismatch_81: +li $v0, 0 +j end_81 +check_81: +bnez $a1, mismatch_81 +li $v0, 1 +end_81: +move $t2, $v0 +# If not local_main_Main_internal_184 goto continue__2072 +sw $t0, -724($fp) +sw $t1, -720($fp) +sw $t2, -740($fp) +sw $t3, -744($fp) +beqz $t2, continue__2072 +la $a0, dispatch_error +j .raise +continue__2072: +lw $t0, -720($fp) +lw $t1, -736($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method6_C +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -724($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -720($fp) +sw $t1, -736($fp) +sw $t2, -724($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -736($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_183 +sw $t0, 16($t1) +lw $t2, -704($fp) +# Moving local_main_Main_internal_183 to local_main_Main_internal_175 +move $t2, $t0 +sw $t2, -704($fp) +sw $t0, -736($fp) +sw $t1, -0($fp) +sw $t2, -704($fp) +j end__2046 +next__2052_0: +lw $t0, -700($fp) +lw $t1, -748($fp) +la $t9, type_A +lw $v0, 8($t0) +loop_82: +move $t8, $v0 +beqz $t8, false_82 +lw $v1, 0($t8) +beq $t9, $v1, true_82 +lw $v0, 4($t8) +j loop_82 +true_82: +li $t1, 1 +j end_82 +false_82: +li $t1, 0 +end_82: +# If not local_main_Main_internal_186 goto next__2086_1 +sw $t0, -700($fp) +sw $t1, -748($fp) +beqz $t1, next__2086_1 +lw $t0, -700($fp) +lw $t1, -752($fp) +# Moving local_main_Main_avar_174 to local_main_Main_a_187 +move $t1, $t0 +sw $t1, -752($fp) +lw $t2, -760($fp) +# local_main_Main_internal_189 <- Type of local_main_Main_a_187 +lw $t2, 0($t1) +lw $t3, -764($fp) +# Saves in local_main_Main_internal_190 data_0 +la $t3, data_0 +# local_main_Main_internal_189 <- local_main_Main_internal_189 = local_main_Main_internal_190 +move $t8, $t2 +move $t9, $t3 +loop_83: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_83 +beqz $a1, mismatch_83 +seq $v0, $a0, $a1 +beqz $v0, mismatch_83 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_83 +mismatch_83: +li $v0, 0 +j end_83 +check_83: +bnez $a1, mismatch_83 +li $v0, 1 +end_83: +move $t2, $v0 +# If not local_main_Main_internal_189 goto continue__2094 +sw $t0, -700($fp) +sw $t1, -752($fp) +sw $t2, -760($fp) +sw $t3, -764($fp) +beqz $t2, continue__2094 +la $a0, dispatch_error +j .raise +continue__2094: +lw $t0, -752($fp) +lw $t1, -756($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -752($fp) +sw $t1, -756($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -756($fp) +# saves the return value +move $t0, $v0 +lw $t1, -752($fp) +lw $t2, -772($fp) +# local_main_Main_internal_192 <- Type of local_main_Main_a_187 +lw $t2, 0($t1) +lw $t3, -776($fp) +# Saves in local_main_Main_internal_193 data_0 +la $t3, data_0 +# local_main_Main_internal_192 <- local_main_Main_internal_192 = local_main_Main_internal_193 +move $t8, $t2 +move $t9, $t3 +loop_84: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_84 +beqz $a1, mismatch_84 +seq $v0, $a0, $a1 +beqz $v0, mismatch_84 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_84 +mismatch_84: +li $v0, 0 +j end_84 +check_84: +bnez $a1, mismatch_84 +li $v0, 1 +end_84: +move $t2, $v0 +# If not local_main_Main_internal_192 goto continue__2106 +sw $t0, -756($fp) +sw $t1, -752($fp) +sw $t2, -772($fp) +sw $t3, -776($fp) +beqz $t2, continue__2106 +la $a0, dispatch_error +j .raise +continue__2106: +lw $t0, -752($fp) +lw $t1, -768($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method3_A +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -756($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -752($fp) +sw $t1, -768($fp) +sw $t2, -756($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -768($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_191 +sw $t0, 16($t1) +lw $t2, -704($fp) +# Moving local_main_Main_internal_191 to local_main_Main_internal_175 +move $t2, $t0 +sw $t2, -704($fp) +sw $t0, -768($fp) +sw $t1, -0($fp) +sw $t2, -704($fp) +j end__2046 +next__2086_1: +lw $t0, -700($fp) +lw $t1, -780($fp) +la $t9, type_Object +lw $v0, 8($t0) +loop_85: +move $t8, $v0 +beqz $t8, false_85 +lw $v1, 0($t8) +beq $t9, $v1, true_85 +lw $v0, 4($t8) +j loop_85 +true_85: +li $t1, 1 +j end_85 +false_85: +li $t1, 0 +end_85: +# If not local_main_Main_internal_194 goto next__2120_2 +sw $t0, -700($fp) +sw $t1, -780($fp) +beqz $t1, next__2120_2 +lw $t0, -700($fp) +lw $t1, -784($fp) +# Moving local_main_Main_avar_174 to local_main_Main_o_195 +move $t1, $t0 +sw $t1, -784($fp) +lw $t2, -788($fp) +# Saves in local_main_Main_internal_196 data_76 +la $t2, data_76 +lw $t3, -0($fp) +lw $t4, -792($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -700($fp) +sw $t1, -784($fp) +sw $t2, -788($fp) +sw $t3, -0($fp) +sw $t4, -792($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -792($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -796($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -792($fp) +sw $t1, -0($fp) +sw $t2, -796($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -796($fp) +# saves the return value +move $t0, $v0 +lw $t1, -800($fp) +# Moving 0 to local_main_Main_internal_199 +li $t1, 0 +sw $t1, -800($fp) +lw $t2, -704($fp) +# Moving local_main_Main_internal_199 to local_main_Main_internal_175 +move $t2, $t1 +sw $t2, -704($fp) +sw $t0, -796($fp) +sw $t1, -800($fp) +sw $t2, -704($fp) +j end__2046 +next__2120_2: +la $a0, case_error +j .raise +error__2046: +la $a0, case_void_error +j .raise +end__2046: +lw $t0, -704($fp) +lw $t1, -112($fp) +# Moving local_main_Main_internal_175 to local_main_Main_internal_27 +move $t1, $t0 +sw $t1, -112($fp) +sw $t0, -704($fp) +sw $t1, -112($fp) +end__1515: +lw $t0, -112($fp) +lw $t1, -96($fp) +# Moving local_main_Main_internal_27 to local_main_Main_internal_23 +move $t1, $t0 +sw $t1, -96($fp) +sw $t0, -112($fp) +sw $t1, -96($fp) +j end__1506 +true__1506: +lw $t0, -804($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -804($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -804($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -808($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_get_int_Main +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -804($fp) +sw $t1, -0($fp) +sw $t2, -808($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -808($fp) +# saves the return value +move $t0, $v0 +lw $t1, -804($fp) +lw $t2, -816($fp) +# local_main_Main_internal_203 <- Type of local_main_Main_internal_200 +lw $t2, 0($t1) +lw $t3, -820($fp) +# Saves in local_main_Main_internal_204 data_0 +la $t3, data_0 +# local_main_Main_internal_203 <- local_main_Main_internal_203 = local_main_Main_internal_204 +move $t8, $t2 +move $t9, $t3 +loop_86: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_86 +beqz $a1, mismatch_86 +seq $v0, $a0, $a1 +beqz $v0, mismatch_86 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_86 +mismatch_86: +li $v0, 0 +j end_86 +check_86: +bnez $a1, mismatch_86 +li $v0, 1 +end_86: +move $t2, $v0 +# If not local_main_Main_internal_203 goto continue__2158 +sw $t0, -808($fp) +sw $t1, -804($fp) +sw $t2, -816($fp) +sw $t3, -820($fp) +beqz $t2, continue__2158 +la $a0, dispatch_error +j .raise +continue__2158: +lw $t0, -804($fp) +lw $t1, -812($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_set_var_A +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -808($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -804($fp) +sw $t1, -812($fp) +sw $t2, -808($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -812($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . a_var <- SET local_main_Main_internal_202 +sw $t0, 20($t1) +lw $t2, -824($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method B +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -812($fp) +sw $t1, -0($fp) +sw $t2, -824($fp) +# This function will consume the arguments +jal function_B_B +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -824($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -828($fp) +# local_main_Main_avar_206 <- GET self . avar +lw $t2, 16($t1) +lw $t3, -836($fp) +# local_main_Main_internal_208 <- Type of local_main_Main_avar_206 +lw $t3, 0($t2) +lw $t4, -840($fp) +# Saves in local_main_Main_internal_209 data_0 +la $t4, data_0 +# local_main_Main_internal_208 <- local_main_Main_internal_208 = local_main_Main_internal_209 +move $t8, $t3 +move $t9, $t4 +loop_87: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_87 +beqz $a1, mismatch_87 +seq $v0, $a0, $a1 +beqz $v0, mismatch_87 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_87 +mismatch_87: +li $v0, 0 +j end_87 +check_87: +bnez $a1, mismatch_87 +li $v0, 1 +end_87: +move $t3, $v0 +# If not local_main_Main_internal_208 goto continue__2177 +sw $t0, -824($fp) +sw $t1, -0($fp) +sw $t2, -828($fp) +sw $t3, -836($fp) +sw $t4, -840($fp) +beqz $t3, continue__2177 +la $a0, dispatch_error +j .raise +continue__2177: +lw $t0, -828($fp) +lw $t1, -832($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -828($fp) +sw $t1, -832($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -832($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -844($fp) +# local_main_Main_a_var_210 <- GET self . a_var +lw $t2, 20($t1) +lw $t3, -852($fp) +# local_main_Main_internal_212 <- Type of local_main_Main_a_var_210 +lw $t3, 0($t2) +lw $t4, -856($fp) +# Saves in local_main_Main_internal_213 data_0 +la $t4, data_0 +# local_main_Main_internal_212 <- local_main_Main_internal_212 = local_main_Main_internal_213 +move $t8, $t3 +move $t9, $t4 +loop_88: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_88 +beqz $a1, mismatch_88 +seq $v0, $a0, $a1 +beqz $v0, mismatch_88 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_88 +mismatch_88: +li $v0, 0 +j end_88 +check_88: +bnez $a1, mismatch_88 +li $v0, 1 +end_88: +move $t3, $v0 +# If not local_main_Main_internal_212 goto continue__2191 +sw $t0, -832($fp) +sw $t1, -0($fp) +sw $t2, -844($fp) +sw $t3, -852($fp) +sw $t4, -856($fp) +beqz $t3, continue__2191 +la $a0, dispatch_error +j .raise +continue__2191: +lw $t0, -844($fp) +lw $t1, -848($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_value_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -844($fp) +sw $t1, -848($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -848($fp) +# saves the return value +move $t0, $v0 +lw $t1, -824($fp) +lw $t2, -864($fp) +# local_main_Main_internal_215 <- Type of local_main_Main_internal_205 +lw $t2, 0($t1) +lw $t3, -868($fp) +# Saves in local_main_Main_internal_216 data_0 +la $t3, data_0 +# local_main_Main_internal_215 <- local_main_Main_internal_215 = local_main_Main_internal_216 +move $t8, $t2 +move $t9, $t3 +loop_89: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_89 +beqz $a1, mismatch_89 +seq $v0, $a0, $a1 +beqz $v0, mismatch_89 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_89 +mismatch_89: +li $v0, 0 +j end_89 +check_89: +bnez $a1, mismatch_89 +li $v0, 1 +end_89: +move $t2, $v0 +# If not local_main_Main_internal_215 goto continue__2204 +sw $t0, -848($fp) +sw $t1, -824($fp) +sw $t2, -864($fp) +sw $t3, -868($fp) +beqz $t2, continue__2204 +la $a0, dispatch_error +j .raise +continue__2204: +lw $t0, -824($fp) +lw $t1, -860($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_method2_A +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -848($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -832($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -824($fp) +sw $t1, -860($fp) +sw $t2, -848($fp) +sw $t3, -832($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -860($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . avar <- SET local_main_Main_internal_214 +sw $t0, 16($t1) +lw $t2, -872($fp) +# Moving local_main_Main_internal_214 to local_main_Main_internal_217 +move $t2, $t0 +sw $t2, -872($fp) +lw $t3, -96($fp) +# Moving local_main_Main_internal_217 to local_main_Main_internal_23 +move $t3, $t2 +sw $t3, -96($fp) +sw $t0, -860($fp) +sw $t1, -0($fp) +sw $t2, -872($fp) +sw $t3, -96($fp) +end__1506: +lw $t0, -96($fp) +lw $t1, -876($fp) +# Moving local_main_Main_internal_23 to local_main_Main_internal_218 +move $t1, $t0 +sw $t1, -876($fp) +lw $t2, -8($fp) +# Moving local_main_Main_internal_218 to local_main_Main_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +sw $t0, -96($fp) +sw $t1, -876($fp) +sw $t2, -8($fp) +j start__1431 +end__1431: +lw $t0, -8($fp) +lw $t1, -880($fp) +# Moving local_main_Main_internal_1 to local_main_Main_internal_219 +move $t1, $t0 +sw $t1, -880($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -880($fp) +# Removing all locals from stack +addiu $sp, $sp, 884 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_D: .asciiz "D" +type_E: .asciiz "E" +type_A2I: .asciiz "A2I" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "0" +data_2: .asciiz "1" +data_3: .asciiz "2" +data_4: .asciiz "3" +data_5: .asciiz "4" +data_6: .asciiz "5" +data_7: .asciiz "6" +data_8: .asciiz "7" +data_9: .asciiz "8" +data_10: .asciiz "9" +data_11: .asciiz "" +data_12: .asciiz "9" +data_13: .asciiz "8" +data_14: .asciiz "7" +data_15: .asciiz "6" +data_16: .asciiz "5" +data_17: .asciiz "4" +data_18: .asciiz "3" +data_19: .asciiz "2" +data_20: .asciiz "1" +data_21: .asciiz "0" +data_22: .asciiz "-" +data_23: .asciiz "+" +data_24: .asciiz "-" +data_25: .asciiz "0" +data_26: .asciiz "" +data_27: .asciiz "" +data_28: .asciiz " + To add a number to " +data_29: .asciiz "...enter a: +" +data_30: .asciiz " To negate " +data_31: .asciiz "...enter b: +" +data_32: .asciiz " To find the difference between " +data_33: .asciiz "and another number...enter c: +" +data_34: .asciiz " To find the factorial of " +data_35: .asciiz "...enter d: +" +data_36: .asciiz " To square " +data_37: .asciiz "...enter e: +" +data_38: .asciiz " To cube " +data_39: .asciiz "...enter f: +" +data_40: .asciiz " To find out if " +data_41: .asciiz "is a multiple of 3...enter g: +" +data_42: .asciiz " To divide " +data_43: .asciiz "by 8...enter h: +" +data_44: .asciiz " To get a new number...enter j: +" +data_45: .asciiz " To quit...enter q: + +" +data_46: .asciiz " +" +data_47: .asciiz "Please enter a number... " +data_48: .asciiz "Class type is now E +" +data_49: .asciiz "Class type is now C +" +data_50: .asciiz "Class type is now D +" +data_51: .asciiz "Class type is now B +" +data_52: .asciiz "Class type is now A +" +data_53: .asciiz "Oooops +" +data_54: .asciiz " " +data_55: .asciiz "number " +data_56: .asciiz "is odd! +" +data_57: .asciiz "is even! +" +data_58: .asciiz "a" +data_59: .asciiz "b" +data_60: .asciiz "c" +data_61: .asciiz "d" +data_62: .asciiz "e" +data_63: .asciiz "f" +data_64: .asciiz "g" +data_65: .asciiz "h" +data_66: .asciiz "j" +data_67: .asciiz "q" +data_68: .asciiz "number " +data_69: .asciiz "is equal to " +data_70: .asciiz "times 8 with a remainder of " +data_71: .asciiz " +" +data_72: .asciiz "number " +data_73: .asciiz "is not divisible by 3. +" +data_74: .asciiz "number " +data_75: .asciiz "is divisible by 3. +" +data_76: .asciiz "Oooops +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/atoi.mips b/tests/codegen/atoi.mips new file mode 100644 index 00000000..d58e971f --- /dev/null +++ b/tests/codegen/atoi.mips @@ -0,0 +1,3995 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_c2i_A2I +sw $t9, 80($v0) +la $t9, function_i2c_A2I +sw $t9, 84($v0) +la $t9, function_a2i_A2I +sw $t9, 88($v0) +la $t9, function_a2i_aux_A2I +sw $t9, 92($v0) +la $t9, function_i2a_A2I +sw $t9, 96($v0) +la $t9, function_i2a_aux_A2I +sw $t9, 100($v0) +la $t9, function_main_Main +sw $t9, 104($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A2I +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_c2i_A2I in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_i2c_A2I in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_a2i_A2I in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_a2i_aux_A2I in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_i2a_A2I in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_i2a_aux_A2I in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 36 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_c2i_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value char +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_c2i_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_c2i_A2I_internal_31 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +# Saves in local_c2i_A2I_internal_1 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# local_c2i_A2I_internal_0 <- char = local_c2i_A2I_internal_1 +move $t8, $t1 +move $t9, $t0 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t2, $v0 +# If local_c2i_A2I_internal_0 goto true__54 +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +bnez $t2, true__54 +lw $t0, -24($fp) +# Saves in local_c2i_A2I_internal_4 data_2 +la $t0, data_2 +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_c2i_A2I_internal_3 <- char = local_c2i_A2I_internal_4 +move $t8, $t1 +move $t9, $t0 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t2, $v0 +# If local_c2i_A2I_internal_3 goto true__61 +sw $t0, -24($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +bnez $t2, true__61 +lw $t0, -36($fp) +# Saves in local_c2i_A2I_internal_7 data_3 +la $t0, data_3 +lw $t1, -0($fp) +lw $t2, -32($fp) +# local_c2i_A2I_internal_6 <- char = local_c2i_A2I_internal_7 +move $t8, $t1 +move $t9, $t0 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t2, $v0 +# If local_c2i_A2I_internal_6 goto true__68 +sw $t0, -36($fp) +sw $t1, -0($fp) +sw $t2, -32($fp) +bnez $t2, true__68 +lw $t0, -48($fp) +# Saves in local_c2i_A2I_internal_10 data_4 +la $t0, data_4 +lw $t1, -0($fp) +lw $t2, -44($fp) +# local_c2i_A2I_internal_9 <- char = local_c2i_A2I_internal_10 +move $t8, $t1 +move $t9, $t0 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If local_c2i_A2I_internal_9 goto true__75 +sw $t0, -48($fp) +sw $t1, -0($fp) +sw $t2, -44($fp) +bnez $t2, true__75 +lw $t0, -60($fp) +# Saves in local_c2i_A2I_internal_13 data_5 +la $t0, data_5 +lw $t1, -0($fp) +lw $t2, -56($fp) +# local_c2i_A2I_internal_12 <- char = local_c2i_A2I_internal_13 +move $t8, $t1 +move $t9, $t0 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t2, $v0 +# If local_c2i_A2I_internal_12 goto true__82 +sw $t0, -60($fp) +sw $t1, -0($fp) +sw $t2, -56($fp) +bnez $t2, true__82 +lw $t0, -72($fp) +# Saves in local_c2i_A2I_internal_16 data_6 +la $t0, data_6 +lw $t1, -0($fp) +lw $t2, -68($fp) +# local_c2i_A2I_internal_15 <- char = local_c2i_A2I_internal_16 +move $t8, $t1 +move $t9, $t0 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t2, $v0 +# If local_c2i_A2I_internal_15 goto true__89 +sw $t0, -72($fp) +sw $t1, -0($fp) +sw $t2, -68($fp) +bnez $t2, true__89 +lw $t0, -84($fp) +# Saves in local_c2i_A2I_internal_19 data_7 +la $t0, data_7 +lw $t1, -0($fp) +lw $t2, -80($fp) +# local_c2i_A2I_internal_18 <- char = local_c2i_A2I_internal_19 +move $t8, $t1 +move $t9, $t0 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t2, $v0 +# If local_c2i_A2I_internal_18 goto true__96 +sw $t0, -84($fp) +sw $t1, -0($fp) +sw $t2, -80($fp) +bnez $t2, true__96 +lw $t0, -96($fp) +# Saves in local_c2i_A2I_internal_22 data_8 +la $t0, data_8 +lw $t1, -0($fp) +lw $t2, -92($fp) +# local_c2i_A2I_internal_21 <- char = local_c2i_A2I_internal_22 +move $t8, $t1 +move $t9, $t0 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t2, $v0 +# If local_c2i_A2I_internal_21 goto true__103 +sw $t0, -96($fp) +sw $t1, -0($fp) +sw $t2, -92($fp) +bnez $t2, true__103 +lw $t0, -108($fp) +# Saves in local_c2i_A2I_internal_25 data_9 +la $t0, data_9 +lw $t1, -0($fp) +lw $t2, -104($fp) +# local_c2i_A2I_internal_24 <- char = local_c2i_A2I_internal_25 +move $t8, $t1 +move $t9, $t0 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t2, $v0 +# If local_c2i_A2I_internal_24 goto true__110 +sw $t0, -108($fp) +sw $t1, -0($fp) +sw $t2, -104($fp) +bnez $t2, true__110 +lw $t0, -120($fp) +# Saves in local_c2i_A2I_internal_28 data_10 +la $t0, data_10 +lw $t1, -0($fp) +lw $t2, -116($fp) +# local_c2i_A2I_internal_27 <- char = local_c2i_A2I_internal_28 +move $t8, $t1 +move $t9, $t0 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t2, $v0 +# If local_c2i_A2I_internal_27 goto true__117 +sw $t0, -120($fp) +sw $t1, -0($fp) +sw $t2, -116($fp) +bnez $t2, true__117 +lw $t0, -4($fp) +lw $t1, -128($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -128($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -128($fp) +# saves the return value +move $t0, $v0 +lw $t1, -132($fp) +# Moving 0 to local_c2i_A2I_internal_31 +li $t1, 0 +sw $t1, -132($fp) +lw $t2, -124($fp) +# Moving local_c2i_A2I_internal_31 to local_c2i_A2I_internal_29 +move $t2, $t1 +sw $t2, -124($fp) +sw $t0, -128($fp) +sw $t1, -132($fp) +sw $t2, -124($fp) +j end__117 +true__117: +lw $t0, -124($fp) +# Moving 9 to local_c2i_A2I_internal_29 +li $t0, 9 +sw $t0, -124($fp) +sw $t0, -124($fp) +end__117: +lw $t0, -124($fp) +lw $t1, -112($fp) +# Moving local_c2i_A2I_internal_29 to local_c2i_A2I_internal_26 +move $t1, $t0 +sw $t1, -112($fp) +sw $t0, -124($fp) +sw $t1, -112($fp) +j end__110 +true__110: +lw $t0, -112($fp) +# Moving 8 to local_c2i_A2I_internal_26 +li $t0, 8 +sw $t0, -112($fp) +sw $t0, -112($fp) +end__110: +lw $t0, -112($fp) +lw $t1, -100($fp) +# Moving local_c2i_A2I_internal_26 to local_c2i_A2I_internal_23 +move $t1, $t0 +sw $t1, -100($fp) +sw $t0, -112($fp) +sw $t1, -100($fp) +j end__103 +true__103: +lw $t0, -100($fp) +# Moving 7 to local_c2i_A2I_internal_23 +li $t0, 7 +sw $t0, -100($fp) +sw $t0, -100($fp) +end__103: +lw $t0, -100($fp) +lw $t1, -88($fp) +# Moving local_c2i_A2I_internal_23 to local_c2i_A2I_internal_20 +move $t1, $t0 +sw $t1, -88($fp) +sw $t0, -100($fp) +sw $t1, -88($fp) +j end__96 +true__96: +lw $t0, -88($fp) +# Moving 6 to local_c2i_A2I_internal_20 +li $t0, 6 +sw $t0, -88($fp) +sw $t0, -88($fp) +end__96: +lw $t0, -88($fp) +lw $t1, -76($fp) +# Moving local_c2i_A2I_internal_20 to local_c2i_A2I_internal_17 +move $t1, $t0 +sw $t1, -76($fp) +sw $t0, -88($fp) +sw $t1, -76($fp) +j end__89 +true__89: +lw $t0, -76($fp) +# Moving 5 to local_c2i_A2I_internal_17 +li $t0, 5 +sw $t0, -76($fp) +sw $t0, -76($fp) +end__89: +lw $t0, -76($fp) +lw $t1, -64($fp) +# Moving local_c2i_A2I_internal_17 to local_c2i_A2I_internal_14 +move $t1, $t0 +sw $t1, -64($fp) +sw $t0, -76($fp) +sw $t1, -64($fp) +j end__82 +true__82: +lw $t0, -64($fp) +# Moving 4 to local_c2i_A2I_internal_14 +li $t0, 4 +sw $t0, -64($fp) +sw $t0, -64($fp) +end__82: +lw $t0, -64($fp) +lw $t1, -52($fp) +# Moving local_c2i_A2I_internal_14 to local_c2i_A2I_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -64($fp) +sw $t1, -52($fp) +j end__75 +true__75: +lw $t0, -52($fp) +# Moving 3 to local_c2i_A2I_internal_11 +li $t0, 3 +sw $t0, -52($fp) +sw $t0, -52($fp) +end__75: +lw $t0, -52($fp) +lw $t1, -40($fp) +# Moving local_c2i_A2I_internal_11 to local_c2i_A2I_internal_8 +move $t1, $t0 +sw $t1, -40($fp) +sw $t0, -52($fp) +sw $t1, -40($fp) +j end__68 +true__68: +lw $t0, -40($fp) +# Moving 2 to local_c2i_A2I_internal_8 +li $t0, 2 +sw $t0, -40($fp) +sw $t0, -40($fp) +end__68: +lw $t0, -40($fp) +lw $t1, -28($fp) +# Moving local_c2i_A2I_internal_8 to local_c2i_A2I_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -40($fp) +sw $t1, -28($fp) +j end__61 +true__61: +lw $t0, -28($fp) +# Moving 1 to local_c2i_A2I_internal_5 +li $t0, 1 +sw $t0, -28($fp) +sw $t0, -28($fp) +end__61: +lw $t0, -28($fp) +lw $t1, -16($fp) +# Moving local_c2i_A2I_internal_5 to local_c2i_A2I_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -28($fp) +sw $t1, -16($fp) +j end__54 +true__54: +lw $t0, -16($fp) +# Moving 0 to local_c2i_A2I_internal_2 +li $t0, 0 +sw $t0, -16($fp) +sw $t0, -16($fp) +end__54: +lw $t0, -16($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 136 +jr $ra + + +function_i2c_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_i2c_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2c_A2I_internal_32 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_i2c_A2I_internal_0 <- i = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_0 goto true__180 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__180 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_i2c_A2I_internal_2 <- i = 1 +li $t9, 1 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_2 goto true__184 +sw $t0, -0($fp) +sw $t1, -16($fp) +bnez $t1, true__184 +lw $t0, -0($fp) +lw $t1, -24($fp) +# local_i2c_A2I_internal_4 <- i = 2 +li $t9, 2 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_4 goto true__188 +sw $t0, -0($fp) +sw $t1, -24($fp) +bnez $t1, true__188 +lw $t0, -0($fp) +lw $t1, -32($fp) +# local_i2c_A2I_internal_6 <- i = 3 +li $t9, 3 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_6 goto true__192 +sw $t0, -0($fp) +sw $t1, -32($fp) +bnez $t1, true__192 +lw $t0, -0($fp) +lw $t1, -40($fp) +# local_i2c_A2I_internal_8 <- i = 4 +li $t9, 4 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_8 goto true__196 +sw $t0, -0($fp) +sw $t1, -40($fp) +bnez $t1, true__196 +lw $t0, -0($fp) +lw $t1, -48($fp) +# local_i2c_A2I_internal_10 <- i = 5 +li $t9, 5 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_10 goto true__200 +sw $t0, -0($fp) +sw $t1, -48($fp) +bnez $t1, true__200 +lw $t0, -0($fp) +lw $t1, -56($fp) +# local_i2c_A2I_internal_12 <- i = 6 +li $t9, 6 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_12 goto true__204 +sw $t0, -0($fp) +sw $t1, -56($fp) +bnez $t1, true__204 +lw $t0, -0($fp) +lw $t1, -64($fp) +# local_i2c_A2I_internal_14 <- i = 7 +li $t9, 7 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_14 goto true__208 +sw $t0, -0($fp) +sw $t1, -64($fp) +bnez $t1, true__208 +lw $t0, -0($fp) +lw $t1, -72($fp) +# local_i2c_A2I_internal_16 <- i = 8 +li $t9, 8 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_16 goto true__212 +sw $t0, -0($fp) +sw $t1, -72($fp) +bnez $t1, true__212 +lw $t0, -0($fp) +lw $t1, -80($fp) +# local_i2c_A2I_internal_18 <- i = 9 +li $t9, 9 +seq $t1, $t0, $t9 +# If local_i2c_A2I_internal_18 goto true__216 +sw $t0, -0($fp) +sw $t1, -80($fp) +bnez $t1, true__216 +lw $t0, -4($fp) +lw $t1, -88($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -88($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Saves in local_i2c_A2I_internal_21 data_11 +la $t1, data_11 +lw $t2, -96($fp) +# Moving local_i2c_A2I_internal_21 to local_i2c_A2I_internal_22 +move $t2, $t1 +sw $t2, -96($fp) +lw $t3, -84($fp) +# Moving local_i2c_A2I_internal_22 to local_i2c_A2I_internal_19 +move $t3, $t2 +sw $t3, -84($fp) +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -96($fp) +sw $t3, -84($fp) +j end__216 +true__216: +lw $t0, -100($fp) +# Saves in local_i2c_A2I_internal_23 data_12 +la $t0, data_12 +lw $t1, -84($fp) +# Moving local_i2c_A2I_internal_23 to local_i2c_A2I_internal_19 +move $t1, $t0 +sw $t1, -84($fp) +sw $t0, -100($fp) +sw $t1, -84($fp) +end__216: +lw $t0, -84($fp) +lw $t1, -76($fp) +# Moving local_i2c_A2I_internal_19 to local_i2c_A2I_internal_17 +move $t1, $t0 +sw $t1, -76($fp) +sw $t0, -84($fp) +sw $t1, -76($fp) +j end__212 +true__212: +lw $t0, -104($fp) +# Saves in local_i2c_A2I_internal_24 data_13 +la $t0, data_13 +lw $t1, -76($fp) +# Moving local_i2c_A2I_internal_24 to local_i2c_A2I_internal_17 +move $t1, $t0 +sw $t1, -76($fp) +sw $t0, -104($fp) +sw $t1, -76($fp) +end__212: +lw $t0, -76($fp) +lw $t1, -68($fp) +# Moving local_i2c_A2I_internal_17 to local_i2c_A2I_internal_15 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -76($fp) +sw $t1, -68($fp) +j end__208 +true__208: +lw $t0, -108($fp) +# Saves in local_i2c_A2I_internal_25 data_14 +la $t0, data_14 +lw $t1, -68($fp) +# Moving local_i2c_A2I_internal_25 to local_i2c_A2I_internal_15 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -108($fp) +sw $t1, -68($fp) +end__208: +lw $t0, -68($fp) +lw $t1, -60($fp) +# Moving local_i2c_A2I_internal_15 to local_i2c_A2I_internal_13 +move $t1, $t0 +sw $t1, -60($fp) +sw $t0, -68($fp) +sw $t1, -60($fp) +j end__204 +true__204: +lw $t0, -112($fp) +# Saves in local_i2c_A2I_internal_26 data_15 +la $t0, data_15 +lw $t1, -60($fp) +# Moving local_i2c_A2I_internal_26 to local_i2c_A2I_internal_13 +move $t1, $t0 +sw $t1, -60($fp) +sw $t0, -112($fp) +sw $t1, -60($fp) +end__204: +lw $t0, -60($fp) +lw $t1, -52($fp) +# Moving local_i2c_A2I_internal_13 to local_i2c_A2I_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -60($fp) +sw $t1, -52($fp) +j end__200 +true__200: +lw $t0, -116($fp) +# Saves in local_i2c_A2I_internal_27 data_16 +la $t0, data_16 +lw $t1, -52($fp) +# Moving local_i2c_A2I_internal_27 to local_i2c_A2I_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -116($fp) +sw $t1, -52($fp) +end__200: +lw $t0, -52($fp) +lw $t1, -44($fp) +# Moving local_i2c_A2I_internal_11 to local_i2c_A2I_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -52($fp) +sw $t1, -44($fp) +j end__196 +true__196: +lw $t0, -120($fp) +# Saves in local_i2c_A2I_internal_28 data_17 +la $t0, data_17 +lw $t1, -44($fp) +# Moving local_i2c_A2I_internal_28 to local_i2c_A2I_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -120($fp) +sw $t1, -44($fp) +end__196: +lw $t0, -44($fp) +lw $t1, -36($fp) +# Moving local_i2c_A2I_internal_9 to local_i2c_A2I_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -44($fp) +sw $t1, -36($fp) +j end__192 +true__192: +lw $t0, -124($fp) +# Saves in local_i2c_A2I_internal_29 data_18 +la $t0, data_18 +lw $t1, -36($fp) +# Moving local_i2c_A2I_internal_29 to local_i2c_A2I_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -124($fp) +sw $t1, -36($fp) +end__192: +lw $t0, -36($fp) +lw $t1, -28($fp) +# Moving local_i2c_A2I_internal_7 to local_i2c_A2I_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -36($fp) +sw $t1, -28($fp) +j end__188 +true__188: +lw $t0, -128($fp) +# Saves in local_i2c_A2I_internal_30 data_19 +la $t0, data_19 +lw $t1, -28($fp) +# Moving local_i2c_A2I_internal_30 to local_i2c_A2I_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -128($fp) +sw $t1, -28($fp) +end__188: +lw $t0, -28($fp) +lw $t1, -20($fp) +# Moving local_i2c_A2I_internal_5 to local_i2c_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -28($fp) +sw $t1, -20($fp) +j end__184 +true__184: +lw $t0, -132($fp) +# Saves in local_i2c_A2I_internal_31 data_20 +la $t0, data_20 +lw $t1, -20($fp) +# Moving local_i2c_A2I_internal_31 to local_i2c_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -132($fp) +sw $t1, -20($fp) +end__184: +lw $t0, -20($fp) +lw $t1, -12($fp) +# Moving local_i2c_A2I_internal_3 to local_i2c_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -20($fp) +sw $t1, -12($fp) +j end__180 +true__180: +lw $t0, -136($fp) +# Saves in local_i2c_A2I_internal_32 data_21 +la $t0, data_21 +lw $t1, -12($fp) +# Moving local_i2c_A2I_internal_32 to local_i2c_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -136($fp) +sw $t1, -12($fp) +end__180: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 140 +jr $ra + + +function_a2i_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value s +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_a2i_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_A2I_internal_34 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_a2i_A2I_internal_2 <- Type of s +la $t1, type_String +lw $t2, -20($fp) +# Saves in local_a2i_A2I_internal_3 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_2 <- local_a2i_A2I_internal_2 = local_a2i_A2I_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_16: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_16 +beqz $a1, mismatch_16 +seq $v0, $a0, $a1 +beqz $v0, mismatch_16 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_16 +mismatch_16: +li $v0, 0 +j end_16 +check_16: +bnez $a1, mismatch_16 +li $v0, 1 +end_16: +move $t1, $v0 +# If not local_a2i_A2I_internal_2 goto continue__313 +sw $t0, -0($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +beqz $t1, continue__313 +la $a0, dispatch_error +j .raise +continue__313: +lw $t0, -12($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# local_a2i_A2I_internal_0 <- local_a2i_A2I_internal_1 = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_a2i_A2I_internal_0 goto true__324 +sw $t0, -12($fp) +sw $t1, -8($fp) +bnez $t1, true__324 +lw $t0, -0($fp) +lw $t1, -36($fp) +# local_a2i_A2I_internal_7 <- Type of s +la $t1, type_String +lw $t2, -40($fp) +# Saves in local_a2i_A2I_internal_8 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_7 <- local_a2i_A2I_internal_7 = local_a2i_A2I_internal_8 +move $t8, $t1 +move $t9, $t2 +loop_17: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_17 +beqz $a1, mismatch_17 +seq $v0, $a0, $a1 +beqz $v0, mismatch_17 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_17 +mismatch_17: +li $v0, 0 +j end_17 +check_17: +bnez $a1, mismatch_17 +li $v0, 1 +end_17: +move $t1, $v0 +# If not local_a2i_A2I_internal_7 goto continue__331 +sw $t0, -0($fp) +sw $t1, -36($fp) +sw $t2, -40($fp) +beqz $t1, continue__331 +la $a0, dispatch_error +j .raise +continue__331: +lw $t0, -32($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 0 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_a2i_A2I_internal_9 data_22 +la $t1, data_22 +lw $t2, -28($fp) +# local_a2i_A2I_internal_5 <- local_a2i_A2I_internal_6 = local_a2i_A2I_internal_9 +move $t8, $t0 +move $t9, $t1 +loop_18: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_18 +beqz $a1, mismatch_18 +seq $v0, $a0, $a1 +beqz $v0, mismatch_18 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_18 +mismatch_18: +li $v0, 0 +j end_18 +check_18: +bnez $a1, mismatch_18 +li $v0, 1 +end_18: +move $t2, $v0 +# If local_a2i_A2I_internal_5 goto true__345 +sw $t0, -32($fp) +sw $t1, -44($fp) +sw $t2, -28($fp) +bnez $t2, true__345 +lw $t0, -0($fp) +lw $t1, -60($fp) +# local_a2i_A2I_internal_13 <- Type of s +la $t1, type_String +lw $t2, -64($fp) +# Saves in local_a2i_A2I_internal_14 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_13 <- local_a2i_A2I_internal_13 = local_a2i_A2I_internal_14 +move $t8, $t1 +move $t9, $t2 +loop_19: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_19 +beqz $a1, mismatch_19 +seq $v0, $a0, $a1 +beqz $v0, mismatch_19 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_19 +mismatch_19: +li $v0, 0 +j end_19 +check_19: +bnez $a1, mismatch_19 +li $v0, 1 +end_19: +move $t1, $v0 +# If not local_a2i_A2I_internal_13 goto continue__352 +sw $t0, -0($fp) +sw $t1, -60($fp) +sw $t2, -64($fp) +beqz $t1, continue__352 +la $a0, dispatch_error +j .raise +continue__352: +lw $t0, -56($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 0 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Saves in local_a2i_A2I_internal_15 data_23 +la $t1, data_23 +lw $t2, -52($fp) +# local_a2i_A2I_internal_11 <- local_a2i_A2I_internal_12 = local_a2i_A2I_internal_15 +move $t8, $t0 +move $t9, $t1 +loop_20: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_20 +beqz $a1, mismatch_20 +seq $v0, $a0, $a1 +beqz $v0, mismatch_20 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_20 +mismatch_20: +li $v0, 0 +j end_20 +check_20: +bnez $a1, mismatch_20 +li $v0, 1 +end_20: +move $t2, $v0 +# If local_a2i_A2I_internal_11 goto true__366 +sw $t0, -56($fp) +sw $t1, -68($fp) +sw $t2, -52($fp) +bnez $t2, true__366 +lw $t0, -4($fp) +lw $t1, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_aux_A2I +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -76($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Moving local_a2i_A2I_internal_17 to local_a2i_A2I_internal_16 +move $t1, $t0 +sw $t1, -72($fp) +sw $t0, -76($fp) +sw $t1, -72($fp) +j end__366 +true__366: +lw $t0, -0($fp) +lw $t1, -88($fp) +# local_a2i_A2I_internal_20 <- Type of s +la $t1, type_String +lw $t2, -92($fp) +# Saves in local_a2i_A2I_internal_21 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_20 <- local_a2i_A2I_internal_20 = local_a2i_A2I_internal_21 +move $t8, $t1 +move $t9, $t2 +loop_21: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_21 +beqz $a1, mismatch_21 +seq $v0, $a0, $a1 +beqz $v0, mismatch_21 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_21 +mismatch_21: +li $v0, 0 +j end_21 +check_21: +bnez $a1, mismatch_21 +li $v0, 1 +end_21: +move $t1, $v0 +# If not local_a2i_A2I_internal_20 goto continue__380 +sw $t0, -0($fp) +sw $t1, -88($fp) +sw $t2, -92($fp) +beqz $t1, continue__380 +la $a0, dispatch_error +j .raise +continue__380: +lw $t0, -84($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# local_a2i_A2I_internal_18 <- local_a2i_A2I_internal_19 - 1 +addi $t1, $t0, -1 +lw $t2, -0($fp) +lw $t3, -100($fp) +# local_a2i_A2I_internal_23 <- Type of s +la $t3, type_String +lw $t4, -104($fp) +# Saves in local_a2i_A2I_internal_24 data_0 +la $t4, data_0 +# local_a2i_A2I_internal_23 <- local_a2i_A2I_internal_23 = local_a2i_A2I_internal_24 +move $t8, $t3 +move $t9, $t4 +loop_22: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_22 +beqz $a1, mismatch_22 +seq $v0, $a0, $a1 +beqz $v0, mismatch_22 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_22 +mismatch_22: +li $v0, 0 +j end_22 +check_22: +bnez $a1, mismatch_22 +li $v0, 1 +end_22: +move $t3, $v0 +# If not local_a2i_A2I_internal_23 goto continue__394 +sw $t0, -84($fp) +sw $t1, -80($fp) +sw $t2, -0($fp) +sw $t3, -100($fp) +sw $t4, -104($fp) +beqz $t3, continue__394 +la $a0, dispatch_error +j .raise +continue__394: +lw $t0, -96($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -80($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -80($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -108($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_aux_A2I +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -4($fp) +sw $t2, -108($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Moving local_a2i_A2I_internal_25 to local_a2i_A2I_internal_16 +move $t1, $t0 +sw $t1, -72($fp) +sw $t0, -108($fp) +sw $t1, -72($fp) +end__366: +lw $t0, -72($fp) +lw $t1, -48($fp) +# Moving local_a2i_A2I_internal_16 to local_a2i_A2I_internal_10 +move $t1, $t0 +sw $t1, -48($fp) +sw $t0, -72($fp) +sw $t1, -48($fp) +j end__345 +true__345: +lw $t0, -0($fp) +lw $t1, -124($fp) +# local_a2i_A2I_internal_29 <- Type of s +la $t1, type_String +lw $t2, -128($fp) +# Saves in local_a2i_A2I_internal_30 data_0 +la $t2, data_0 +# local_a2i_A2I_internal_29 <- local_a2i_A2I_internal_29 = local_a2i_A2I_internal_30 +move $t8, $t1 +move $t9, $t2 +loop_23: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_23 +beqz $a1, mismatch_23 +seq $v0, $a0, $a1 +beqz $v0, mismatch_23 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_23 +mismatch_23: +li $v0, 0 +j end_23 +check_23: +bnez $a1, mismatch_23 +li $v0, 1 +end_23: +move $t1, $v0 +# If not local_a2i_A2I_internal_29 goto continue__418 +sw $t0, -0($fp) +sw $t1, -124($fp) +sw $t2, -128($fp) +beqz $t1, continue__418 +la $a0, dispatch_error +j .raise +continue__418: +lw $t0, -120($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -120($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -120($fp) +# saves the return value +move $t0, $v0 +lw $t1, -116($fp) +# local_a2i_A2I_internal_27 <- local_a2i_A2I_internal_28 - 1 +addi $t1, $t0, -1 +lw $t2, -0($fp) +lw $t3, -136($fp) +# local_a2i_A2I_internal_32 <- Type of s +la $t3, type_String +lw $t4, -140($fp) +# Saves in local_a2i_A2I_internal_33 data_0 +la $t4, data_0 +# local_a2i_A2I_internal_32 <- local_a2i_A2I_internal_32 = local_a2i_A2I_internal_33 +move $t8, $t3 +move $t9, $t4 +loop_24: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_24 +beqz $a1, mismatch_24 +seq $v0, $a0, $a1 +beqz $v0, mismatch_24 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_24 +mismatch_24: +li $v0, 0 +j end_24 +check_24: +bnez $a1, mismatch_24 +li $v0, 1 +end_24: +move $t3, $v0 +# If not local_a2i_A2I_internal_32 goto continue__432 +sw $t0, -120($fp) +sw $t1, -116($fp) +sw $t2, -0($fp) +sw $t3, -136($fp) +sw $t4, -140($fp) +beqz $t3, continue__432 +la $a0, dispatch_error +j .raise +continue__432: +lw $t0, -132($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -116($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -132($fp) +sw $t1, -116($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -132($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -144($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_aux_A2I +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -132($fp) +sw $t1, -4($fp) +sw $t2, -144($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -144($fp) +# saves the return value +move $t0, $v0 +lw $t1, -112($fp) +# local_a2i_A2I_internal_26 <- ~local_a2i_A2I_internal_34 +not $t1, $t0 +addi $t1, $t1, 1 +lw $t2, -48($fp) +# Moving local_a2i_A2I_internal_26 to local_a2i_A2I_internal_10 +move $t2, $t1 +sw $t2, -48($fp) +sw $t0, -144($fp) +sw $t1, -112($fp) +sw $t2, -48($fp) +end__345: +lw $t0, -48($fp) +lw $t1, -24($fp) +# Moving local_a2i_A2I_internal_10 to local_a2i_A2I_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -48($fp) +sw $t1, -24($fp) +j end__324 +true__324: +lw $t0, -24($fp) +# Moving 0 to local_a2i_A2I_internal_4 +li $t0, 0 +sw $t0, -24($fp) +sw $t0, -24($fp) +end__324: +lw $t0, -24($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 148 +jr $ra + + +function_a2i_aux_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value s +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_a2i_aux_A2I_int_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_j_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_i_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_a2i_aux_A2I_internal_16 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 0 to local_a2i_aux_A2I_int_0 +li $t0, 0 +sw $t0, -8($fp) +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_a2i_aux_A2I_internal_3 <- Type of s +la $t2, type_String +lw $t3, -24($fp) +# Saves in local_a2i_aux_A2I_internal_4 data_0 +la $t3, data_0 +# local_a2i_aux_A2I_internal_3 <- local_a2i_aux_A2I_internal_3 = local_a2i_aux_A2I_internal_4 +move $t8, $t2 +move $t9, $t3 +loop_25: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_25 +beqz $a1, mismatch_25 +seq $v0, $a0, $a1 +beqz $v0, mismatch_25 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_25 +mismatch_25: +li $v0, 0 +j end_25 +check_25: +bnez $a1, mismatch_25 +li $v0, 1 +end_25: +move $t2, $v0 +# If not local_a2i_aux_A2I_internal_3 goto continue__462 +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +sw $t3, -24($fp) +beqz $t2, continue__462 +la $a0, dispatch_error +j .raise +continue__462: +lw $t0, -16($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_a2i_aux_A2I_internal_2 to local_a2i_aux_A2I_j_1 +move $t1, $t0 +sw $t1, -12($fp) +lw $t2, -28($fp) +# Moving 0 to local_a2i_aux_A2I_i_5 +li $t2, 0 +sw $t2, -28($fp) +lw $t3, -32($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t3, $v0 +sw $t0, -16($fp) +sw $t1, -12($fp) +sw $t2, -28($fp) +sw $t3, -32($fp) +start__475: +lw $t0, -28($fp) +lw $t1, -12($fp) +lw $t2, -36($fp) +# local_a2i_aux_A2I_internal_7 <- local_a2i_aux_A2I_i_5 < local_a2i_aux_A2I_j_1 +slt $t2, $t0, $t1 +# If not local_a2i_aux_A2I_internal_7 goto end__475 +sw $t0, -28($fp) +sw $t1, -12($fp) +sw $t2, -36($fp) +beqz $t2, end__475 +lw $t0, -8($fp) +lw $t1, -44($fp) +# local_a2i_aux_A2I_internal_9 <- local_a2i_aux_A2I_int_0 * 10 +li $t9, 10 +mult $t0, $t9 +mflo $t1 +lw $t2, -0($fp) +lw $t3, -52($fp) +# local_a2i_aux_A2I_internal_11 <- Type of s +la $t3, type_String +lw $t4, -56($fp) +# Saves in local_a2i_aux_A2I_internal_12 data_0 +la $t4, data_0 +# local_a2i_aux_A2I_internal_11 <- local_a2i_aux_A2I_internal_11 = local_a2i_aux_A2I_internal_12 +move $t8, $t3 +move $t9, $t4 +loop_26: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_26 +beqz $a1, mismatch_26 +seq $v0, $a0, $a1 +beqz $v0, mismatch_26 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_26 +mismatch_26: +li $v0, 0 +j end_26 +check_26: +bnez $a1, mismatch_26 +li $v0, 1 +end_26: +move $t3, $v0 +# If not local_a2i_aux_A2I_internal_11 goto continue__489 +sw $t0, -8($fp) +sw $t1, -44($fp) +sw $t2, -0($fp) +sw $t3, -52($fp) +sw $t4, -56($fp) +beqz $t3, continue__489 +la $a0, dispatch_error +j .raise +continue__489: +lw $t0, -48($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -28($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -28($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_c2i_A2I +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +lw $t2, -40($fp) +# local_a2i_aux_A2I_internal_8 <- local_a2i_aux_A2I_internal_9 + local_a2i_aux_A2I_internal_13 +add $t2, $t1, $t0 +lw $t3, -8($fp) +# Moving local_a2i_aux_A2I_internal_8 to local_a2i_aux_A2I_int_0 +move $t3, $t2 +sw $t3, -8($fp) +lw $t4, -28($fp) +lw $t5, -64($fp) +# local_a2i_aux_A2I_internal_14 <- local_a2i_aux_A2I_i_5 + 1 +addi $t5, $t4, 1 +# Moving local_a2i_aux_A2I_internal_14 to local_a2i_aux_A2I_i_5 +move $t4, $t5 +sw $t4, -28($fp) +lw $t6, -68($fp) +# Moving local_a2i_aux_A2I_internal_14 to local_a2i_aux_A2I_internal_15 +move $t6, $t5 +sw $t6, -68($fp) +lw $t7, -32($fp) +# Moving local_a2i_aux_A2I_internal_15 to local_a2i_aux_A2I_internal_6 +move $t7, $t6 +sw $t7, -32($fp) +sw $t0, -60($fp) +sw $t1, -44($fp) +sw $t2, -40($fp) +sw $t3, -8($fp) +sw $t4, -28($fp) +sw $t5, -64($fp) +sw $t6, -68($fp) +sw $t7, -32($fp) +j start__475 +end__475: +lw $t0, -8($fp) +lw $t1, -72($fp) +# Moving local_a2i_aux_A2I_int_0 to local_a2i_aux_A2I_internal_16 +move $t1, $t0 +sw $t1, -72($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -72($fp) +# Removing all locals from stack +addiu $sp, $sp, 76 +jr $ra + + +function_i2a_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_i2a_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_A2I_internal_12 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_i2a_A2I_internal_0 <- i = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_i2a_A2I_internal_0 goto true__520 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__520 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_i2a_A2I_internal_2 <- 0 < i +li $t9, 0 +slt $t1, $t9, $t0 +# If local_i2a_A2I_internal_2 goto true__524 +sw $t0, -0($fp) +sw $t1, -16($fp) +bnez $t1, true__524 +lw $t0, -24($fp) +# Saves in local_i2a_A2I_internal_4 data_24 +la $t0, data_24 +lw $t1, -32($fp) +li $t9, 1 +# local_i2a_A2I_internal_6 <- ~1 +not $t1, $t9 +addi $t1, $t1, 1 +lw $t2, -0($fp) +lw $t3, -28($fp) +# local_i2a_A2I_internal_5 <- i * local_i2a_A2I_internal_6 +mult $t2, $t1 +mflo $t3 +lw $t4, -4($fp) +lw $t5, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_aux_A2I +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -32($fp) +sw $t2, -0($fp) +sw $t3, -28($fp) +sw $t4, -4($fp) +sw $t5, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +lw $t2, -44($fp) +# local_i2a_A2I_internal_9 <- Type of local_i2a_A2I_internal_4 +la $t2, type_String +lw $t3, -48($fp) +# Saves in local_i2a_A2I_internal_10 data_0 +la $t3, data_0 +# local_i2a_A2I_internal_9 <- local_i2a_A2I_internal_9 = local_i2a_A2I_internal_10 +move $t8, $t2 +move $t9, $t3 +loop_27: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_27 +beqz $a1, mismatch_27 +seq $v0, $a0, $a1 +beqz $v0, mismatch_27 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_27 +mismatch_27: +li $v0, 0 +j end_27 +check_27: +bnez $a1, mismatch_27 +li $v0, 1 +end_27: +move $t2, $v0 +# If not local_i2a_A2I_internal_9 goto continue__540 +sw $t0, -36($fp) +sw $t1, -24($fp) +sw $t2, -44($fp) +sw $t3, -48($fp) +beqz $t2, continue__540 +la $a0, dispatch_error +j .raise +continue__540: +lw $t0, -40($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -36($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -36($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_i2a_A2I_internal_8 to local_i2a_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -40($fp) +sw $t1, -20($fp) +j end__524 +true__524: +lw $t0, -4($fp) +lw $t1, -52($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_aux_A2I +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -52($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_i2a_A2I_internal_11 to local_i2a_A2I_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -52($fp) +sw $t1, -20($fp) +end__524: +lw $t0, -20($fp) +lw $t1, -12($fp) +# Moving local_i2a_A2I_internal_3 to local_i2a_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -20($fp) +sw $t1, -12($fp) +j end__520 +true__520: +lw $t0, -56($fp) +# Saves in local_i2a_A2I_internal_12 data_25 +la $t0, data_25 +lw $t1, -12($fp) +# Moving local_i2a_A2I_internal_12 to local_i2a_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -56($fp) +sw $t1, -12($fp) +end__520: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_i2a_aux_A2I: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_i2a_aux_A2I_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_next_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_i2a_aux_A2I_internal_11 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_i2a_aux_A2I_internal_0 <- i = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_i2a_aux_A2I_internal_0 goto true__573 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__573 +lw $t0, -0($fp) +lw $t1, -20($fp) +# local_i2a_aux_A2I_internal_3 <- i / 10 +li $t9, 10 +la $a0, zero_error +beqz $t9, .raise +div $t0, $t9 +mflo $t1 +lw $t2, -16($fp) +# Moving local_i2a_aux_A2I_internal_3 to local_i2a_aux_A2I_next_2 +move $t2, $t1 +sw $t2, -16($fp) +lw $t3, -4($fp) +lw $t4, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_aux_A2I +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -20($fp) +sw $t2, -16($fp) +sw $t3, -4($fp) +sw $t4, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +lw $t2, -32($fp) +# local_i2a_aux_A2I_internal_6 <- local_i2a_aux_A2I_next_2 * 10 +li $t9, 10 +mult $t1, $t9 +mflo $t2 +lw $t3, -0($fp) +lw $t4, -28($fp) +# local_i2a_aux_A2I_internal_5 <- i - local_i2a_aux_A2I_internal_6 +sub $t4, $t3, $t2 +lw $t5, -4($fp) +lw $t6, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t5) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2c_A2I +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t5, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -16($fp) +sw $t2, -32($fp) +sw $t3, -0($fp) +sw $t4, -28($fp) +sw $t5, -4($fp) +sw $t6, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +lw $t2, -44($fp) +# local_i2a_aux_A2I_internal_9 <- Type of local_i2a_aux_A2I_internal_4 +la $t2, type_String +lw $t3, -48($fp) +# Saves in local_i2a_aux_A2I_internal_10 data_0 +la $t3, data_0 +# local_i2a_aux_A2I_internal_9 <- local_i2a_aux_A2I_internal_9 = local_i2a_aux_A2I_internal_10 +move $t8, $t2 +move $t9, $t3 +loop_28: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_28 +beqz $a1, mismatch_28 +seq $v0, $a0, $a1 +beqz $v0, mismatch_28 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_28 +mismatch_28: +li $v0, 0 +j end_28 +check_28: +bnez $a1, mismatch_28 +li $v0, 1 +end_28: +move $t2, $v0 +# If not local_i2a_aux_A2I_internal_9 goto continue__594 +sw $t0, -36($fp) +sw $t1, -24($fp) +sw $t2, -44($fp) +sw $t3, -48($fp) +beqz $t2, continue__594 +la $a0, dispatch_error +j .raise +continue__594: +lw $t0, -40($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -36($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -36($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_i2a_aux_A2I_internal_8 to local_i2a_aux_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -40($fp) +sw $t1, -12($fp) +j end__573 +true__573: +lw $t0, -52($fp) +# Saves in local_i2a_aux_A2I_internal_11 data_26 +la $t0, data_26 +lw $t1, -12($fp) +# Moving local_i2a_aux_A2I_internal_11 to local_i2a_aux_A2I_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -52($fp) +sw $t1, -12($fp) +end__573: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 56 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_a_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_b_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A2I +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +lw $t1, -12($fp) +# Saves in local_main_Main_internal_2 data_27 +la $t1, data_27 +lw $t2, -20($fp) +# local_main_Main_internal_4 <- Type of local_main_Main_internal_1 +lw $t2, 0($t0) +lw $t3, -24($fp) +# Saves in local_main_Main_internal_5 data_0 +la $t3, data_0 +# local_main_Main_internal_4 <- local_main_Main_internal_4 = local_main_Main_internal_5 +move $t8, $t2 +move $t9, $t3 +loop_29: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_29 +beqz $a1, mismatch_29 +seq $v0, $a0, $a1 +beqz $v0, mismatch_29 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_29 +mismatch_29: +li $v0, 0 +j end_29 +check_29: +bnez $a1, mismatch_29 +li $v0, 1 +end_29: +move $t2, $v0 +# If not local_main_Main_internal_4 goto continue__624 +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -20($fp) +sw $t3, -24($fp) +beqz $t2, continue__624 +la $a0, dispatch_error +j .raise +continue__624: +lw $t0, -8($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_a2i_A2I +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -12($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_main_Main_internal_3 to local_main_Main_a_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A2I +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +lw $t3, -40($fp) +# local_main_Main_internal_9 <- Type of local_main_Main_internal_7 +lw $t3, 0($t2) +lw $t4, -44($fp) +# Saves in local_main_Main_internal_10 data_0 +la $t4, data_0 +# local_main_Main_internal_9 <- local_main_Main_internal_9 = local_main_Main_internal_10 +move $t8, $t3 +move $t9, $t4 +loop_30: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_30 +beqz $a1, mismatch_30 +seq $v0, $a0, $a1 +beqz $v0, mismatch_30 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_30 +mismatch_30: +li $v0, 0 +j end_30 +check_30: +bnez $a1, mismatch_30 +li $v0, 1 +end_30: +move $t3, $v0 +# If not local_main_Main_internal_9 goto continue__641 +sw $t0, -16($fp) +sw $t1, -4($fp) +sw $t2, -32($fp) +sw $t3, -40($fp) +sw $t4, -44($fp) +beqz $t3, continue__641 +la $a0, dispatch_error +j .raise +continue__641: +lw $t0, -32($fp) +lw $t1, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_i2a_A2I +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 678987 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# Moving local_main_Main_internal_8 to local_main_Main_b_6 +move $t1, $t0 +sw $t1, -28($fp) +lw $t2, -0($fp) +lw $t3, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t4, -4($fp) +sw $t4, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -28($fp) +sw $t2, -0($fp) +sw $t3, -48($fp) +sw $t4, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Saves in local_main_Main_internal_12 data_28 +la $t1, data_28 +lw $t2, -0($fp) +lw $t3, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -0($fp) +sw $t3, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t3, -28($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Saves in local_main_Main_internal_15 data_29 +la $t1, data_29 +lw $t2, -0($fp) +lw $t3, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -60($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +sw $t3, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Moving local_main_Main_internal_16 to local_main_Main_internal_17 +move $t1, $t0 +sw $t1, -72($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +# Removing all locals from stack +addiu $sp, $sp, 76 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A2I: .asciiz "A2I" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "0" +data_2: .asciiz "1" +data_3: .asciiz "2" +data_4: .asciiz "3" +data_5: .asciiz "4" +data_6: .asciiz "5" +data_7: .asciiz "6" +data_8: .asciiz "7" +data_9: .asciiz "8" +data_10: .asciiz "9" +data_11: .asciiz "" +data_12: .asciiz "9" +data_13: .asciiz "8" +data_14: .asciiz "7" +data_15: .asciiz "6" +data_16: .asciiz "5" +data_17: .asciiz "4" +data_18: .asciiz "3" +data_19: .asciiz "2" +data_20: .asciiz "1" +data_21: .asciiz "0" +data_22: .asciiz "-" +data_23: .asciiz "+" +data_24: .asciiz "-" +data_25: .asciiz "0" +data_26: .asciiz "" +data_27: .asciiz "678987" +data_28: .asciiz " == " +data_29: .asciiz " +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/book_list.cl b/tests/codegen/book_list.cl old mode 100755 new mode 100644 index 025ea169..d39f86bb --- a/tests/codegen/book_list.cl +++ b/tests/codegen/book_list.cl @@ -1,132 +1,132 @@ --- example of static and dynamic type differing for a dispatch - -Class Book inherits IO { - title : String; - author : String; - - initBook(title_p : String, author_p : String) : Book { - { - title <- title_p; - author <- author_p; - self; - } - }; - - print() : Book { - { - out_string("title: ").out_string(title).out_string("\n"); - out_string("author: ").out_string(author).out_string("\n"); - self; - } - }; -}; - -Class Article inherits Book { - per_title : String; - - initArticle(title_p : String, author_p : String, - per_title_p : String) : Article { - { - initBook(title_p, author_p); - per_title <- per_title_p; - self; - } - }; - - print() : Book { - { - self@Book.print(); - out_string("periodical: ").out_string(per_title).out_string("\n"); - self; - } - }; -}; - -Class BookList inherits IO { - (* Since abort "returns" type Object, we have to add - an expression of type Bool here to satisfy the typechecker. - This code is unreachable, since abort() halts the program. - *) - isNil() : Bool { { abort(); true; } }; - - cons(hd : Book) : Cons { - (let new_cell : Cons <- new Cons in - new_cell.init(hd,self) - ) - }; - - (* Since abort "returns" type Object, we have to add - an expression of type Book here to satisfy the typechecker. - This code is unreachable, since abort() halts the program. - *) - car() : Book { { abort(); new Book; } }; - - (* Since abort "returns" type Object, we have to add - an expression of type BookList here to satisfy the typechecker. - This code is unreachable, since abort() halts the program. - *) - cdr() : BookList { { abort(); new BookList; } }; - - print_list() : Object { abort() }; -}; - -Class Cons inherits BookList { - xcar : Book; -- We keep the car and cdr in attributes. - xcdr : BookList; -- Because methods and features must have different names, - -- we use xcar and xcdr for the attributes and reserve - -- car and cdr for the features. - - isNil() : Bool { false }; - - init(hd : Book, tl : BookList) : Cons { - { - xcar <- hd; - xcdr <- tl; - self; - } - }; - - car() : Book { xcar }; - - cdr() : BookList { xcdr }; - - print_list() : Object { - { - case xcar.print() of - dummy : Book => out_string("- dynamic type was Book -\n"); - dummy : Article => out_string("- dynamic type was Article -\n"); - esac; - xcdr.print_list(); - } - }; -}; - -Class Nil inherits BookList { - isNil() : Bool { true }; - - print_list() : Object { true }; -}; - - -Class Main { - - books : BookList; - - main() : Object { - (let a_book : Book <- - (new Book).initBook("Compilers, Principles, Techniques, and Tools", - "Aho, Sethi, and Ullman") - in - (let an_article : Article <- - (new Article).initArticle("The Top 100 CD_ROMs", - "Ulanoff", - "PC Magazine") - in - { - books <- (new Nil).cons(a_book).cons(an_article); - books.print_list(); - } - ) -- end let an_article - ) -- end let a_book - }; -}; +-- example of static and dynamic type differing for a dispatch + +Class Book inherits IO { + title : String; + author : String; + + initBook(title_p : String, author_p : String) : Book { + { + title <- title_p; + author <- author_p; + self; + } + }; + + print() : Book { + { + out_string("title: ").out_string(title).out_string("\n"); + out_string("author: ").out_string(author).out_string("\n"); + self; + } + }; +}; + +Class Article inherits Book { + per_title : String; + + initArticle(title_p : String, author_p : String, + per_title_p : String) : Article { + { + initBook(title_p, author_p); + per_title <- per_title_p; + self; + } + }; + + print() : Book { + { + self@Book.print(); + out_string("periodical: ").out_string(per_title).out_string("\n"); + self; + } + }; +}; + +Class BookList inherits IO { + (* Since abort "returns" type Object, we have to add + an expression of type Bool here to satisfy the typechecker. + This code is unreachable, since abort() halts the program. + *) + isNil() : Bool { { abort(); true; } }; + + cons(hd : Book) : Cons { + (let new_cell : Cons <- new Cons in + new_cell.init(hd,self) + ) + }; + + (* Since abort "returns" type Object, we have to add + an expression of type Book here to satisfy the typechecker. + This code is unreachable, since abort() halts the program. + *) + car() : Book { { abort(); new Book; } }; + + (* Since abort "returns" type Object, we have to add + an expression of type BookList here to satisfy the typechecker. + This code is unreachable, since abort() halts the program. + *) + cdr() : BookList { { abort(); new BookList; } }; + + print_list() : Object { abort() }; +}; + +Class Cons inherits BookList { + xcar : Book; -- We keep the car and cdr in attributes. + xcdr : BookList; -- Because methods and features must have different names, + -- we use xcar and xcdr for the attributes and reserve + -- car and cdr for the features. + + isNil() : Bool { false }; + + init(hd : Book, tl : BookList) : Cons { + { + xcar <- hd; + xcdr <- tl; + self; + } + }; + + car() : Book { xcar }; + + cdr() : BookList { xcdr }; + + print_list() : Object { + { + case xcar.print() of + dummy : Book => out_string("- dynamic type was Book -\n"); + dummy : Article => out_string("- dynamic type was Article -\n"); + esac; + xcdr.print_list(); + } + }; +}; + +Class Nil inherits BookList { + isNil() : Bool { true }; + + print_list() : Object { true }; +}; + + +Class Main { + + books : BookList; + + main() : Object { + (let a_book : Book <- + (new Book).initBook("Compilers, Principles, Techniques, and Tools", + "Aho, Sethi, and Ullman") + in + (let an_article : Article <- + (new Article).initArticle("The Top 100 CD_ROMs", + "Ulanoff", + "PC Magazine") + in + { + books <- (new Nil).cons(a_book).cons(an_article); + books.print_list(); + } + ) -- end let an_article + ) -- end let a_book + }; +}; diff --git a/tests/codegen/book_list.mips b/tests/codegen/book_list.mips new file mode 100644 index 00000000..d1badb70 --- /dev/null +++ b/tests/codegen/book_list.mips @@ -0,0 +1,3924 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Book_Book +sw $t9, 80($v0) +la $t9, function_initBook_Book +sw $t9, 84($v0) +la $t9, function_print_Book +sw $t9, 88($v0) +la $t9, function_Article_Article +sw $t9, 92($v0) +la $t9, function_initArticle_Article +sw $t9, 96($v0) +la $t9, function_print_Article +sw $t9, 100($v0) +la $t9, function_isNil_BookList +sw $t9, 104($v0) +la $t9, function_cons_BookList +sw $t9, 108($v0) +la $t9, function_car_BookList +sw $t9, 112($v0) +la $t9, function_cdr_BookList +sw $t9, 116($v0) +la $t9, function_print_list_BookList +sw $t9, 120($v0) +la $t9, function_Cons_Cons +sw $t9, 124($v0) +la $t9, function_isNil_Cons +sw $t9, 128($v0) +la $t9, function_init_Cons +sw $t9, 132($v0) +la $t9, function_car_Cons +sw $t9, 136($v0) +la $t9, function_cdr_Cons +sw $t9, 140($v0) +la $t9, function_print_list_Cons +sw $t9, 144($v0) +la $t9, function_isNil_Nil +sw $t9, 148($v0) +la $t9, function_print_list_Nil +sw $t9, 152($v0) +la $t9, function_Main_Main +sw $t9, 156($v0) +la $t9, function_main_Main +sw $t9, 160($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Book +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_initBook_Book in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_print_Book in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Book_Book in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Article +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 52 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_initBook_Book in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_print_Article in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Book_Book in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_initArticle_Article in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_Article_Article in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_BookList +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 52 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_isNil_BookList in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_cons_BookList in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_car_BookList in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_cdr_BookList in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_print_list_BookList in a0 +lw $a0, 120($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Cons +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 60 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_isNil_Cons in a0 +lw $a0, 128($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_cons_BookList in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_car_Cons in a0 +lw $a0, 136($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_cdr_Cons in a0 +lw $a0, 140($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_print_list_Cons in a0 +lw $a0, 144($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_init_Cons in a0 +lw $a0, 132($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_Cons_Cons in a0 +lw $a0, 124($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Nil +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 36($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 52 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_isNil_Nil in a0 +lw $a0, 148($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_cons_BookList in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_car_BookList in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_cdr_BookList in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_print_list_Nil in a0 +lw $a0, 152($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 40($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 24 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 160($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 156($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 28($t9) +sw $t8, 4($v0) +lw $v0, 36($t9) +lw $t8, 28($t9) +sw $t8, 4($v0) +lw $v0, 40($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 40($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Book_Book: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Book_Book_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Book_Book_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Book_Book_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_Book_Book_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +# self . title <- SET local_Book_Book_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Saves in local_Book_Book_internal_1 data_2 +la $t2, data_2 +# self . author <- SET local_Book_Book_internal_1 +sw $t2, 16($t1) +lw $t3, -12($fp) +# Moving self to local_Book_Book_internal_2 +move $t3, $t1 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_initBook_Book: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value title_p +addiu $fp, $fp, 4 +# Pops the register with the param value author_p +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_initBook_Book_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# self . title <- SET title_p +sw $t0, 12($t1) +lw $t2, -0($fp) +# self . author <- SET author_p +sw $t2, 16($t1) +lw $t3, -12($fp) +# Moving self to local_initBook_Book_internal_0 +move $t3, $t1 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_print_Book: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_Book_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_title_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_author_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Book_internal_20 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_print_Book_internal_0 data_3 +la $t0, data_3 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -12($fp) +# local_print_Book_title_2 <- GET self . title +lw $t2, 12($t1) +lw $t3, -20($fp) +# local_print_Book_internal_4 <- Type of local_print_Book_internal_1 +lw $t3, 0($t0) +lw $t4, -24($fp) +# Saves in local_print_Book_internal_5 data_0 +la $t4, data_0 +# local_print_Book_internal_4 <- local_print_Book_internal_4 = local_print_Book_internal_5 +move $t8, $t3 +move $t9, $t4 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t3, $v0 +# If not local_print_Book_internal_4 goto continue__83 +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -20($fp) +sw $t4, -24($fp) +beqz $t3, continue__83 +la $a0, dispatch_error +j .raise +continue__83: +lw $t0, -8($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -12($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# Saves in local_print_Book_internal_6 data_4 +la $t1, data_4 +lw $t2, -36($fp) +# local_print_Book_internal_8 <- Type of local_print_Book_internal_3 +lw $t2, 0($t0) +lw $t3, -40($fp) +# Saves in local_print_Book_internal_9 data_0 +la $t3, data_0 +# local_print_Book_internal_8 <- local_print_Book_internal_8 = local_print_Book_internal_9 +move $t8, $t2 +move $t9, $t3 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t2, $v0 +# If not local_print_Book_internal_8 goto continue__99 +sw $t0, -16($fp) +sw $t1, -28($fp) +sw $t2, -36($fp) +sw $t3, -40($fp) +beqz $t2, continue__99 +la $a0, dispatch_error +j .raise +continue__99: +lw $t0, -16($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -32($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_print_Book_internal_10 data_5 +la $t1, data_5 +lw $t2, -0($fp) +lw $t3, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -44($fp) +sw $t2, -0($fp) +sw $t3, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -52($fp) +# local_print_Book_author_12 <- GET self . author +lw $t2, 16($t1) +lw $t3, -60($fp) +# local_print_Book_internal_14 <- Type of local_print_Book_internal_11 +lw $t3, 0($t0) +lw $t4, -64($fp) +# Saves in local_print_Book_internal_15 data_0 +la $t4, data_0 +# local_print_Book_internal_14 <- local_print_Book_internal_14 = local_print_Book_internal_15 +move $t8, $t3 +move $t9, $t4 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t3, $v0 +# If not local_print_Book_internal_14 goto continue__121 +sw $t0, -48($fp) +sw $t1, -0($fp) +sw $t2, -52($fp) +sw $t3, -60($fp) +sw $t4, -64($fp) +beqz $t3, continue__121 +la $a0, dispatch_error +j .raise +continue__121: +lw $t0, -48($fp) +lw $t1, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -52($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -56($fp) +sw $t2, -52($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Saves in local_print_Book_internal_16 data_6 +la $t1, data_6 +lw $t2, -76($fp) +# local_print_Book_internal_18 <- Type of local_print_Book_internal_13 +lw $t2, 0($t0) +lw $t3, -80($fp) +# Saves in local_print_Book_internal_19 data_0 +la $t3, data_0 +# local_print_Book_internal_18 <- local_print_Book_internal_18 = local_print_Book_internal_19 +move $t8, $t2 +move $t9, $t3 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If not local_print_Book_internal_18 goto continue__137 +sw $t0, -56($fp) +sw $t1, -68($fp) +sw $t2, -76($fp) +sw $t3, -80($fp) +beqz $t2, continue__137 +la $a0, dispatch_error +j .raise +continue__137: +lw $t0, -56($fp) +lw $t1, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -72($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -84($fp) +# Moving self to local_print_Book_internal_20 +move $t2, $t1 +sw $t2, -84($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -72($fp) +sw $t1, -0($fp) +sw $t2, -84($fp) +# Removing all locals from stack +addiu $sp, $sp, 88 +jr $ra + + +function_Article_Article: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Article_Article_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Article_Article_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Article_Article_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Article_Article_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_Article_Article_internal_0 data_7 +la $t0, data_7 +lw $t1, -0($fp) +# self . title <- SET local_Article_Article_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Saves in local_Article_Article_internal_1 data_8 +la $t2, data_8 +# self . author <- SET local_Article_Article_internal_1 +sw $t2, 16($t1) +lw $t3, -12($fp) +# Saves in local_Article_Article_internal_2 data_9 +la $t3, data_9 +# self . per_title <- SET local_Article_Article_internal_2 +sw $t3, 20($t1) +lw $t4, -16($fp) +# Moving self to local_Article_Article_internal_3 +move $t4, $t1 +sw $t4, -16($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +sw $t4, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 20 +jr $ra + + +function_initArticle_Article: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value title_p +addiu $fp, $fp, 4 +# Pops the register with the param value author_p +addiu $fp, $fp, 4 +# Pops the register with the param value per_title_p +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_initArticle_Article_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_initArticle_Article_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_initBook_Book +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -8($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -12($fp) +# self . per_title <- SET per_title_p +sw $t1, 20($t2) +lw $t3, -20($fp) +# Moving self to local_initArticle_Article_internal_1 +move $t3, $t2 +sw $t3, -20($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_print_Article: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_Article_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_per_title_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Article_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_print_Article_internal_1 <- Type of self +lw $t1, 0($t0) +lw $t2, -12($fp) +# Saves in local_print_Article_internal_2 data_0 +la $t2, data_0 +# local_print_Article_internal_1 <- local_print_Article_internal_1 = local_print_Article_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t1, $v0 +# If not local_print_Article_internal_1 goto continue__185 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +beqz $t1, continue__185 +la $a0, dispatch_error +j .raise +continue__185: +lw $t0, -4($fp) +# Static Dispatch of the method print +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_print_Book +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Saves in local_print_Article_internal_3 data_10 +la $t1, data_10 +lw $t2, -0($fp) +lw $t3, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -16($fp) +sw $t2, -0($fp) +sw $t3, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -24($fp) +# local_print_Article_per_title_5 <- GET self . per_title +lw $t2, 20($t1) +lw $t3, -32($fp) +# local_print_Article_internal_7 <- Type of local_print_Article_internal_4 +lw $t3, 0($t0) +lw $t4, -36($fp) +# Saves in local_print_Article_internal_8 data_0 +la $t4, data_0 +# local_print_Article_internal_7 <- local_print_Article_internal_7 = local_print_Article_internal_8 +move $t8, $t3 +move $t9, $t4 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t3, $v0 +# If not local_print_Article_internal_7 goto continue__207 +sw $t0, -20($fp) +sw $t1, -0($fp) +sw $t2, -24($fp) +sw $t3, -32($fp) +sw $t4, -36($fp) +beqz $t3, continue__207 +la $a0, dispatch_error +j .raise +continue__207: +lw $t0, -20($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -28($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Saves in local_print_Article_internal_9 data_11 +la $t1, data_11 +lw $t2, -48($fp) +# local_print_Article_internal_11 <- Type of local_print_Article_internal_6 +lw $t2, 0($t0) +lw $t3, -52($fp) +# Saves in local_print_Article_internal_12 data_0 +la $t3, data_0 +# local_print_Article_internal_11 <- local_print_Article_internal_11 = local_print_Article_internal_12 +move $t8, $t2 +move $t9, $t3 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t2, $v0 +# If not local_print_Article_internal_11 goto continue__223 +sw $t0, -28($fp) +sw $t1, -40($fp) +sw $t2, -48($fp) +sw $t3, -52($fp) +beqz $t2, continue__223 +la $a0, dispatch_error +j .raise +continue__223: +lw $t0, -28($fp) +lw $t1, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -40($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -44($fp) +sw $t2, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -56($fp) +# Moving self to local_print_Article_internal_13 +move $t2, $t1 +sw $t2, -56($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -0($fp) +sw $t2, -56($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_isNil_BookList: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_BookList_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_isNil_BookList_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving 1 to local_isNil_BookList_internal_1 +li $t1, 1 +sw $t1, -8($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_cons_BookList: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value hd +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cons_BookList_new_cell_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_BookList_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_BookList_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_BookList_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_BookList_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_cons_BookList_internal_1 to local_cons_BookList_new_cell_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -20($fp) +# local_cons_BookList_internal_3 <- Type of local_cons_BookList_new_cell_0 +lw $t2, 0($t1) +lw $t3, -24($fp) +# Saves in local_cons_BookList_internal_4 data_0 +la $t3, data_0 +# local_cons_BookList_internal_3 <- local_cons_BookList_internal_3 = local_cons_BookList_internal_4 +move $t8, $t2 +move $t9, $t3 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t2, $v0 +# If not local_cons_BookList_internal_3 goto continue__256 +sw $t0, -12($fp) +sw $t1, -8($fp) +sw $t2, -20($fp) +sw $t3, -24($fp) +beqz $t2, continue__256 +la $a0, dispatch_error +j .raise +continue__256: +lw $t0, -8($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -0($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 28 +jr $ra + + +function_car_BookList: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_car_BookList_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_car_BookList_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_car_BookList_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Book +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t1) +# Static Dispatch of the method Book +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal function_Book_Book +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_car_BookList_internal_1 to local_car_BookList_internal_2 +move $t1, $t0 +sw $t1, -12($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_cdr_BookList: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cdr_BookList_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cdr_BookList_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cdr_BookList_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_BookList +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -12($fp) +# Moving local_cdr_BookList_internal_1 to local_cdr_BookList_internal_2 +move $t2, $t1 +sw $t2, -12($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_print_list_BookList: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_list_BookList_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_Cons_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Cons_Cons_xcar_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Cons_Cons_xcdr_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Cons_Cons_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t0, $v0 +lw $t1, -0($fp) +# self . xcar <- SET local_Cons_Cons_xcar_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t2, $v0 +# self . xcdr <- SET local_Cons_Cons_xcdr_1 +sw $t2, 16($t1) +lw $t3, -12($fp) +# Moving self to local_Cons_Cons_internal_2 +move $t3, $t1 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_isNil_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_isNil_Cons_internal_0 +li $t0, 0 +sw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_init_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value hd +addiu $fp, $fp, 4 +# Pops the register with the param value tl +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_init_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# self . xcar <- SET hd +sw $t0, 12($t1) +lw $t2, -0($fp) +# self . xcdr <- SET tl +sw $t2, 16($t1) +lw $t3, -12($fp) +# Moving self to local_init_Cons_internal_0 +move $t3, $t1 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_car_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_car_Cons_xcar_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_car_Cons_xcar_0 <- GET self . xcar +lw $t1, 12($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_cdr_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cdr_Cons_xcdr_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_cdr_Cons_xcdr_0 <- GET self . xcdr +lw $t1, 16($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_print_list_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_list_Cons_xcar_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_dummy_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_dummy_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_xcdr_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_19 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_print_list_Cons_xcar_0 <- GET self . xcar +lw $t1, 12($t0) +lw $t2, -12($fp) +# local_print_list_Cons_internal_2 <- Type of local_print_list_Cons_xcar_0 +lw $t2, 0($t1) +lw $t3, -16($fp) +# Saves in local_print_list_Cons_internal_3 data_0 +la $t3, data_0 +# local_print_list_Cons_internal_2 <- local_print_list_Cons_internal_2 = local_print_list_Cons_internal_3 +move $t8, $t2 +move $t9, $t3 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t2, $v0 +# If not local_print_list_Cons_internal_2 goto continue__335 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +beqz $t2, continue__335 +la $a0, dispatch_error +j .raise +continue__335: +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_Book +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_print_list_Cons_internal_5 <- Type of local_print_list_Cons_internal_1 +lw $t1, 0($t0) +lw $t2, -28($fp) +# Saves in local_print_list_Cons_internal_6 data_0 +la $t2, data_0 +# local_print_list_Cons_internal_5 <- local_print_list_Cons_internal_5 = local_print_list_Cons_internal_6 +move $t8, $t1 +move $t9, $t2 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t1, $v0 +# If local_print_list_Cons_internal_5 goto error__346 +sw $t0, -8($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +bnez $t1, error__346 +lw $t0, -8($fp) +lw $t1, -32($fp) +la $t9, type_Article +lw $v0, 8($t0) +loop_16: +move $t8, $v0 +beqz $t8, false_16 +lw $v1, 0($t8) +beq $t9, $v1, true_16 +lw $v0, 4($t8) +j loop_16 +true_16: +li $t1, 1 +j end_16 +false_16: +li $t1, 0 +end_16: +# If not local_print_list_Cons_internal_7 goto next__352_0 +sw $t0, -8($fp) +sw $t1, -32($fp) +beqz $t1, next__352_0 +lw $t0, -8($fp) +lw $t1, -36($fp) +# Moving local_print_list_Cons_internal_1 to local_print_list_Cons_dummy_8 +move $t1, $t0 +sw $t1, -36($fp) +lw $t2, -40($fp) +# Saves in local_print_list_Cons_internal_9 data_12 +la $t2, data_12 +lw $t3, -0($fp) +lw $t4, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -36($fp) +sw $t2, -40($fp) +sw $t3, -0($fp) +sw $t4, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_print_list_Cons_internal_10 to local_print_list_Cons_internal_4 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -44($fp) +sw $t1, -20($fp) +j end__346 +next__352_0: +lw $t0, -8($fp) +lw $t1, -48($fp) +la $t9, type_Book +lw $v0, 8($t0) +loop_17: +move $t8, $v0 +beqz $t8, false_17 +lw $v1, 0($t8) +beq $t9, $v1, true_17 +lw $v0, 4($t8) +j loop_17 +true_17: +li $t1, 1 +j end_17 +false_17: +li $t1, 0 +end_17: +# If not local_print_list_Cons_internal_11 goto next__367_1 +sw $t0, -8($fp) +sw $t1, -48($fp) +beqz $t1, next__367_1 +lw $t0, -8($fp) +lw $t1, -52($fp) +# Moving local_print_list_Cons_internal_1 to local_print_list_Cons_dummy_12 +move $t1, $t0 +sw $t1, -52($fp) +lw $t2, -56($fp) +# Saves in local_print_list_Cons_internal_13 data_13 +la $t2, data_13 +lw $t3, -0($fp) +lw $t4, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +sw $t3, -0($fp) +sw $t4, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_print_list_Cons_internal_14 to local_print_list_Cons_internal_4 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -60($fp) +sw $t1, -20($fp) +j end__346 +next__367_1: +la $a0, case_error +j .raise +error__346: +la $a0, case_void_error +j .raise +end__346: +lw $t0, -0($fp) +lw $t1, -64($fp) +# local_print_list_Cons_xcdr_15 <- GET self . xcdr +lw $t1, 16($t0) +lw $t2, -72($fp) +# local_print_list_Cons_internal_17 <- Type of local_print_list_Cons_xcdr_15 +lw $t2, 0($t1) +lw $t3, -76($fp) +# Saves in local_print_list_Cons_internal_18 data_0 +la $t3, data_0 +# local_print_list_Cons_internal_17 <- local_print_list_Cons_internal_17 = local_print_list_Cons_internal_18 +move $t8, $t2 +move $t9, $t3 +loop_18: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_18 +beqz $a1, mismatch_18 +seq $v0, $a0, $a1 +beqz $v0, mismatch_18 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_18 +mismatch_18: +li $v0, 0 +j end_18 +check_18: +bnez $a1, mismatch_18 +li $v0, 1 +end_18: +move $t2, $v0 +# If not local_print_list_Cons_internal_17 goto continue__390 +sw $t0, -0($fp) +sw $t1, -64($fp) +sw $t2, -72($fp) +sw $t3, -76($fp) +beqz $t2, continue__390 +la $a0, dispatch_error +j .raise +continue__390: +lw $t0, -64($fp) +lw $t1, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_list_BookList +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -64($fp) +sw $t1, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Moving local_print_list_Cons_internal_16 to local_print_list_Cons_internal_19 +move $t1, $t0 +sw $t1, -80($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -80($fp) +# Removing all locals from stack +addiu $sp, $sp, 84 +jr $ra + + +function_isNil_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_Nil_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 1 to local_isNil_Nil_internal_0 +li $t0, 1 +sw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_print_list_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_list_Nil_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 1 to local_print_list_Nil_internal_0 +li $t0, 1 +sw $t0, -4($fp) +# Initialize new node +li $a0, 12 +li $v0, 9 +syscall +la $t9, type_Bool +sw $t9, 0($v0) +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Saving the methods of object +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t0) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_books_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t0, $v0 +lw $t1, -0($fp) +# self . books <- SET local_Main_Main_books_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_Main_Main_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_a_book_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_an_article_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_books_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_26 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Book +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Book +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# This function will consume the arguments +jal function_Book_Book +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Saves in local_main_Main_internal_2 data_14 +la $t1, data_14 +lw $t2, -16($fp) +# Saves in local_main_Main_internal_3 data_15 +la $t2, data_15 +lw $t3, -24($fp) +# local_main_Main_internal_5 <- Type of local_main_Main_internal_1 +lw $t3, 0($t0) +lw $t4, -28($fp) +# Saves in local_main_Main_internal_6 data_0 +la $t4, data_0 +# local_main_Main_internal_5 <- local_main_Main_internal_5 = local_main_Main_internal_6 +move $t8, $t3 +move $t9, $t4 +loop_19: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_19 +beqz $a1, mismatch_19 +seq $v0, $a0, $a1 +beqz $v0, mismatch_19 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_19 +mismatch_19: +li $v0, 0 +j end_19 +check_19: +bnez $a1, mismatch_19 +li $v0, 1 +end_19: +move $t3, $v0 +# If not local_main_Main_internal_5 goto continue__438 +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +beqz $t3, continue__438 +la $a0, dispatch_error +j .raise +continue__438: +lw $t0, -8($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_initBook_Book +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -16($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -12($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -20($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_main_Main_internal_4 to local_main_Main_a_book_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -36($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 24 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Article +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 24 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Article +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -4($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_Article_Article +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Saves in local_main_Main_internal_9 data_16 +la $t1, data_16 +lw $t2, -44($fp) +# Saves in local_main_Main_internal_10 data_17 +la $t2, data_17 +lw $t3, -48($fp) +# Saves in local_main_Main_internal_11 data_18 +la $t3, data_18 +lw $t4, -56($fp) +# local_main_Main_internal_13 <- Type of local_main_Main_internal_8 +lw $t4, 0($t0) +lw $t5, -60($fp) +# Saves in local_main_Main_internal_14 data_0 +la $t5, data_0 +# local_main_Main_internal_13 <- local_main_Main_internal_13 = local_main_Main_internal_14 +move $t8, $t4 +move $t9, $t5 +loop_20: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_20 +beqz $a1, mismatch_20 +seq $v0, $a0, $a1 +beqz $v0, mismatch_20 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_20 +mismatch_20: +li $v0, 0 +j end_20 +check_20: +bnez $a1, mismatch_20 +li $v0, 1 +end_20: +move $t4, $v0 +# If not local_main_Main_internal_13 goto continue__467 +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +sw $t3, -48($fp) +sw $t4, -56($fp) +sw $t5, -60($fp) +beqz $t4, continue__467 +la $a0, dispatch_error +j .raise +continue__467: +lw $t0, -36($fp) +lw $t1, -52($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_initArticle_Article +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -48($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -44($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t4, -40($fp) +sw $t4, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -52($fp) +sw $t2, -48($fp) +sw $t3, -44($fp) +sw $t4, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_main_Main_internal_12 to local_main_Main_an_article_7 +move $t1, $t0 +sw $t1, -32($fp) +lw $t2, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Nil +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t2) +lw $t3, -72($fp) +# local_main_Main_internal_17 <- Type of local_main_Main_internal_15 +lw $t3, 0($t2) +lw $t4, -76($fp) +# Saves in local_main_Main_internal_18 data_0 +la $t4, data_0 +# local_main_Main_internal_17 <- local_main_Main_internal_17 = local_main_Main_internal_18 +move $t8, $t3 +move $t9, $t4 +loop_21: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_21 +beqz $a1, mismatch_21 +seq $v0, $a0, $a1 +beqz $v0, mismatch_21 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_21 +mismatch_21: +li $v0, 0 +j end_21 +check_21: +bnez $a1, mismatch_21 +li $v0, 1 +end_21: +move $t3, $v0 +# If not local_main_Main_internal_17 goto continue__483 +sw $t0, -52($fp) +sw $t1, -32($fp) +sw $t2, -64($fp) +sw $t3, -72($fp) +sw $t4, -76($fp) +beqz $t3, continue__483 +la $a0, dispatch_error +j .raise +continue__483: +lw $t0, -64($fp) +lw $t1, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cons_BookList +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -64($fp) +sw $t1, -68($fp) +sw $t2, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -84($fp) +# local_main_Main_internal_20 <- Type of local_main_Main_internal_16 +lw $t1, 0($t0) +lw $t2, -88($fp) +# Saves in local_main_Main_internal_21 data_0 +la $t2, data_0 +# local_main_Main_internal_20 <- local_main_Main_internal_20 = local_main_Main_internal_21 +move $t8, $t1 +move $t9, $t2 +loop_22: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_22 +beqz $a1, mismatch_22 +seq $v0, $a0, $a1 +beqz $v0, mismatch_22 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_22 +mismatch_22: +li $v0, 0 +j end_22 +check_22: +bnez $a1, mismatch_22 +li $v0, 1 +end_22: +move $t1, $v0 +# If not local_main_Main_internal_20 goto continue__496 +sw $t0, -68($fp) +sw $t1, -84($fp) +sw $t2, -88($fp) +beqz $t1, continue__496 +la $a0, dispatch_error +j .raise +continue__496: +lw $t0, -68($fp) +lw $t1, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cons_BookList +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -32($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -80($fp) +sw $t2, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . books <- SET local_main_Main_internal_19 +sw $t0, 12($t1) +lw $t2, -92($fp) +# local_main_Main_books_22 <- GET self . books +lw $t2, 12($t1) +lw $t3, -100($fp) +# local_main_Main_internal_24 <- Type of local_main_Main_books_22 +lw $t3, 0($t2) +lw $t4, -104($fp) +# Saves in local_main_Main_internal_25 data_0 +la $t4, data_0 +# local_main_Main_internal_24 <- local_main_Main_internal_24 = local_main_Main_internal_25 +move $t8, $t3 +move $t9, $t4 +loop_23: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_23 +beqz $a1, mismatch_23 +seq $v0, $a0, $a1 +beqz $v0, mismatch_23 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_23 +mismatch_23: +li $v0, 0 +j end_23 +check_23: +bnez $a1, mismatch_23 +li $v0, 1 +end_23: +move $t3, $v0 +# If not local_main_Main_internal_24 goto continue__511 +sw $t0, -80($fp) +sw $t1, -0($fp) +sw $t2, -92($fp) +sw $t3, -100($fp) +sw $t4, -104($fp) +beqz $t3, continue__511 +la $a0, dispatch_error +j .raise +continue__511: +lw $t0, -92($fp) +lw $t1, -96($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_list_BookList +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -108($fp) +# Moving local_main_Main_internal_23 to local_main_Main_internal_26 +move $t1, $t0 +sw $t1, -108($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -108($fp) +# Removing all locals from stack +addiu $sp, $sp, 112 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Book: .asciiz "Book" +type_Article: .asciiz "Article" +type_BookList: .asciiz "BookList" +type_Cons: .asciiz "Cons" +type_Nil: .asciiz "Nil" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "" +data_2: .asciiz "" +data_3: .asciiz "title: " +data_4: .asciiz " +" +data_5: .asciiz "author: " +data_6: .asciiz " +" +data_7: .asciiz "" +data_8: .asciiz "" +data_9: .asciiz "" +data_10: .asciiz "periodical: " +data_11: .asciiz " +" +data_12: .asciiz "- dynamic type was Article - +" +data_13: .asciiz "- dynamic type was Book - +" +data_14: .asciiz "Compilers, Principles, Techniques, and Tools" +data_15: .asciiz "Aho, Sethi, and Ullman" +data_16: .asciiz "The Top 100 CD_ROMs" +data_17: .asciiz "Ulanoff" +data_18: .asciiz "PC Magazine" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/cells.cl b/tests/codegen/cells.cl old mode 100755 new mode 100644 index 9fd6741b..bcd89149 --- a/tests/codegen/cells.cl +++ b/tests/codegen/cells.cl @@ -1,97 +1,97 @@ -(* models one-dimensional cellular automaton on a circle of finite radius - arrays are faked as Strings, - X's respresent live cells, dots represent dead cells, - no error checking is done *) -class CellularAutomaton inherits IO { - population_map : String; - - init(map : String) : CellularAutomaton { - { - population_map <- map; - self; - } - }; - - print() : CellularAutomaton { - { - out_string(population_map.concat("\n")); - self; - } - }; - - num_cells() : Int { - population_map.length() - }; - - cell(position : Int) : String { - population_map.substr(position, 1) - }; - - cell_left_neighbor(position : Int) : String { - if position = 0 then - cell(num_cells() - 1) - else - cell(position - 1) - fi - }; - - cell_right_neighbor(position : Int) : String { - if position = num_cells() - 1 then - cell(0) - else - cell(position + 1) - fi - }; - - (* a cell will live if exactly 1 of itself and it's immediate - neighbors are alive *) - cell_at_next_evolution(position : Int) : String { - if (if cell(position) = "X" then 1 else 0 fi - + if cell_left_neighbor(position) = "X" then 1 else 0 fi - + if cell_right_neighbor(position) = "X" then 1 else 0 fi - = 1) - then - "X" - else - "." - fi - }; - - evolve() : CellularAutomaton { - (let position : Int in - (let num : Int <- num_cells() in - (let temp : String in - { - while position < num loop - { - temp <- temp.concat(cell_at_next_evolution(position)); - position <- position + 1; - } - pool; - population_map <- temp; - self; - } - ) ) ) - }; -}; - -class Main { - cells : CellularAutomaton; - - main() : Main { - { - cells <- (new CellularAutomaton).init(" X "); - cells.print(); - (let countdown : Int <- 20 in - while 0 < countdown loop - { - cells.evolve(); - cells.print(); - countdown <- countdown - 1; - } - pool - ); - self; - } - }; -}; +(* models one-dimensional cellular automaton on a circle of finite radius + arrays are faked as Strings, + X's respresent live cells, dots represent dead cells, + no error checking is done *) +class CellularAutomaton inherits IO { + population_map : String; + + init(map : String) : CellularAutomaton { + { + population_map <- map; + self; + } + }; + + print() : CellularAutomaton { + { + out_string(population_map.concat("\n")); + self; + } + }; + + num_cells() : Int { + population_map.length() + }; + + cell(position : Int) : String { + population_map.substr(position, 1) + }; + + cell_left_neighbor(position : Int) : String { + if position = 0 then + cell(num_cells() - 1) + else + cell(position - 1) + fi + }; + + cell_right_neighbor(position : Int) : String { + if position = num_cells() - 1 then + cell(0) + else + cell(position + 1) + fi + }; + + (* a cell will live if exactly 1 of itself and it's immediate + neighbors are alive *) + cell_at_next_evolution(position : Int) : String { + if (if cell(position) = "X" then 1 else 0 fi + + if cell_left_neighbor(position) = "X" then 1 else 0 fi + + if cell_right_neighbor(position) = "X" then 1 else 0 fi + = 1) + then + "X" + else + "." + fi + }; + + evolve() : CellularAutomaton { + (let position : Int in + (let num : Int <- num_cells() in + (let temp : String in + { + while position < num loop + { + temp <- temp.concat(cell_at_next_evolution(position)); + position <- position + 1; + } + pool; + population_map <- temp; + self; + } + ) ) ) + }; +}; + +class Main { + cells : CellularAutomaton; + + main() : Main { + { + cells <- (new CellularAutomaton).init(" X "); + cells.print(); + (let countdown : Int <- 20 in + while 0 < countdown loop + { + cells.evolve(); + cells.print(); + countdown <- countdown - 1; + } + pool + ); + self; + } + }; +}; diff --git a/tests/codegen/cells.mips b/tests/codegen/cells.mips new file mode 100644 index 00000000..9f107aa3 --- /dev/null +++ b/tests/codegen/cells.mips @@ -0,0 +1,2866 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_CellularAutomaton_CellularAutomaton +sw $t9, 80($v0) +la $t9, function_init_CellularAutomaton +sw $t9, 84($v0) +la $t9, function_print_CellularAutomaton +sw $t9, 88($v0) +la $t9, function_num_cells_CellularAutomaton +sw $t9, 92($v0) +la $t9, function_cell_CellularAutomaton +sw $t9, 96($v0) +la $t9, function_cell_left_neighbor_CellularAutomaton +sw $t9, 100($v0) +la $t9, function_cell_right_neighbor_CellularAutomaton +sw $t9, 104($v0) +la $t9, function_cell_at_next_evolution_CellularAutomaton +sw $t9, 108($v0) +la $t9, function_evolve_CellularAutomaton +sw $t9, 112($v0) +la $t9, function_Main_Main +sw $t9, 116($v0) +la $t9, function_main_Main +sw $t9, 120($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_CellularAutomaton +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 68 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_init_CellularAutomaton in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_print_CellularAutomaton in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_num_cells_CellularAutomaton in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_cell_CellularAutomaton in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_cell_left_neighbor_CellularAutomaton in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_cell_right_neighbor_CellularAutomaton in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_cell_at_next_evolution_CellularAutomaton in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_evolve_CellularAutomaton in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_CellularAutomaton_CellularAutomaton in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 24 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 120($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_CellularAutomaton_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_CellularAutomaton_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_CellularAutomaton_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_CellularAutomaton_CellularAutomaton_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +# self . population_map <- SET local_CellularAutomaton_CellularAutomaton_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_CellularAutomaton_CellularAutomaton_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_init_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value map +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_init_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# self . population_map <- SET map +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_init_CellularAutomaton_internal_0 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_print_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_CellularAutomaton_population_map_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_print_CellularAutomaton_population_map_0 <- GET self . population_map +lw $t1, 12($t0) +lw $t2, -8($fp) +# Saves in local_print_CellularAutomaton_internal_1 data_2 +la $t2, data_2 +lw $t3, -16($fp) +# local_print_CellularAutomaton_internal_3 <- Type of local_print_CellularAutomaton_population_map_0 +la $t3, type_String +lw $t4, -20($fp) +# Saves in local_print_CellularAutomaton_internal_4 data_0 +la $t4, data_0 +# local_print_CellularAutomaton_internal_3 <- local_print_CellularAutomaton_internal_3 = local_print_CellularAutomaton_internal_4 +move $t8, $t3 +move $t9, $t4 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t3, $v0 +# If not local_print_CellularAutomaton_internal_3 goto continue__74 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +sw $t3, -16($fp) +sw $t4, -20($fp) +beqz $t3, continue__74 +la $a0, dispatch_error +j .raise +continue__74: +lw $t0, -12($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -8($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -8($fp) +sw $t2, -4($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -28($fp) +# Moving self to local_print_CellularAutomaton_internal_6 +move $t2, $t1 +sw $t2, -28($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -0($fp) +sw $t2, -28($fp) +# Removing all locals from stack +addiu $sp, $sp, 32 +jr $ra + + +function_num_cells_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_num_cells_CellularAutomaton_population_map_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_num_cells_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_num_cells_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_num_cells_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_num_cells_CellularAutomaton_population_map_0 <- GET self . population_map +lw $t1, 12($t0) +lw $t2, -12($fp) +# local_num_cells_CellularAutomaton_internal_2 <- Type of local_num_cells_CellularAutomaton_population_map_0 +la $t2, type_String +lw $t3, -16($fp) +# Saves in local_num_cells_CellularAutomaton_internal_3 data_0 +la $t3, data_0 +# local_num_cells_CellularAutomaton_internal_2 <- local_num_cells_CellularAutomaton_internal_2 = local_num_cells_CellularAutomaton_internal_3 +move $t8, $t2 +move $t9, $t3 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t2, $v0 +# If not local_num_cells_CellularAutomaton_internal_2 goto continue__96 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +beqz $t2, continue__96 +la $a0, dispatch_error +j .raise +continue__96: +lw $t0, -8($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -4($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 20 +jr $ra + + +function_cell_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cell_CellularAutomaton_population_map_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# local_cell_CellularAutomaton_population_map_0 <- GET self . population_map +lw $t1, 12($t0) +lw $t2, -16($fp) +# local_cell_CellularAutomaton_internal_2 <- Type of local_cell_CellularAutomaton_population_map_0 +la $t2, type_String +lw $t3, -20($fp) +# Saves in local_cell_CellularAutomaton_internal_3 data_0 +la $t3, data_0 +# local_cell_CellularAutomaton_internal_2 <- local_cell_CellularAutomaton_internal_2 = local_cell_CellularAutomaton_internal_3 +move $t8, $t2 +move $t9, $t3 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t2, $v0 +# If not local_cell_CellularAutomaton_internal_2 goto continue__116 +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -20($fp) +beqz $t2, continue__116 +la $a0, dispatch_error +j .raise +continue__116: +lw $t0, -12($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_cell_left_neighbor_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cell_left_neighbor_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_left_neighbor_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_left_neighbor_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_left_neighbor_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_left_neighbor_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_left_neighbor_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_left_neighbor_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_cell_left_neighbor_CellularAutomaton_internal_0 <- position = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_cell_left_neighbor_CellularAutomaton_internal_0 goto true__132 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__132 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_cell_left_neighbor_CellularAutomaton_internal_2 <- position - 1 +addi $t1, $t0, -1 +lw $t2, -4($fp) +lw $t3, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_cell_left_neighbor_CellularAutomaton_internal_3 to local_cell_left_neighbor_CellularAutomaton_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -20($fp) +sw $t1, -12($fp) +j end__132 +true__132: +lw $t0, -4($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_num_cells_CellularAutomaton +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_cell_left_neighbor_CellularAutomaton_internal_4 <- local_cell_left_neighbor_CellularAutomaton_internal_5 - 1 +addi $t1, $t0, -1 +lw $t2, -4($fp) +lw $t3, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -24($fp) +sw $t2, -4($fp) +sw $t3, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_cell_left_neighbor_CellularAutomaton_internal_6 to local_cell_left_neighbor_CellularAutomaton_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -32($fp) +sw $t1, -12($fp) +end__132: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_cell_right_neighbor_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cell_right_neighbor_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_right_neighbor_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_right_neighbor_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_right_neighbor_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_right_neighbor_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_right_neighbor_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_right_neighbor_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_num_cells_CellularAutomaton +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# local_cell_right_neighbor_CellularAutomaton_internal_1 <- local_cell_right_neighbor_CellularAutomaton_internal_2 - 1 +addi $t1, $t0, -1 +lw $t2, -0($fp) +lw $t3, -8($fp) +# local_cell_right_neighbor_CellularAutomaton_internal_0 <- position = local_cell_right_neighbor_CellularAutomaton_internal_1 +seq $t3, $t2, $t1 +# If local_cell_right_neighbor_CellularAutomaton_internal_0 goto true__165 +sw $t0, -16($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +sw $t3, -8($fp) +bnez $t3, true__165 +lw $t0, -0($fp) +lw $t1, -24($fp) +# local_cell_right_neighbor_CellularAutomaton_internal_4 <- position + 1 +addi $t1, $t0, 1 +lw $t2, -4($fp) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -24($fp) +sw $t2, -4($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_cell_right_neighbor_CellularAutomaton_internal_5 to local_cell_right_neighbor_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -28($fp) +sw $t1, -20($fp) +j end__165 +true__165: +lw $t0, -4($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 0 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_cell_right_neighbor_CellularAutomaton_internal_6 to local_cell_right_neighbor_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -32($fp) +sw $t1, -20($fp) +end__165: +lw $t0, -20($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_cell_at_next_evolution_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_17 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -24($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_5 data_3 +la $t1, data_3 +lw $t2, -20($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_3 <- local_cell_at_next_evolution_CellularAutomaton_internal_4 = local_cell_at_next_evolution_CellularAutomaton_internal_5 +move $t8, $t0 +move $t9, $t1 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If local_cell_at_next_evolution_CellularAutomaton_internal_3 goto true__198 +sw $t0, -24($fp) +sw $t1, -28($fp) +sw $t2, -20($fp) +bnez $t2, true__198 +lw $t0, -32($fp) +# Moving 0 to local_cell_at_next_evolution_CellularAutomaton_internal_6 +li $t0, 0 +sw $t0, -32($fp) +sw $t0, -32($fp) +j end__198 +true__198: +lw $t0, -32($fp) +# Moving 1 to local_cell_at_next_evolution_CellularAutomaton_internal_6 +li $t0, 1 +sw $t0, -32($fp) +sw $t0, -32($fp) +end__198: +lw $t0, -4($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_left_neighbor_CellularAutomaton +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -40($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_9 data_4 +la $t1, data_4 +lw $t2, -36($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_7 <- local_cell_at_next_evolution_CellularAutomaton_internal_8 = local_cell_at_next_evolution_CellularAutomaton_internal_9 +move $t8, $t0 +move $t9, $t1 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t2, $v0 +# If local_cell_at_next_evolution_CellularAutomaton_internal_7 goto true__214 +sw $t0, -40($fp) +sw $t1, -44($fp) +sw $t2, -36($fp) +bnez $t2, true__214 +lw $t0, -48($fp) +# Moving 0 to local_cell_at_next_evolution_CellularAutomaton_internal_10 +li $t0, 0 +sw $t0, -48($fp) +sw $t0, -48($fp) +j end__214 +true__214: +lw $t0, -48($fp) +# Moving 1 to local_cell_at_next_evolution_CellularAutomaton_internal_10 +li $t0, 1 +sw $t0, -48($fp) +sw $t0, -48($fp) +end__214: +lw $t0, -32($fp) +lw $t1, -48($fp) +lw $t2, -16($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_2 <- local_cell_at_next_evolution_CellularAutomaton_internal_6 + local_cell_at_next_evolution_CellularAutomaton_internal_10 +add $t2, $t0, $t1 +lw $t3, -4($fp) +lw $t4, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_right_neighbor_CellularAutomaton +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t5, -0($fp) +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -48($fp) +sw $t2, -16($fp) +sw $t3, -4($fp) +sw $t4, -56($fp) +sw $t5, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -60($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_13 data_5 +la $t1, data_5 +lw $t2, -52($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_11 <- local_cell_at_next_evolution_CellularAutomaton_internal_12 = local_cell_at_next_evolution_CellularAutomaton_internal_13 +move $t8, $t0 +move $t9, $t1 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t2, $v0 +# If local_cell_at_next_evolution_CellularAutomaton_internal_11 goto true__231 +sw $t0, -56($fp) +sw $t1, -60($fp) +sw $t2, -52($fp) +bnez $t2, true__231 +lw $t0, -64($fp) +# Moving 0 to local_cell_at_next_evolution_CellularAutomaton_internal_14 +li $t0, 0 +sw $t0, -64($fp) +sw $t0, -64($fp) +j end__231 +true__231: +lw $t0, -64($fp) +# Moving 1 to local_cell_at_next_evolution_CellularAutomaton_internal_14 +li $t0, 1 +sw $t0, -64($fp) +sw $t0, -64($fp) +end__231: +lw $t0, -16($fp) +lw $t1, -64($fp) +lw $t2, -12($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_1 <- local_cell_at_next_evolution_CellularAutomaton_internal_2 + local_cell_at_next_evolution_CellularAutomaton_internal_14 +add $t2, $t0, $t1 +lw $t3, -8($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_0 <- local_cell_at_next_evolution_CellularAutomaton_internal_1 = 1 +li $t9, 1 +seq $t3, $t2, $t9 +# If local_cell_at_next_evolution_CellularAutomaton_internal_0 goto true__240 +sw $t0, -16($fp) +sw $t1, -64($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +bnez $t3, true__240 +lw $t0, -72($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_16 data_6 +la $t0, data_6 +lw $t1, -68($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_16 to local_cell_at_next_evolution_CellularAutomaton_internal_15 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -72($fp) +sw $t1, -68($fp) +j end__240 +true__240: +lw $t0, -76($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_17 data_7 +la $t0, data_7 +lw $t1, -68($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_17 to local_cell_at_next_evolution_CellularAutomaton_internal_15 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -76($fp) +sw $t1, -68($fp) +end__240: +lw $t0, -68($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +# Removing all locals from stack +addiu $sp, $sp, 80 +jr $ra + + +function_evolve_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_evolve_CellularAutomaton_position_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_num_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_temp_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_evolve_CellularAutomaton_position_0 +li $t0, 0 +sw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_num_cells_CellularAutomaton +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_evolve_CellularAutomaton_internal_2 to local_evolve_CellularAutomaton_num_1 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -20($fp) +# Saves in local_evolve_CellularAutomaton_internal_4 data_8 +la $t2, data_8 +lw $t3, -16($fp) +# Moving local_evolve_CellularAutomaton_internal_4 to local_evolve_CellularAutomaton_temp_3 +move $t3, $t2 +sw $t3, -16($fp) +lw $t4, -24($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t4, $v0 +sw $t0, -12($fp) +sw $t1, -8($fp) +sw $t2, -20($fp) +sw $t3, -16($fp) +sw $t4, -24($fp) +start__268: +lw $t0, -4($fp) +lw $t1, -8($fp) +lw $t2, -28($fp) +# local_evolve_CellularAutomaton_internal_6 <- local_evolve_CellularAutomaton_position_0 < local_evolve_CellularAutomaton_num_1 +slt $t2, $t0, $t1 +# If not local_evolve_CellularAutomaton_internal_6 goto end__268 +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -28($fp) +beqz $t2, end__268 +lw $t0, -0($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_at_next_evolution_CellularAutomaton +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -32($fp) +sw $t2, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +lw $t2, -40($fp) +# local_evolve_CellularAutomaton_internal_9 <- Type of local_evolve_CellularAutomaton_temp_3 +la $t2, type_String +lw $t3, -44($fp) +# Saves in local_evolve_CellularAutomaton_internal_10 data_0 +la $t3, data_0 +# local_evolve_CellularAutomaton_internal_9 <- local_evolve_CellularAutomaton_internal_9 = local_evolve_CellularAutomaton_internal_10 +move $t8, $t2 +move $t9, $t3 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t2, $v0 +# If not local_evolve_CellularAutomaton_internal_9 goto continue__281 +sw $t0, -32($fp) +sw $t1, -16($fp) +sw $t2, -40($fp) +sw $t3, -44($fp) +beqz $t2, continue__281 +la $a0, dispatch_error +j .raise +continue__281: +lw $t0, -36($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -32($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -16($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -32($fp) +sw $t2, -16($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Moving local_evolve_CellularAutomaton_internal_8 to local_evolve_CellularAutomaton_temp_3 +move $t1, $t0 +sw $t1, -16($fp) +lw $t2, -4($fp) +lw $t3, -48($fp) +# local_evolve_CellularAutomaton_internal_11 <- local_evolve_CellularAutomaton_position_0 + 1 +addi $t3, $t2, 1 +# Moving local_evolve_CellularAutomaton_internal_11 to local_evolve_CellularAutomaton_position_0 +move $t2, $t3 +sw $t2, -4($fp) +lw $t4, -52($fp) +# Moving local_evolve_CellularAutomaton_internal_11 to local_evolve_CellularAutomaton_internal_12 +move $t4, $t3 +sw $t4, -52($fp) +lw $t5, -24($fp) +# Moving local_evolve_CellularAutomaton_internal_12 to local_evolve_CellularAutomaton_internal_5 +move $t5, $t4 +sw $t5, -24($fp) +sw $t0, -36($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -48($fp) +sw $t4, -52($fp) +sw $t5, -24($fp) +j start__268 +end__268: +lw $t0, -16($fp) +lw $t1, -0($fp) +# self . population_map <- SET local_evolve_CellularAutomaton_temp_3 +sw $t0, 12($t1) +lw $t2, -56($fp) +# Moving self to local_evolve_CellularAutomaton_internal_13 +move $t2, $t1 +sw $t2, -56($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -56($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_cells_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t0, $v0 +lw $t1, -0($fp) +# self . cells <- SET local_Main_Main_cells_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_Main_Main_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_cells_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_countdown_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_cells_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_cells_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_CellularAutomaton +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method CellularAutomaton +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# This function will consume the arguments +jal function_CellularAutomaton_CellularAutomaton +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Saves in local_main_Main_internal_1 data_9 +la $t1, data_9 +lw $t2, -16($fp) +# local_main_Main_internal_3 <- Type of local_main_Main_internal_0 +lw $t2, 0($t0) +lw $t3, -20($fp) +# Saves in local_main_Main_internal_4 data_0 +la $t3, data_0 +# local_main_Main_internal_3 <- local_main_Main_internal_3 = local_main_Main_internal_4 +move $t8, $t2 +move $t9, $t3 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t2, $v0 +# If not local_main_Main_internal_3 goto continue__323 +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -20($fp) +beqz $t2, continue__323 +la $a0, dispatch_error +j .raise +continue__323: +lw $t0, -4($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_CellularAutomaton +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . cells <- SET local_main_Main_internal_2 +sw $t0, 12($t1) +lw $t2, -24($fp) +# local_main_Main_cells_5 <- GET self . cells +lw $t2, 12($t1) +lw $t3, -32($fp) +# local_main_Main_internal_7 <- Type of local_main_Main_cells_5 +lw $t3, 0($t2) +lw $t4, -36($fp) +# Saves in local_main_Main_internal_8 data_0 +la $t4, data_0 +# local_main_Main_internal_7 <- local_main_Main_internal_7 = local_main_Main_internal_8 +move $t8, $t3 +move $t9, $t4 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t3, $v0 +# If not local_main_Main_internal_7 goto continue__338 +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -24($fp) +sw $t3, -32($fp) +sw $t4, -36($fp) +beqz $t3, continue__338 +la $a0, dispatch_error +j .raise +continue__338: +lw $t0, -24($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_CellularAutomaton +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Moving 20 to local_main_Main_countdown_9 +li $t1, 20 +sw $t1, -40($fp) +lw $t2, -44($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t2, $v0 +sw $t0, -28($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +start__350: +lw $t0, -40($fp) +lw $t1, -48($fp) +# local_main_Main_internal_11 <- 0 < local_main_Main_countdown_9 +li $t9, 0 +slt $t1, $t9, $t0 +# If not local_main_Main_internal_11 goto end__350 +sw $t0, -40($fp) +sw $t1, -48($fp) +beqz $t1, end__350 +lw $t0, -0($fp) +lw $t1, -52($fp) +# local_main_Main_cells_12 <- GET self . cells +lw $t1, 12($t0) +lw $t2, -60($fp) +# local_main_Main_internal_14 <- Type of local_main_Main_cells_12 +lw $t2, 0($t1) +lw $t3, -64($fp) +# Saves in local_main_Main_internal_15 data_0 +la $t3, data_0 +# local_main_Main_internal_14 <- local_main_Main_internal_14 = local_main_Main_internal_15 +move $t8, $t2 +move $t9, $t3 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t2, $v0 +# If not local_main_Main_internal_14 goto continue__360 +sw $t0, -0($fp) +sw $t1, -52($fp) +sw $t2, -60($fp) +sw $t3, -64($fp) +beqz $t2, continue__360 +la $a0, dispatch_error +j .raise +continue__360: +lw $t0, -52($fp) +lw $t1, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_evolve_CellularAutomaton +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -68($fp) +# local_main_Main_cells_16 <- GET self . cells +lw $t2, 12($t1) +lw $t3, -76($fp) +# local_main_Main_internal_18 <- Type of local_main_Main_cells_16 +lw $t3, 0($t2) +lw $t4, -80($fp) +# Saves in local_main_Main_internal_19 data_0 +la $t4, data_0 +# local_main_Main_internal_18 <- local_main_Main_internal_18 = local_main_Main_internal_19 +move $t8, $t3 +move $t9, $t4 +loop_16: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_16 +beqz $a1, mismatch_16 +seq $v0, $a0, $a1 +beqz $v0, mismatch_16 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_16 +mismatch_16: +li $v0, 0 +j end_16 +check_16: +bnez $a1, mismatch_16 +li $v0, 1 +end_16: +move $t3, $v0 +# If not local_main_Main_internal_18 goto continue__374 +sw $t0, -56($fp) +sw $t1, -0($fp) +sw $t2, -68($fp) +sw $t3, -76($fp) +sw $t4, -80($fp) +beqz $t3, continue__374 +la $a0, dispatch_error +j .raise +continue__374: +lw $t0, -68($fp) +lw $t1, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_CellularAutomaton +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +lw $t2, -84($fp) +# local_main_Main_internal_20 <- local_main_Main_countdown_9 - 1 +addi $t2, $t1, -1 +# Moving local_main_Main_internal_20 to local_main_Main_countdown_9 +move $t1, $t2 +sw $t1, -40($fp) +lw $t3, -88($fp) +# Moving local_main_Main_internal_20 to local_main_Main_internal_21 +move $t3, $t2 +sw $t3, -88($fp) +lw $t4, -44($fp) +# Moving local_main_Main_internal_21 to local_main_Main_internal_10 +move $t4, $t3 +sw $t4, -44($fp) +sw $t0, -72($fp) +sw $t1, -40($fp) +sw $t2, -84($fp) +sw $t3, -88($fp) +sw $t4, -44($fp) +j start__350 +end__350: +lw $t0, -0($fp) +lw $t1, -92($fp) +# Moving self to local_main_Main_internal_22 +move $t1, $t0 +sw $t1, -92($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -92($fp) +# Removing all locals from stack +addiu $sp, $sp, 96 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_CellularAutomaton: .asciiz "CellularAutomaton" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "" +data_2: .asciiz " +" +data_3: .asciiz "X" +data_4: .asciiz "X" +data_5: .asciiz "X" +data_6: .asciiz "." +data_7: .asciiz "X" +data_8: .asciiz "" +data_9: .asciiz " X " +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/complex.cl b/tests/codegen/complex.cl old mode 100755 new mode 100644 index 0b7aa44e..9edb6151 --- a/tests/codegen/complex.cl +++ b/tests/codegen/complex.cl @@ -1,52 +1,52 @@ -class Main inherits IO { - main() : IO { - (let c : Complex <- (new Complex).init(1, 1) in - if c.reflect_X().reflect_Y() = c.reflect_0() - then out_string("=)\n") - else out_string("=(\n") - fi - ) - }; -}; - -class Complex inherits IO { - x : Int; - y : Int; - - init(a : Int, b : Int) : Complex { - { - x = a; - y = b; - self; - } - }; - - print() : Object { - if y = 0 - then out_int(x) - else out_int(x).out_string("+").out_int(y).out_string("I") - fi - }; - - reflect_0() : Complex { - { - x = ~x; - y = ~y; - self; - } - }; - - reflect_X() : Complex { - { - y = ~y; - self; - } - }; - - reflect_Y() : Complex { - { - x = ~x; - self; - } - }; -}; +class Main inherits IO { + main() : IO { + (let c : Complex <- (new Complex).init(1, 1) in + if c.reflect_X().reflect_Y() = c.reflect_0() + then out_string("=)\n") + else out_string("=(\n") + fi + ) + }; +}; + +class Complex inherits IO { + x : Int; + y : Int; + + init(a : Int, b : Int) : Complex { + { + x = a; + y = b; + self; + } + }; + + print() : Object { + if y = 0 + then out_int(x) + else out_int(x).out_string("+").out_int(y).out_string("I") + fi + }; + + reflect_0() : Complex { + { + x = ~x; + y = ~y; + self; + } + }; + + reflect_X() : Complex { + { + y = ~y; + self; + } + }; + + reflect_Y() : Complex { + { + x = ~x; + self; + } + }; +}; diff --git a/tests/codegen/complex.mips b/tests/codegen/complex.mips new file mode 100644 index 00000000..e52447ff --- /dev/null +++ b/tests/codegen/complex.mips @@ -0,0 +1,2158 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_main_Main +sw $t9, 80($v0) +la $t9, function_Complex_Complex +sw $t9, 84($v0) +la $t9, function_init_Complex +sw $t9, 88($v0) +la $t9, function_print_Complex +sw $t9, 92($v0) +la $t9, function_reflect_0_Complex +sw $t9, 96($v0) +la $t9, function_reflect_X_Complex +sw $t9, 100($v0) +la $t9, function_reflect_Y_Complex +sw $t9, 104($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 36 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Complex +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 56 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_init_Complex in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_print_Complex in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_reflect_0_Complex in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_reflect_X_Complex in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_reflect_Y_Complex in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_Complex_Complex in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_c_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Complex +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Complex +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# This function will consume the arguments +jal function_Complex_Complex +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# local_main_Main_internal_3 <- Type of local_main_Main_internal_1 +lw $t1, 0($t0) +lw $t2, -20($fp) +# Saves in local_main_Main_internal_4 data_0 +la $t2, data_0 +# local_main_Main_internal_3 <- local_main_Main_internal_3 = local_main_Main_internal_4 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_main_Main_internal_3 goto continue__56 +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +beqz $t1, continue__56 +la $a0, dispatch_error +j .raise +continue__56: +lw $t0, -8($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Complex +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_main_Main_internal_2 to local_main_Main_c_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -32($fp) +# local_main_Main_internal_7 <- Type of local_main_Main_c_0 +lw $t2, 0($t1) +lw $t3, -36($fp) +# Saves in local_main_Main_internal_8 data_0 +la $t3, data_0 +# local_main_Main_internal_7 <- local_main_Main_internal_7 = local_main_Main_internal_8 +move $t8, $t2 +move $t9, $t3 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t2, $v0 +# If not local_main_Main_internal_7 goto continue__70 +sw $t0, -12($fp) +sw $t1, -4($fp) +sw $t2, -32($fp) +sw $t3, -36($fp) +beqz $t2, continue__70 +la $a0, dispatch_error +j .raise +continue__70: +lw $t0, -4($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_X_Complex +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# local_main_Main_internal_10 <- Type of local_main_Main_internal_6 +lw $t1, 0($t0) +lw $t2, -48($fp) +# Saves in local_main_Main_internal_11 data_0 +la $t2, data_0 +# local_main_Main_internal_10 <- local_main_Main_internal_10 = local_main_Main_internal_11 +move $t8, $t1 +move $t9, $t2 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t1, $v0 +# If not local_main_Main_internal_10 goto continue__82 +sw $t0, -28($fp) +sw $t1, -44($fp) +sw $t2, -48($fp) +beqz $t1, continue__82 +la $a0, dispatch_error +j .raise +continue__82: +lw $t0, -28($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_Y_Complex +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -56($fp) +# local_main_Main_internal_13 <- Type of local_main_Main_c_0 +lw $t2, 0($t1) +lw $t3, -60($fp) +# Saves in local_main_Main_internal_14 data_0 +la $t3, data_0 +# local_main_Main_internal_13 <- local_main_Main_internal_13 = local_main_Main_internal_14 +move $t8, $t2 +move $t9, $t3 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If not local_main_Main_internal_13 goto continue__94 +sw $t0, -40($fp) +sw $t1, -4($fp) +sw $t2, -56($fp) +sw $t3, -60($fp) +beqz $t2, continue__94 +la $a0, dispatch_error +j .raise +continue__94: +lw $t0, -4($fp) +lw $t1, -52($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_0_Complex +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -52($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +lw $t2, -24($fp) +# local_main_Main_internal_5 <- local_main_Main_internal_9 = local_main_Main_internal_12 +seq $t2, $t1, $t0 +# If local_main_Main_internal_5 goto true__105 +sw $t0, -52($fp) +sw $t1, -40($fp) +sw $t2, -24($fp) +bnez $t2, true__105 +lw $t0, -68($fp) +# Saves in local_main_Main_internal_16 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -0($fp) +sw $t2, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Moving local_main_Main_internal_17 to local_main_Main_internal_15 +move $t1, $t0 +sw $t1, -64($fp) +sw $t0, -72($fp) +sw $t1, -64($fp) +j end__105 +true__105: +lw $t0, -76($fp) +# Saves in local_main_Main_internal_18 data_2 +la $t0, data_2 +lw $t1, -0($fp) +lw $t2, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -0($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Moving local_main_Main_internal_19 to local_main_Main_internal_15 +move $t1, $t0 +sw $t1, -64($fp) +sw $t0, -80($fp) +sw $t1, -64($fp) +end__105: +lw $t0, -64($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -64($fp) +# Removing all locals from stack +addiu $sp, $sp, 84 +jr $ra + + +function_Complex_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Complex_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . x <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +# self . y <- SET 0 +li $t9, 0 +sw $t9, 16($t0) +lw $t1, -4($fp) +# Moving self to local_Complex_Complex_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_init_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value a +addiu $fp, $fp, 4 +# Pops the register with the param value b +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_init_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_x_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_y_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +lw $t1, -16($fp) +# local_init_Complex_x_1 <- GET self . x +lw $t1, 12($t0) +lw $t2, -4($fp) +lw $t3, -12($fp) +# local_init_Complex_internal_0 <- local_init_Complex_x_1 = a +seq $t3, $t1, $t2 +lw $t4, -24($fp) +# local_init_Complex_y_3 <- GET self . y +lw $t4, 16($t0) +lw $t5, -0($fp) +lw $t6, -20($fp) +# local_init_Complex_internal_2 <- local_init_Complex_y_3 = b +seq $t6, $t4, $t5 +lw $t7, -28($fp) +# Moving self to local_init_Complex_internal_4 +move $t7, $t0 +sw $t7, -28($fp) +move $v0, $t7 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -12($fp) +sw $t4, -24($fp) +sw $t5, -0($fp) +sw $t6, -20($fp) +sw $t7, -28($fp) +# Removing all locals from stack +addiu $sp, $sp, 32 +jr $ra + + +function_print_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_y_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_x_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_y_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_x_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_18 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_print_Complex_y_1 <- GET self . y +lw $t1, 16($t0) +lw $t2, -4($fp) +# local_print_Complex_internal_0 <- local_print_Complex_y_1 = 0 +li $t9, 0 +seq $t2, $t1, $t9 +# If local_print_Complex_internal_0 goto true__155 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -4($fp) +bnez $t2, true__155 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_print_Complex_x_3 <- GET self . x +lw $t1, 12($t0) +lw $t2, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Saves in local_print_Complex_internal_5 data_3 +la $t1, data_3 +lw $t2, -32($fp) +# local_print_Complex_internal_7 <- Type of local_print_Complex_internal_4 +lw $t2, 0($t0) +lw $t3, -36($fp) +# Saves in local_print_Complex_internal_8 data_0 +la $t3, data_0 +# local_print_Complex_internal_7 <- local_print_Complex_internal_7 = local_print_Complex_internal_8 +move $t8, $t2 +move $t9, $t3 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t2, $v0 +# If not local_print_Complex_internal_7 goto continue__169 +sw $t0, -20($fp) +sw $t1, -24($fp) +sw $t2, -32($fp) +sw $t3, -36($fp) +beqz $t2, continue__169 +la $a0, dispatch_error +j .raise +continue__169: +lw $t0, -20($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -28($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -40($fp) +# local_print_Complex_y_9 <- GET self . y +lw $t2, 16($t1) +lw $t3, -48($fp) +# local_print_Complex_internal_11 <- Type of local_print_Complex_internal_6 +lw $t3, 0($t0) +lw $t4, -52($fp) +# Saves in local_print_Complex_internal_12 data_0 +la $t4, data_0 +# local_print_Complex_internal_11 <- local_print_Complex_internal_11 = local_print_Complex_internal_12 +move $t8, $t3 +move $t9, $t4 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t3, $v0 +# If not local_print_Complex_internal_11 goto continue__184 +sw $t0, -28($fp) +sw $t1, -0($fp) +sw $t2, -40($fp) +sw $t3, -48($fp) +sw $t4, -52($fp) +beqz $t3, continue__184 +la $a0, dispatch_error +j .raise +continue__184: +lw $t0, -28($fp) +lw $t1, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -40($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -44($fp) +sw $t2, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Saves in local_print_Complex_internal_13 data_4 +la $t1, data_4 +lw $t2, -64($fp) +# local_print_Complex_internal_15 <- Type of local_print_Complex_internal_10 +lw $t2, 0($t0) +lw $t3, -68($fp) +# Saves in local_print_Complex_internal_16 data_0 +la $t3, data_0 +# local_print_Complex_internal_15 <- local_print_Complex_internal_15 = local_print_Complex_internal_16 +move $t8, $t2 +move $t9, $t3 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t2, $v0 +# If not local_print_Complex_internal_15 goto continue__200 +sw $t0, -44($fp) +sw $t1, -56($fp) +sw $t2, -64($fp) +sw $t3, -68($fp) +beqz $t2, continue__200 +la $a0, dispatch_error +j .raise +continue__200: +lw $t0, -44($fp) +lw $t1, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -56($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -60($fp) +sw $t2, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_print_Complex_internal_14 to local_print_Complex_internal_2 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -60($fp) +sw $t1, -12($fp) +j end__155 +true__155: +lw $t0, -0($fp) +lw $t1, -72($fp) +# local_print_Complex_x_17 <- GET self . x +lw $t1, 12($t0) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_print_Complex_internal_18 to local_print_Complex_internal_2 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -76($fp) +sw $t1, -12($fp) +end__155: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 80 +jr $ra + + +function_reflect_0_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_reflect_0_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_x_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_x_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_y_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_y_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_8 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_reflect_0_Complex_x_1 <- GET self . x +lw $t1, 12($t0) +lw $t2, -16($fp) +# local_reflect_0_Complex_x_3 <- GET self . x +lw $t2, 12($t0) +lw $t3, -12($fp) +# local_reflect_0_Complex_internal_2 <- ~local_reflect_0_Complex_x_3 +not $t3, $t2 +addi $t3, $t3, 1 +lw $t4, -4($fp) +# local_reflect_0_Complex_internal_0 <- local_reflect_0_Complex_x_1 = local_reflect_0_Complex_internal_2 +seq $t4, $t1, $t3 +lw $t5, -24($fp) +# local_reflect_0_Complex_y_5 <- GET self . y +lw $t5, 16($t0) +lw $t6, -32($fp) +# local_reflect_0_Complex_y_7 <- GET self . y +lw $t6, 16($t0) +lw $t7, -28($fp) +# local_reflect_0_Complex_internal_6 <- ~local_reflect_0_Complex_y_7 +not $t7, $t6 +addi $t7, $t7, 1 +lw $a1, -20($fp) +# local_reflect_0_Complex_internal_4 <- local_reflect_0_Complex_y_5 = local_reflect_0_Complex_internal_6 +seq $a1, $t5, $t7 +lw $a2, -36($fp) +# Moving self to local_reflect_0_Complex_internal_8 +move $a2, $t0 +sw $a2, -36($fp) +move $v0, $a2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -4($fp) +sw $t5, -24($fp) +sw $t6, -32($fp) +sw $t7, -28($fp) +sw $a1, -20($fp) +sw $a2, -36($fp) +# Removing all locals from stack +addiu $sp, $sp, 40 +jr $ra + + +function_reflect_X_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_reflect_X_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_y_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_y_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_reflect_X_Complex_y_1 <- GET self . y +lw $t1, 16($t0) +lw $t2, -16($fp) +# local_reflect_X_Complex_y_3 <- GET self . y +lw $t2, 16($t0) +lw $t3, -12($fp) +# local_reflect_X_Complex_internal_2 <- ~local_reflect_X_Complex_y_3 +not $t3, $t2 +addi $t3, $t3, 1 +lw $t4, -4($fp) +# local_reflect_X_Complex_internal_0 <- local_reflect_X_Complex_y_1 = local_reflect_X_Complex_internal_2 +seq $t4, $t1, $t3 +lw $t5, -20($fp) +# Moving self to local_reflect_X_Complex_internal_4 +move $t5, $t0 +sw $t5, -20($fp) +move $v0, $t5 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -4($fp) +sw $t5, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_reflect_Y_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_reflect_Y_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_x_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_x_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_reflect_Y_Complex_x_1 <- GET self . x +lw $t1, 12($t0) +lw $t2, -16($fp) +# local_reflect_Y_Complex_x_3 <- GET self . x +lw $t2, 12($t0) +lw $t3, -12($fp) +# local_reflect_Y_Complex_internal_2 <- ~local_reflect_Y_Complex_x_3 +not $t3, $t2 +addi $t3, $t3, 1 +lw $t4, -4($fp) +# local_reflect_Y_Complex_internal_0 <- local_reflect_Y_Complex_x_1 = local_reflect_Y_Complex_internal_2 +seq $t4, $t1, $t3 +lw $t5, -20($fp) +# Moving self to local_reflect_Y_Complex_internal_4 +move $t5, $t0 +sw $t5, -20($fp) +move $v0, $t5 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -4($fp) +sw $t5, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +type_Complex: .asciiz "Complex" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "=( +" +data_2: .asciiz "=) +" +data_3: .asciiz "+" +data_4: .asciiz "I" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/fib.cl b/tests/codegen/fib.cl index 08ceaede..ced8cee4 100644 --- a/tests/codegen/fib.cl +++ b/tests/codegen/fib.cl @@ -1,29 +1,29 @@ -class Main inherits IO { - -- the class has features. Only methods in this case. - main(): Object { - { - out_string("Enter n to find nth fibonacci number!\n"); - out_int(fib(in_int())); - out_string("\n"); - } - }; - - fib(i : Int) : Int { -- list of formals. And the return type of the method. - let a : Int <- 1, - b : Int <- 0, - c : Int <- 0 - in - { - while (not (i = 0)) loop -- expressions are nested. - { - c <- a + b; - i <- i - 1; - b <- a; - a <- c; - } - pool; - c; - } - }; - -}; +class Main inherits IO { + -- the class has features. Only methods in this case. + main(): Object { + { + out_string("Enter n to find nth fibonacci number!\n"); + out_int(fib(in_int())); + out_string("\n"); + } + }; + + fib(i : Int) : Int { -- list of formals. And the return type of the method. + let a : Int <- 1, + b : Int <- 0, + c : Int <- 0 + in + { + while (not (i = 0)) loop -- expressions are nested. + { + c <- a + b; + i <- i - 1; + b <- a; + a <- c; + } + pool; + c; + } + }; + +}; diff --git a/tests/codegen/fib.mips b/tests/codegen/fib.mips new file mode 100644 index 00000000..cdc9ae00 --- /dev/null +++ b/tests/codegen/fib.mips @@ -0,0 +1,1316 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_main_Main +sw $t9, 80($v0) +la $t9, function_fib_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_fib_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_int_IO +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_fib_Main +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Saves in local_main_Main_internal_5 data_2 +la $t1, data_2 +lw $t2, -0($fp) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +sw $t2, -0($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Moving local_main_Main_internal_6 to local_main_Main_internal_7 +move $t1, $t0 +sw $t1, -32($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_fib_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_fib_Main_a_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_b_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_c_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_fib_Main_internal_9 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Moving 1 to local_fib_Main_a_0 +li $t0, 1 +sw $t0, -8($fp) +lw $t1, -12($fp) +# Moving 0 to local_fib_Main_b_1 +li $t1, 0 +sw $t1, -12($fp) +lw $t2, -16($fp) +# Moving 0 to local_fib_Main_c_2 +li $t2, 0 +sw $t2, -16($fp) +lw $t3, -20($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t3, $v0 +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +sw $t3, -20($fp) +start__85: +lw $t0, -0($fp) +lw $t1, -28($fp) +# local_fib_Main_internal_5 <- i = 0 +li $t9, 0 +seq $t1, $t0, $t9 +lw $t2, -24($fp) +# local_fib_Main_internal_4 <- not local_fib_Main_internal_5 +beqz $t1, false_6 +li $t2, 0 +j end_6 +false_6: +li $t2, 1 +end_6: +# If not local_fib_Main_internal_4 goto end__85 +sw $t0, -0($fp) +sw $t1, -28($fp) +sw $t2, -24($fp) +beqz $t2, end__85 +lw $t0, -8($fp) +lw $t1, -12($fp) +lw $t2, -32($fp) +# local_fib_Main_internal_6 <- local_fib_Main_a_0 + local_fib_Main_b_1 +add $t2, $t0, $t1 +lw $t3, -16($fp) +# Moving local_fib_Main_internal_6 to local_fib_Main_c_2 +move $t3, $t2 +sw $t3, -16($fp) +lw $t4, -0($fp) +lw $t5, -36($fp) +# local_fib_Main_internal_7 <- i - 1 +addi $t5, $t4, -1 +# Moving local_fib_Main_internal_7 to i +move $t4, $t5 +sw $t4, -0($fp) +# Moving local_fib_Main_a_0 to local_fib_Main_b_1 +move $t1, $t0 +sw $t1, -12($fp) +# Moving local_fib_Main_c_2 to local_fib_Main_a_0 +move $t0, $t3 +sw $t0, -8($fp) +lw $t6, -40($fp) +# Moving local_fib_Main_c_2 to local_fib_Main_internal_8 +move $t6, $t3 +sw $t6, -40($fp) +lw $t7, -20($fp) +# Moving local_fib_Main_internal_8 to local_fib_Main_internal_3 +move $t7, $t6 +sw $t7, -20($fp) +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -32($fp) +sw $t3, -16($fp) +sw $t4, -0($fp) +sw $t5, -36($fp) +sw $t6, -40($fp) +sw $t7, -20($fp) +j start__85 +end__85: +lw $t0, -16($fp) +lw $t1, -44($fp) +# Moving local_fib_Main_c_2 to local_fib_Main_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -44($fp) +# Removing all locals from stack +addiu $sp, $sp, 48 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Enter n to find nth fibonacci number! +" +data_2: .asciiz " +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/graph.cl b/tests/codegen/graph.cl old mode 100755 new mode 100644 index 8e511358..59e29bbf --- a/tests/codegen/graph.cl +++ b/tests/codegen/graph.cl @@ -1,381 +1,381 @@ -(* - * Cool program reading descriptions of weighted directed graphs - * from stdin. It builds up a graph objects with a list of vertices - * and a list of edges. Every vertice has a list of outgoing edges. - * - * INPUT FORMAT - * Every line has the form vertice successor* - * Where vertice is an int, and successor is vertice,weight - * - * An empty line or EOF terminates the input. - * - * The list of vertices and the edge list is printed out by the Main - * class. - * - * TEST - * Once compiled, the file g1.graph can be fed to the program. - * The output should look like this: - -nautilus.CS.Berkeley.EDU 53# spim -file graph.s (new Bar); - n : Foo => (new Razz); - n : Bar => n; - esac; - - b : Int <- a.doh() + g.doh() + doh() + printh(); - - doh() : Int { (let i : Int <- h in { h <- h + 2; i; } ) }; - -}; - -class Bar inherits Razz { - - c : Int <- doh(); - - d : Object <- printh(); -}; - - -class Razz inherits Foo { - - e : Bar <- case self of - n : Razz => (new Bar); - n : Bar => n; - esac; - - f : Int <- a@Bazz.doh() + g.doh() + e.doh() + doh() + printh(); - -}; - -class Bazz inherits IO { - - h : Int <- 1; - - g : Foo <- case self of - n : Bazz => (new Foo); - n : Razz => (new Bar); - n : Foo => (new Razz); - n : Bar => n; - esac; - - i : Object <- printh(); - - printh() : Int { { out_int(h); 0; } }; - - doh() : Int { (let i: Int <- h in { h <- h + 1; i; } ) }; -}; - -(* scary . . . *) -class Main { - a : Bazz <- new Bazz; - b : Foo <- new Foo; - c : Razz <- new Razz; - d : Bar <- new Bar; - - main(): String { "do nothing" }; - -}; - - - - - +(* hairy . . .*) + +class Foo inherits Bazz { + a : Razz <- case self of + n : Razz => (new Bar); + n : Foo => (new Razz); + n : Bar => n; + esac; + + b : Int <- a.doh() + g.doh() + doh() + printh(); + + doh() : Int { (let i : Int <- h in { h <- h + 2; i; } ) }; + +}; + +class Bar inherits Razz { + + c : Int <- doh(); + + d : Object <- printh(); +}; + + +class Razz inherits Foo { + + e : Bar <- case self of + n : Razz => (new Bar); + n : Bar => n; + esac; + + f : Int <- a@Bazz.doh() + g.doh() + e.doh() + doh() + printh(); + +}; + +class Bazz inherits IO { + + h : Int <- 1; + + g : Foo <- case self of + n : Bazz => (new Foo); + n : Razz => (new Bar); + n : Foo => (new Razz); + n : Bar => n; + esac; + + i : Object <- printh(); + + printh() : Int { { out_int(h); 0; } }; + + doh() : Int { (let i: Int <- h in { h <- h + 1; i; } ) }; +}; + +(* scary . . . *) +class Main { + a : Bazz <- new Bazz; + b : Foo <- new Foo; + c : Razz <- new Razz; + d : Bar <- new Bar; + + main(): String { "do nothing" }; + +}; + + + + + diff --git a/tests/codegen/hairyscary.mips b/tests/codegen/hairyscary.mips new file mode 100644 index 00000000..9b36cc98 --- /dev/null +++ b/tests/codegen/hairyscary.mips @@ -0,0 +1,5845 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Foo_Foo +sw $t9, 80($v0) +la $t9, function_doh_Foo +sw $t9, 84($v0) +la $t9, function_Bar_Bar +sw $t9, 88($v0) +la $t9, function_Razz_Razz +sw $t9, 92($v0) +la $t9, function_Bazz_Bazz +sw $t9, 96($v0) +la $t9, function_printh_Bazz +sw $t9, 100($v0) +la $t9, function_doh_Bazz +sw $t9, 104($v0) +la $t9, function_Main_Main +sw $t9, 108($v0) +la $t9, function_main_Main +sw $t9, 112($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Foo +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_printh_Bazz in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_doh_Foo in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Foo_Foo in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bar +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 48 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_printh_Bazz in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_doh_Foo in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Foo_Foo in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_Bar_Bar in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Razz +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 48 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_printh_Bazz in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_doh_Foo in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Foo_Foo in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_Razz_Razz in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bazz +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_printh_Bazz in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_doh_Bazz in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Bazz_Bazz in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 36($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 24 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 32($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 28($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 36($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 28 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 28 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Foo_Foo: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Foo_Foo_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_n_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_n_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_n_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_n_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_n_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_n_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_n_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_a_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_g_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_39 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Foo_Foo_internal_40 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . h <- SET 1 +li $t9, 1 +sw $t9, 12($t0) +lw $t1, -8($fp) +# local_Foo_Foo_internal_1 <- Type of self +lw $t1, 0($t0) +lw $t2, -12($fp) +# Saves in local_Foo_Foo_internal_2 data_0 +la $t2, data_0 +# local_Foo_Foo_internal_1 <- local_Foo_Foo_internal_1 = local_Foo_Foo_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If local_Foo_Foo_internal_1 goto error__51 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +bnez $t1, error__51 +lw $t0, -0($fp) +lw $t1, -16($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_7: +move $t8, $v0 +beqz $t8, false_7 +lw $v1, 0($t8) +beq $t9, $v1, true_7 +lw $v0, 4($t8) +j loop_7 +true_7: +li $t1, 1 +j end_7 +false_7: +li $t1, 0 +end_7: +# If not local_Foo_Foo_internal_3 goto next__57_0 +sw $t0, -0($fp) +sw $t1, -16($fp) +beqz $t1, next__57_0 +lw $t0, -0($fp) +lw $t1, -20($fp) +# Moving self to local_Foo_Foo_n_4 +move $t1, $t0 +sw $t1, -20($fp) +lw $t2, -4($fp) +# Moving local_Foo_Foo_n_4 to local_Foo_Foo_internal_0 +move $t2, $t1 +sw $t2, -4($fp) +sw $t0, -0($fp) +sw $t1, -20($fp) +sw $t2, -4($fp) +j end__51 +next__57_0: +lw $t0, -0($fp) +lw $t1, -24($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_8: +move $t8, $v0 +beqz $t8, false_8 +lw $v1, 0($t8) +beq $t9, $v1, true_8 +lw $v0, 4($t8) +j loop_8 +true_8: +li $t1, 1 +j end_8 +false_8: +li $t1, 0 +end_8: +# If not local_Foo_Foo_internal_5 goto next__65_1 +sw $t0, -0($fp) +sw $t1, -24($fp) +beqz $t1, next__65_1 +lw $t0, -0($fp) +lw $t1, -28($fp) +# Moving self to local_Foo_Foo_n_6 +move $t1, $t0 +sw $t1, -28($fp) +lw $t2, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Foo_Foo_internal_7 to local_Foo_Foo_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -32($fp) +sw $t1, -4($fp) +j end__51 +next__65_1: +lw $t0, -0($fp) +lw $t1, -36($fp) +la $t9, type_Foo +lw $v0, 8($t0) +loop_9: +move $t8, $v0 +beqz $t8, false_9 +lw $v1, 0($t8) +beq $t9, $v1, true_9 +lw $v0, 4($t8) +j loop_9 +true_9: +li $t1, 1 +j end_9 +false_9: +li $t1, 0 +end_9: +# If not local_Foo_Foo_internal_8 goto next__76_2 +sw $t0, -0($fp) +sw $t1, -36($fp) +beqz $t1, next__76_2 +lw $t0, -0($fp) +lw $t1, -40($fp) +# Moving self to local_Foo_Foo_n_9 +move $t1, $t0 +sw $t1, -40($fp) +lw $t2, -44($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Foo_Foo_internal_10 to local_Foo_Foo_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -44($fp) +sw $t1, -4($fp) +j end__51 +next__76_2: +lw $t0, -0($fp) +lw $t1, -48($fp) +la $t9, type_Bazz +lw $v0, 8($t0) +loop_10: +move $t8, $v0 +beqz $t8, false_10 +lw $v1, 0($t8) +beq $t9, $v1, true_10 +lw $v0, 4($t8) +j loop_10 +true_10: +li $t1, 1 +j end_10 +false_10: +li $t1, 0 +end_10: +# If not local_Foo_Foo_internal_11 goto next__87_3 +sw $t0, -0($fp) +sw $t1, -48($fp) +beqz $t1, next__87_3 +lw $t0, -0($fp) +lw $t1, -52($fp) +# Moving self to local_Foo_Foo_n_12 +move $t1, $t0 +sw $t1, -52($fp) +lw $t2, -56($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 32 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Foo +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 32 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Foo +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +# This function will consume the arguments +jal function_Foo_Foo +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Foo_Foo_internal_13 to local_Foo_Foo_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -56($fp) +sw $t1, -4($fp) +j end__51 +next__87_3: +la $a0, case_error +j .raise +error__51: +la $a0, case_void_error +j .raise +end__51: +lw $t0, -4($fp) +lw $t1, -0($fp) +# self . g <- SET local_Foo_Foo_internal_0 +sw $t0, 16($t1) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Initialize new node +li $a0, 12 +li $v0, 9 +syscall +la $t9, type_Int +sw $t9, 0($v0) +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Saving the methods of object +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t1) +lw $t2, -0($fp) +# self . i <- SET local_Foo_Foo_internal_15 +sw $t1, 20($t2) +lw $t3, -72($fp) +# local_Foo_Foo_internal_17 <- Type of self +lw $t3, 0($t2) +lw $t4, -76($fp) +# Saves in local_Foo_Foo_internal_18 data_0 +la $t4, data_0 +# local_Foo_Foo_internal_17 <- local_Foo_Foo_internal_17 = local_Foo_Foo_internal_18 +move $t8, $t3 +move $t9, $t4 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t3, $v0 +# If local_Foo_Foo_internal_17 goto error__110 +sw $t0, -60($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +sw $t3, -72($fp) +sw $t4, -76($fp) +bnez $t3, error__110 +lw $t0, -0($fp) +lw $t1, -80($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_12: +move $t8, $v0 +beqz $t8, false_12 +lw $v1, 0($t8) +beq $t9, $v1, true_12 +lw $v0, 4($t8) +j loop_12 +true_12: +li $t1, 1 +j end_12 +false_12: +li $t1, 0 +end_12: +# If not local_Foo_Foo_internal_19 goto next__116_0 +sw $t0, -0($fp) +sw $t1, -80($fp) +beqz $t1, next__116_0 +lw $t0, -0($fp) +lw $t1, -84($fp) +# Moving self to local_Foo_Foo_n_20 +move $t1, $t0 +sw $t1, -84($fp) +lw $t2, -68($fp) +# Moving local_Foo_Foo_n_20 to local_Foo_Foo_internal_16 +move $t2, $t1 +sw $t2, -68($fp) +sw $t0, -0($fp) +sw $t1, -84($fp) +sw $t2, -68($fp) +j end__110 +next__116_0: +lw $t0, -0($fp) +lw $t1, -88($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_13: +move $t8, $v0 +beqz $t8, false_13 +lw $v1, 0($t8) +beq $t9, $v1, true_13 +lw $v0, 4($t8) +j loop_13 +true_13: +li $t1, 1 +j end_13 +false_13: +li $t1, 0 +end_13: +# If not local_Foo_Foo_internal_21 goto next__124_1 +sw $t0, -0($fp) +sw $t1, -88($fp) +beqz $t1, next__124_1 +lw $t0, -0($fp) +lw $t1, -92($fp) +# Moving self to local_Foo_Foo_n_22 +move $t1, $t0 +sw $t1, -92($fp) +lw $t2, -96($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -92($fp) +sw $t2, -96($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Moving local_Foo_Foo_internal_23 to local_Foo_Foo_internal_16 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -96($fp) +sw $t1, -68($fp) +j end__110 +next__124_1: +lw $t0, -0($fp) +lw $t1, -100($fp) +la $t9, type_Foo +lw $v0, 8($t0) +loop_14: +move $t8, $v0 +beqz $t8, false_14 +lw $v1, 0($t8) +beq $t9, $v1, true_14 +lw $v0, 4($t8) +j loop_14 +true_14: +li $t1, 1 +j end_14 +false_14: +li $t1, 0 +end_14: +# If not local_Foo_Foo_internal_24 goto next__135_2 +sw $t0, -0($fp) +sw $t1, -100($fp) +beqz $t1, next__135_2 +lw $t0, -0($fp) +lw $t1, -104($fp) +# Moving self to local_Foo_Foo_n_25 +move $t1, $t0 +sw $t1, -104($fp) +lw $t2, -108($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -104($fp) +sw $t2, -108($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Moving local_Foo_Foo_internal_26 to local_Foo_Foo_internal_16 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -108($fp) +sw $t1, -68($fp) +j end__110 +next__135_2: +la $a0, case_error +j .raise +error__110: +la $a0, case_void_error +j .raise +end__110: +lw $t0, -68($fp) +lw $t1, -0($fp) +# self . a <- SET local_Foo_Foo_internal_16 +sw $t0, 24($t1) +lw $t2, -124($fp) +# local_Foo_Foo_a_30 <- GET self . a +lw $t2, 24($t1) +lw $t3, -132($fp) +# local_Foo_Foo_internal_32 <- Type of local_Foo_Foo_a_30 +lw $t3, 0($t2) +lw $t4, -136($fp) +# Saves in local_Foo_Foo_internal_33 data_0 +la $t4, data_0 +# local_Foo_Foo_internal_32 <- local_Foo_Foo_internal_32 = local_Foo_Foo_internal_33 +move $t8, $t3 +move $t9, $t4 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t3, $v0 +# If not local_Foo_Foo_internal_32 goto continue__158 +sw $t0, -68($fp) +sw $t1, -0($fp) +sw $t2, -124($fp) +sw $t3, -132($fp) +sw $t4, -136($fp) +beqz $t3, continue__158 +la $a0, dispatch_error +j .raise +continue__158: +lw $t0, -124($fp) +lw $t1, -128($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -124($fp) +sw $t1, -128($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -128($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -140($fp) +# local_Foo_Foo_g_34 <- GET self . g +lw $t2, 16($t1) +lw $t3, -148($fp) +# local_Foo_Foo_internal_36 <- Type of local_Foo_Foo_g_34 +lw $t3, 0($t2) +lw $t4, -152($fp) +# Saves in local_Foo_Foo_internal_37 data_0 +la $t4, data_0 +# local_Foo_Foo_internal_36 <- local_Foo_Foo_internal_36 = local_Foo_Foo_internal_37 +move $t8, $t3 +move $t9, $t4 +loop_16: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_16 +beqz $a1, mismatch_16 +seq $v0, $a0, $a1 +beqz $v0, mismatch_16 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_16 +mismatch_16: +li $v0, 0 +j end_16 +check_16: +bnez $a1, mismatch_16 +li $v0, 1 +end_16: +move $t3, $v0 +# If not local_Foo_Foo_internal_36 goto continue__172 +sw $t0, -128($fp) +sw $t1, -0($fp) +sw $t2, -140($fp) +sw $t3, -148($fp) +sw $t4, -152($fp) +beqz $t3, continue__172 +la $a0, dispatch_error +j .raise +continue__172: +lw $t0, -140($fp) +lw $t1, -144($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -140($fp) +sw $t1, -144($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -144($fp) +# saves the return value +move $t0, $v0 +lw $t1, -128($fp) +lw $t2, -120($fp) +# local_Foo_Foo_internal_29 <- local_Foo_Foo_internal_31 + local_Foo_Foo_internal_35 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -156($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -144($fp) +sw $t1, -128($fp) +sw $t2, -120($fp) +sw $t3, -0($fp) +sw $t4, -156($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -156($fp) +# saves the return value +move $t0, $v0 +lw $t1, -120($fp) +lw $t2, -116($fp) +# local_Foo_Foo_internal_28 <- local_Foo_Foo_internal_29 + local_Foo_Foo_internal_38 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -160($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -156($fp) +sw $t1, -120($fp) +sw $t2, -116($fp) +sw $t3, -0($fp) +sw $t4, -160($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -160($fp) +# saves the return value +move $t0, $v0 +lw $t1, -116($fp) +lw $t2, -112($fp) +# local_Foo_Foo_internal_27 <- local_Foo_Foo_internal_28 + local_Foo_Foo_internal_39 +add $t2, $t1, $t0 +lw $t3, -0($fp) +# self . b <- SET local_Foo_Foo_internal_27 +sw $t2, 28($t3) +lw $t4, -164($fp) +# Moving self to local_Foo_Foo_internal_40 +move $t4, $t3 +sw $t4, -164($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -160($fp) +sw $t1, -116($fp) +sw $t2, -112($fp) +sw $t3, -0($fp) +sw $t4, -164($fp) +# Removing all locals from stack +addiu $sp, $sp, 168 +jr $ra + + +function_doh_Foo: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_doh_Foo_i_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Foo_h_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Foo_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Foo_h_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Foo_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_doh_Foo_h_1 <- GET self . h +lw $t1, 12($t0) +lw $t2, -4($fp) +# Moving local_doh_Foo_h_1 to local_doh_Foo_i_0 +move $t2, $t1 +sw $t2, -4($fp) +lw $t3, -16($fp) +# local_doh_Foo_h_3 <- GET self . h +lw $t3, 12($t0) +lw $t4, -12($fp) +# local_doh_Foo_internal_2 <- local_doh_Foo_h_3 + 2 +addi $t4, $t3, 2 +# self . h <- SET local_doh_Foo_internal_2 +sw $t4, 12($t0) +lw $t5, -20($fp) +# Moving local_doh_Foo_i_0 to local_doh_Foo_internal_4 +move $t5, $t2 +sw $t5, -20($fp) +move $v0, $t5 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -4($fp) +sw $t3, -16($fp) +sw $t4, -12($fp) +sw $t5, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_Bar_Bar: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Bar_Bar_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_a_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_g_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_39 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_40 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_41 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_42 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_43 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_44 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_45 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_n_46 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_47 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_48 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_49 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_50 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_51 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_a_52 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_53 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_54 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_55 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_g_56 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_57 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_58 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_59 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_e_60 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_61 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_62 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_63 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_64 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_65 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_66 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_67 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_68 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bar_Bar_internal_69 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . h <- SET 1 +li $t9, 1 +sw $t9, 12($t0) +lw $t1, -8($fp) +# local_Bar_Bar_internal_1 <- Type of self +lw $t1, 0($t0) +lw $t2, -12($fp) +# Saves in local_Bar_Bar_internal_2 data_0 +la $t2, data_0 +# local_Bar_Bar_internal_1 <- local_Bar_Bar_internal_1 = local_Bar_Bar_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_17: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_17 +beqz $a1, mismatch_17 +seq $v0, $a0, $a1 +beqz $v0, mismatch_17 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_17 +mismatch_17: +li $v0, 0 +j end_17 +check_17: +bnez $a1, mismatch_17 +li $v0, 1 +end_17: +move $t1, $v0 +# If local_Bar_Bar_internal_1 goto error__213 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +bnez $t1, error__213 +lw $t0, -0($fp) +lw $t1, -16($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_18: +move $t8, $v0 +beqz $t8, false_18 +lw $v1, 0($t8) +beq $t9, $v1, true_18 +lw $v0, 4($t8) +j loop_18 +true_18: +li $t1, 1 +j end_18 +false_18: +li $t1, 0 +end_18: +# If not local_Bar_Bar_internal_3 goto next__219_0 +sw $t0, -0($fp) +sw $t1, -16($fp) +beqz $t1, next__219_0 +lw $t0, -0($fp) +lw $t1, -20($fp) +# Moving self to local_Bar_Bar_n_4 +move $t1, $t0 +sw $t1, -20($fp) +lw $t2, -4($fp) +# Moving local_Bar_Bar_n_4 to local_Bar_Bar_internal_0 +move $t2, $t1 +sw $t2, -4($fp) +sw $t0, -0($fp) +sw $t1, -20($fp) +sw $t2, -4($fp) +j end__213 +next__219_0: +lw $t0, -0($fp) +lw $t1, -24($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_19: +move $t8, $v0 +beqz $t8, false_19 +lw $v1, 0($t8) +beq $t9, $v1, true_19 +lw $v0, 4($t8) +j loop_19 +true_19: +li $t1, 1 +j end_19 +false_19: +li $t1, 0 +end_19: +# If not local_Bar_Bar_internal_5 goto next__227_1 +sw $t0, -0($fp) +sw $t1, -24($fp) +beqz $t1, next__227_1 +lw $t0, -0($fp) +lw $t1, -28($fp) +# Moving self to local_Bar_Bar_n_6 +move $t1, $t0 +sw $t1, -28($fp) +lw $t2, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Bar_Bar_internal_7 to local_Bar_Bar_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -32($fp) +sw $t1, -4($fp) +j end__213 +next__227_1: +lw $t0, -0($fp) +lw $t1, -36($fp) +la $t9, type_Foo +lw $v0, 8($t0) +loop_20: +move $t8, $v0 +beqz $t8, false_20 +lw $v1, 0($t8) +beq $t9, $v1, true_20 +lw $v0, 4($t8) +j loop_20 +true_20: +li $t1, 1 +j end_20 +false_20: +li $t1, 0 +end_20: +# If not local_Bar_Bar_internal_8 goto next__238_2 +sw $t0, -0($fp) +sw $t1, -36($fp) +beqz $t1, next__238_2 +lw $t0, -0($fp) +lw $t1, -40($fp) +# Moving self to local_Bar_Bar_n_9 +move $t1, $t0 +sw $t1, -40($fp) +lw $t2, -44($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Bar_Bar_internal_10 to local_Bar_Bar_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -44($fp) +sw $t1, -4($fp) +j end__213 +next__238_2: +lw $t0, -0($fp) +lw $t1, -48($fp) +la $t9, type_Bazz +lw $v0, 8($t0) +loop_21: +move $t8, $v0 +beqz $t8, false_21 +lw $v1, 0($t8) +beq $t9, $v1, true_21 +lw $v0, 4($t8) +j loop_21 +true_21: +li $t1, 1 +j end_21 +false_21: +li $t1, 0 +end_21: +# If not local_Bar_Bar_internal_11 goto next__249_3 +sw $t0, -0($fp) +sw $t1, -48($fp) +beqz $t1, next__249_3 +lw $t0, -0($fp) +lw $t1, -52($fp) +# Moving self to local_Bar_Bar_n_12 +move $t1, $t0 +sw $t1, -52($fp) +lw $t2, -56($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 32 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Foo +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 32 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Foo +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +# This function will consume the arguments +jal function_Foo_Foo +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Bar_Bar_internal_13 to local_Bar_Bar_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -56($fp) +sw $t1, -4($fp) +j end__213 +next__249_3: +la $a0, case_error +j .raise +error__213: +la $a0, case_void_error +j .raise +end__213: +lw $t0, -4($fp) +lw $t1, -0($fp) +# self . g <- SET local_Bar_Bar_internal_0 +sw $t0, 16($t1) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Initialize new node +li $a0, 12 +li $v0, 9 +syscall +la $t9, type_Int +sw $t9, 0($v0) +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Saving the methods of object +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t1) +lw $t2, -0($fp) +# self . i <- SET local_Bar_Bar_internal_15 +sw $t1, 20($t2) +lw $t3, -72($fp) +# local_Bar_Bar_internal_17 <- Type of self +lw $t3, 0($t2) +lw $t4, -76($fp) +# Saves in local_Bar_Bar_internal_18 data_0 +la $t4, data_0 +# local_Bar_Bar_internal_17 <- local_Bar_Bar_internal_17 = local_Bar_Bar_internal_18 +move $t8, $t3 +move $t9, $t4 +loop_22: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_22 +beqz $a1, mismatch_22 +seq $v0, $a0, $a1 +beqz $v0, mismatch_22 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_22 +mismatch_22: +li $v0, 0 +j end_22 +check_22: +bnez $a1, mismatch_22 +li $v0, 1 +end_22: +move $t3, $v0 +# If local_Bar_Bar_internal_17 goto error__272 +sw $t0, -60($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +sw $t3, -72($fp) +sw $t4, -76($fp) +bnez $t3, error__272 +lw $t0, -0($fp) +lw $t1, -80($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_23: +move $t8, $v0 +beqz $t8, false_23 +lw $v1, 0($t8) +beq $t9, $v1, true_23 +lw $v0, 4($t8) +j loop_23 +true_23: +li $t1, 1 +j end_23 +false_23: +li $t1, 0 +end_23: +# If not local_Bar_Bar_internal_19 goto next__278_0 +sw $t0, -0($fp) +sw $t1, -80($fp) +beqz $t1, next__278_0 +lw $t0, -0($fp) +lw $t1, -84($fp) +# Moving self to local_Bar_Bar_n_20 +move $t1, $t0 +sw $t1, -84($fp) +lw $t2, -68($fp) +# Moving local_Bar_Bar_n_20 to local_Bar_Bar_internal_16 +move $t2, $t1 +sw $t2, -68($fp) +sw $t0, -0($fp) +sw $t1, -84($fp) +sw $t2, -68($fp) +j end__272 +next__278_0: +lw $t0, -0($fp) +lw $t1, -88($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_24: +move $t8, $v0 +beqz $t8, false_24 +lw $v1, 0($t8) +beq $t9, $v1, true_24 +lw $v0, 4($t8) +j loop_24 +true_24: +li $t1, 1 +j end_24 +false_24: +li $t1, 0 +end_24: +# If not local_Bar_Bar_internal_21 goto next__286_1 +sw $t0, -0($fp) +sw $t1, -88($fp) +beqz $t1, next__286_1 +lw $t0, -0($fp) +lw $t1, -92($fp) +# Moving self to local_Bar_Bar_n_22 +move $t1, $t0 +sw $t1, -92($fp) +lw $t2, -96($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -92($fp) +sw $t2, -96($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Moving local_Bar_Bar_internal_23 to local_Bar_Bar_internal_16 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -96($fp) +sw $t1, -68($fp) +j end__272 +next__286_1: +lw $t0, -0($fp) +lw $t1, -100($fp) +la $t9, type_Foo +lw $v0, 8($t0) +loop_25: +move $t8, $v0 +beqz $t8, false_25 +lw $v1, 0($t8) +beq $t9, $v1, true_25 +lw $v0, 4($t8) +j loop_25 +true_25: +li $t1, 1 +j end_25 +false_25: +li $t1, 0 +end_25: +# If not local_Bar_Bar_internal_24 goto next__297_2 +sw $t0, -0($fp) +sw $t1, -100($fp) +beqz $t1, next__297_2 +lw $t0, -0($fp) +lw $t1, -104($fp) +# Moving self to local_Bar_Bar_n_25 +move $t1, $t0 +sw $t1, -104($fp) +lw $t2, -108($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -104($fp) +sw $t2, -108($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Moving local_Bar_Bar_internal_26 to local_Bar_Bar_internal_16 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -108($fp) +sw $t1, -68($fp) +j end__272 +next__297_2: +la $a0, case_error +j .raise +error__272: +la $a0, case_void_error +j .raise +end__272: +lw $t0, -68($fp) +lw $t1, -0($fp) +# self . a <- SET local_Bar_Bar_internal_16 +sw $t0, 24($t1) +lw $t2, -124($fp) +# local_Bar_Bar_a_30 <- GET self . a +lw $t2, 24($t1) +lw $t3, -132($fp) +# local_Bar_Bar_internal_32 <- Type of local_Bar_Bar_a_30 +lw $t3, 0($t2) +lw $t4, -136($fp) +# Saves in local_Bar_Bar_internal_33 data_0 +la $t4, data_0 +# local_Bar_Bar_internal_32 <- local_Bar_Bar_internal_32 = local_Bar_Bar_internal_33 +move $t8, $t3 +move $t9, $t4 +loop_26: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_26 +beqz $a1, mismatch_26 +seq $v0, $a0, $a1 +beqz $v0, mismatch_26 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_26 +mismatch_26: +li $v0, 0 +j end_26 +check_26: +bnez $a1, mismatch_26 +li $v0, 1 +end_26: +move $t3, $v0 +# If not local_Bar_Bar_internal_32 goto continue__320 +sw $t0, -68($fp) +sw $t1, -0($fp) +sw $t2, -124($fp) +sw $t3, -132($fp) +sw $t4, -136($fp) +beqz $t3, continue__320 +la $a0, dispatch_error +j .raise +continue__320: +lw $t0, -124($fp) +lw $t1, -128($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -124($fp) +sw $t1, -128($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -128($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -140($fp) +# local_Bar_Bar_g_34 <- GET self . g +lw $t2, 16($t1) +lw $t3, -148($fp) +# local_Bar_Bar_internal_36 <- Type of local_Bar_Bar_g_34 +lw $t3, 0($t2) +lw $t4, -152($fp) +# Saves in local_Bar_Bar_internal_37 data_0 +la $t4, data_0 +# local_Bar_Bar_internal_36 <- local_Bar_Bar_internal_36 = local_Bar_Bar_internal_37 +move $t8, $t3 +move $t9, $t4 +loop_27: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_27 +beqz $a1, mismatch_27 +seq $v0, $a0, $a1 +beqz $v0, mismatch_27 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_27 +mismatch_27: +li $v0, 0 +j end_27 +check_27: +bnez $a1, mismatch_27 +li $v0, 1 +end_27: +move $t3, $v0 +# If not local_Bar_Bar_internal_36 goto continue__334 +sw $t0, -128($fp) +sw $t1, -0($fp) +sw $t2, -140($fp) +sw $t3, -148($fp) +sw $t4, -152($fp) +beqz $t3, continue__334 +la $a0, dispatch_error +j .raise +continue__334: +lw $t0, -140($fp) +lw $t1, -144($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -140($fp) +sw $t1, -144($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -144($fp) +# saves the return value +move $t0, $v0 +lw $t1, -128($fp) +lw $t2, -120($fp) +# local_Bar_Bar_internal_29 <- local_Bar_Bar_internal_31 + local_Bar_Bar_internal_35 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -156($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -144($fp) +sw $t1, -128($fp) +sw $t2, -120($fp) +sw $t3, -0($fp) +sw $t4, -156($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -156($fp) +# saves the return value +move $t0, $v0 +lw $t1, -120($fp) +lw $t2, -116($fp) +# local_Bar_Bar_internal_28 <- local_Bar_Bar_internal_29 + local_Bar_Bar_internal_38 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -160($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -156($fp) +sw $t1, -120($fp) +sw $t2, -116($fp) +sw $t3, -0($fp) +sw $t4, -160($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -160($fp) +# saves the return value +move $t0, $v0 +lw $t1, -116($fp) +lw $t2, -112($fp) +# local_Bar_Bar_internal_27 <- local_Bar_Bar_internal_28 + local_Bar_Bar_internal_39 +add $t2, $t1, $t0 +lw $t3, -0($fp) +# self . b <- SET local_Bar_Bar_internal_27 +sw $t2, 28($t3) +lw $t4, -168($fp) +# local_Bar_Bar_internal_41 <- Type of self +lw $t4, 0($t3) +lw $t5, -172($fp) +# Saves in local_Bar_Bar_internal_42 data_0 +la $t5, data_0 +# local_Bar_Bar_internal_41 <- local_Bar_Bar_internal_41 = local_Bar_Bar_internal_42 +move $t8, $t4 +move $t9, $t5 +loop_28: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_28 +beqz $a1, mismatch_28 +seq $v0, $a0, $a1 +beqz $v0, mismatch_28 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_28 +mismatch_28: +li $v0, 0 +j end_28 +check_28: +bnez $a1, mismatch_28 +li $v0, 1 +end_28: +move $t4, $v0 +# If local_Bar_Bar_internal_41 goto error__355 +sw $t0, -160($fp) +sw $t1, -116($fp) +sw $t2, -112($fp) +sw $t3, -0($fp) +sw $t4, -168($fp) +sw $t5, -172($fp) +bnez $t4, error__355 +lw $t0, -0($fp) +lw $t1, -176($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_29: +move $t8, $v0 +beqz $t8, false_29 +lw $v1, 0($t8) +beq $t9, $v1, true_29 +lw $v0, 4($t8) +j loop_29 +true_29: +li $t1, 1 +j end_29 +false_29: +li $t1, 0 +end_29: +# If not local_Bar_Bar_internal_43 goto next__361_0 +sw $t0, -0($fp) +sw $t1, -176($fp) +beqz $t1, next__361_0 +lw $t0, -0($fp) +lw $t1, -180($fp) +# Moving self to local_Bar_Bar_n_44 +move $t1, $t0 +sw $t1, -180($fp) +lw $t2, -164($fp) +# Moving local_Bar_Bar_n_44 to local_Bar_Bar_internal_40 +move $t2, $t1 +sw $t2, -164($fp) +sw $t0, -0($fp) +sw $t1, -180($fp) +sw $t2, -164($fp) +j end__355 +next__361_0: +lw $t0, -0($fp) +lw $t1, -184($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_30: +move $t8, $v0 +beqz $t8, false_30 +lw $v1, 0($t8) +beq $t9, $v1, true_30 +lw $v0, 4($t8) +j loop_30 +true_30: +li $t1, 1 +j end_30 +false_30: +li $t1, 0 +end_30: +# If not local_Bar_Bar_internal_45 goto next__369_1 +sw $t0, -0($fp) +sw $t1, -184($fp) +beqz $t1, next__369_1 +lw $t0, -0($fp) +lw $t1, -188($fp) +# Moving self to local_Bar_Bar_n_46 +move $t1, $t0 +sw $t1, -188($fp) +lw $t2, -192($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -188($fp) +sw $t2, -192($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -192($fp) +# saves the return value +move $t0, $v0 +lw $t1, -164($fp) +# Moving local_Bar_Bar_internal_47 to local_Bar_Bar_internal_40 +move $t1, $t0 +sw $t1, -164($fp) +sw $t0, -192($fp) +sw $t1, -164($fp) +j end__355 +next__369_1: +la $a0, case_error +j .raise +error__355: +la $a0, case_void_error +j .raise +end__355: +lw $t0, -164($fp) +lw $t1, -0($fp) +# self . e <- SET local_Bar_Bar_internal_40 +sw $t0, 32($t1) +lw $t2, -212($fp) +# local_Bar_Bar_a_52 <- GET self . a +lw $t2, 24($t1) +lw $t3, -220($fp) +# local_Bar_Bar_internal_54 <- Type of local_Bar_Bar_a_52 +lw $t3, 0($t2) +lw $t4, -224($fp) +# Saves in local_Bar_Bar_internal_55 data_0 +la $t4, data_0 +# local_Bar_Bar_internal_54 <- local_Bar_Bar_internal_54 = local_Bar_Bar_internal_55 +move $t8, $t3 +move $t9, $t4 +loop_31: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_31 +beqz $a1, mismatch_31 +seq $v0, $a0, $a1 +beqz $v0, mismatch_31 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_31 +mismatch_31: +li $v0, 0 +j end_31 +check_31: +bnez $a1, mismatch_31 +li $v0, 1 +end_31: +move $t3, $v0 +# If not local_Bar_Bar_internal_54 goto continue__393 +sw $t0, -164($fp) +sw $t1, -0($fp) +sw $t2, -212($fp) +sw $t3, -220($fp) +sw $t4, -224($fp) +beqz $t3, continue__393 +la $a0, dispatch_error +j .raise +continue__393: +lw $t0, -216($fp) +# Static Dispatch of the method doh +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -212($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -216($fp) +sw $t1, -212($fp) +# This function will consume the arguments +jal function_doh_Bazz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -216($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -228($fp) +# local_Bar_Bar_g_56 <- GET self . g +lw $t2, 16($t1) +lw $t3, -236($fp) +# local_Bar_Bar_internal_58 <- Type of local_Bar_Bar_g_56 +lw $t3, 0($t2) +lw $t4, -240($fp) +# Saves in local_Bar_Bar_internal_59 data_0 +la $t4, data_0 +# local_Bar_Bar_internal_58 <- local_Bar_Bar_internal_58 = local_Bar_Bar_internal_59 +move $t8, $t3 +move $t9, $t4 +loop_32: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_32 +beqz $a1, mismatch_32 +seq $v0, $a0, $a1 +beqz $v0, mismatch_32 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_32 +mismatch_32: +li $v0, 0 +j end_32 +check_32: +bnez $a1, mismatch_32 +li $v0, 1 +end_32: +move $t3, $v0 +# If not local_Bar_Bar_internal_58 goto continue__407 +sw $t0, -216($fp) +sw $t1, -0($fp) +sw $t2, -228($fp) +sw $t3, -236($fp) +sw $t4, -240($fp) +beqz $t3, continue__407 +la $a0, dispatch_error +j .raise +continue__407: +lw $t0, -228($fp) +lw $t1, -232($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -228($fp) +sw $t1, -232($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -232($fp) +# saves the return value +move $t0, $v0 +lw $t1, -216($fp) +lw $t2, -208($fp) +# local_Bar_Bar_internal_51 <- local_Bar_Bar_internal_53 + local_Bar_Bar_internal_57 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -244($fp) +# local_Bar_Bar_e_60 <- GET self . e +lw $t4, 32($t3) +lw $t5, -252($fp) +# local_Bar_Bar_internal_62 <- Type of local_Bar_Bar_e_60 +lw $t5, 0($t4) +lw $t6, -256($fp) +# Saves in local_Bar_Bar_internal_63 data_0 +la $t6, data_0 +# local_Bar_Bar_internal_62 <- local_Bar_Bar_internal_62 = local_Bar_Bar_internal_63 +move $t8, $t5 +move $t9, $t6 +loop_33: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_33 +beqz $a1, mismatch_33 +seq $v0, $a0, $a1 +beqz $v0, mismatch_33 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_33 +mismatch_33: +li $v0, 0 +j end_33 +check_33: +bnez $a1, mismatch_33 +li $v0, 1 +end_33: +move $t5, $v0 +# If not local_Bar_Bar_internal_62 goto continue__422 +sw $t0, -232($fp) +sw $t1, -216($fp) +sw $t2, -208($fp) +sw $t3, -0($fp) +sw $t4, -244($fp) +sw $t5, -252($fp) +sw $t6, -256($fp) +beqz $t5, continue__422 +la $a0, dispatch_error +j .raise +continue__422: +lw $t0, -244($fp) +lw $t1, -248($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -244($fp) +sw $t1, -248($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -248($fp) +# saves the return value +move $t0, $v0 +lw $t1, -208($fp) +lw $t2, -204($fp) +# local_Bar_Bar_internal_50 <- local_Bar_Bar_internal_51 + local_Bar_Bar_internal_61 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -260($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -248($fp) +sw $t1, -208($fp) +sw $t2, -204($fp) +sw $t3, -0($fp) +sw $t4, -260($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -260($fp) +# saves the return value +move $t0, $v0 +lw $t1, -204($fp) +lw $t2, -200($fp) +# local_Bar_Bar_internal_49 <- local_Bar_Bar_internal_50 + local_Bar_Bar_internal_64 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -264($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -260($fp) +sw $t1, -204($fp) +sw $t2, -200($fp) +sw $t3, -0($fp) +sw $t4, -264($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -264($fp) +# saves the return value +move $t0, $v0 +lw $t1, -200($fp) +lw $t2, -196($fp) +# local_Bar_Bar_internal_48 <- local_Bar_Bar_internal_49 + local_Bar_Bar_internal_65 +add $t2, $t1, $t0 +lw $t3, -0($fp) +# self . f <- SET local_Bar_Bar_internal_48 +sw $t2, 36($t3) +lw $t4, -268($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -264($fp) +sw $t1, -200($fp) +sw $t2, -196($fp) +sw $t3, -0($fp) +sw $t4, -268($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -268($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . c <- SET local_Bar_Bar_internal_66 +sw $t0, 40($t1) +lw $t2, -272($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -268($fp) +sw $t1, -0($fp) +sw $t2, -272($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -272($fp) +# saves the return value +move $t0, $v0 +lw $t1, -276($fp) +# Initialize new node +li $a0, 12 +li $v0, 9 +syscall +la $t9, type_Int +sw $t9, 0($v0) +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Saving the methods of object +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t1) +lw $t2, -0($fp) +# self . d <- SET local_Bar_Bar_internal_68 +sw $t1, 44($t2) +lw $t3, -280($fp) +# Moving self to local_Bar_Bar_internal_69 +move $t3, $t2 +sw $t3, -280($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -272($fp) +sw $t1, -276($fp) +sw $t2, -0($fp) +sw $t3, -280($fp) +# Removing all locals from stack +addiu $sp, $sp, 284 +jr $ra + + +function_Razz_Razz: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Razz_Razz_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_a_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_g_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_39 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_40 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_41 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_42 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_43 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_44 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_45 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_n_46 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_47 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_48 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_49 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_50 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_51 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_a_52 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_53 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_54 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_55 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_g_56 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_57 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_58 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_59 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_e_60 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_61 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_62 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_63 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_64 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_65 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Razz_Razz_internal_66 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . h <- SET 1 +li $t9, 1 +sw $t9, 12($t0) +lw $t1, -8($fp) +# local_Razz_Razz_internal_1 <- Type of self +lw $t1, 0($t0) +lw $t2, -12($fp) +# Saves in local_Razz_Razz_internal_2 data_0 +la $t2, data_0 +# local_Razz_Razz_internal_1 <- local_Razz_Razz_internal_1 = local_Razz_Razz_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_34: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_34 +beqz $a1, mismatch_34 +seq $v0, $a0, $a1 +beqz $v0, mismatch_34 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_34 +mismatch_34: +li $v0, 0 +j end_34 +check_34: +bnez $a1, mismatch_34 +li $v0, 1 +end_34: +move $t1, $v0 +# If local_Razz_Razz_internal_1 goto error__459 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +bnez $t1, error__459 +lw $t0, -0($fp) +lw $t1, -16($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_35: +move $t8, $v0 +beqz $t8, false_35 +lw $v1, 0($t8) +beq $t9, $v1, true_35 +lw $v0, 4($t8) +j loop_35 +true_35: +li $t1, 1 +j end_35 +false_35: +li $t1, 0 +end_35: +# If not local_Razz_Razz_internal_3 goto next__465_0 +sw $t0, -0($fp) +sw $t1, -16($fp) +beqz $t1, next__465_0 +lw $t0, -0($fp) +lw $t1, -20($fp) +# Moving self to local_Razz_Razz_n_4 +move $t1, $t0 +sw $t1, -20($fp) +lw $t2, -4($fp) +# Moving local_Razz_Razz_n_4 to local_Razz_Razz_internal_0 +move $t2, $t1 +sw $t2, -4($fp) +sw $t0, -0($fp) +sw $t1, -20($fp) +sw $t2, -4($fp) +j end__459 +next__465_0: +lw $t0, -0($fp) +lw $t1, -24($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_36: +move $t8, $v0 +beqz $t8, false_36 +lw $v1, 0($t8) +beq $t9, $v1, true_36 +lw $v0, 4($t8) +j loop_36 +true_36: +li $t1, 1 +j end_36 +false_36: +li $t1, 0 +end_36: +# If not local_Razz_Razz_internal_5 goto next__473_1 +sw $t0, -0($fp) +sw $t1, -24($fp) +beqz $t1, next__473_1 +lw $t0, -0($fp) +lw $t1, -28($fp) +# Moving self to local_Razz_Razz_n_6 +move $t1, $t0 +sw $t1, -28($fp) +lw $t2, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Razz_Razz_internal_7 to local_Razz_Razz_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -32($fp) +sw $t1, -4($fp) +j end__459 +next__473_1: +lw $t0, -0($fp) +lw $t1, -36($fp) +la $t9, type_Foo +lw $v0, 8($t0) +loop_37: +move $t8, $v0 +beqz $t8, false_37 +lw $v1, 0($t8) +beq $t9, $v1, true_37 +lw $v0, 4($t8) +j loop_37 +true_37: +li $t1, 1 +j end_37 +false_37: +li $t1, 0 +end_37: +# If not local_Razz_Razz_internal_8 goto next__484_2 +sw $t0, -0($fp) +sw $t1, -36($fp) +beqz $t1, next__484_2 +lw $t0, -0($fp) +lw $t1, -40($fp) +# Moving self to local_Razz_Razz_n_9 +move $t1, $t0 +sw $t1, -40($fp) +lw $t2, -44($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Razz_Razz_internal_10 to local_Razz_Razz_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -44($fp) +sw $t1, -4($fp) +j end__459 +next__484_2: +lw $t0, -0($fp) +lw $t1, -48($fp) +la $t9, type_Bazz +lw $v0, 8($t0) +loop_38: +move $t8, $v0 +beqz $t8, false_38 +lw $v1, 0($t8) +beq $t9, $v1, true_38 +lw $v0, 4($t8) +j loop_38 +true_38: +li $t1, 1 +j end_38 +false_38: +li $t1, 0 +end_38: +# If not local_Razz_Razz_internal_11 goto next__495_3 +sw $t0, -0($fp) +sw $t1, -48($fp) +beqz $t1, next__495_3 +lw $t0, -0($fp) +lw $t1, -52($fp) +# Moving self to local_Razz_Razz_n_12 +move $t1, $t0 +sw $t1, -52($fp) +lw $t2, -56($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 32 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Foo +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 32 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Foo +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +# This function will consume the arguments +jal function_Foo_Foo +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Razz_Razz_internal_13 to local_Razz_Razz_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -56($fp) +sw $t1, -4($fp) +j end__459 +next__495_3: +la $a0, case_error +j .raise +error__459: +la $a0, case_void_error +j .raise +end__459: +lw $t0, -4($fp) +lw $t1, -0($fp) +# self . g <- SET local_Razz_Razz_internal_0 +sw $t0, 16($t1) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Initialize new node +li $a0, 12 +li $v0, 9 +syscall +la $t9, type_Int +sw $t9, 0($v0) +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Saving the methods of object +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t1) +lw $t2, -0($fp) +# self . i <- SET local_Razz_Razz_internal_15 +sw $t1, 20($t2) +lw $t3, -72($fp) +# local_Razz_Razz_internal_17 <- Type of self +lw $t3, 0($t2) +lw $t4, -76($fp) +# Saves in local_Razz_Razz_internal_18 data_0 +la $t4, data_0 +# local_Razz_Razz_internal_17 <- local_Razz_Razz_internal_17 = local_Razz_Razz_internal_18 +move $t8, $t3 +move $t9, $t4 +loop_39: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_39 +beqz $a1, mismatch_39 +seq $v0, $a0, $a1 +beqz $v0, mismatch_39 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_39 +mismatch_39: +li $v0, 0 +j end_39 +check_39: +bnez $a1, mismatch_39 +li $v0, 1 +end_39: +move $t3, $v0 +# If local_Razz_Razz_internal_17 goto error__518 +sw $t0, -60($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +sw $t3, -72($fp) +sw $t4, -76($fp) +bnez $t3, error__518 +lw $t0, -0($fp) +lw $t1, -80($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_40: +move $t8, $v0 +beqz $t8, false_40 +lw $v1, 0($t8) +beq $t9, $v1, true_40 +lw $v0, 4($t8) +j loop_40 +true_40: +li $t1, 1 +j end_40 +false_40: +li $t1, 0 +end_40: +# If not local_Razz_Razz_internal_19 goto next__524_0 +sw $t0, -0($fp) +sw $t1, -80($fp) +beqz $t1, next__524_0 +lw $t0, -0($fp) +lw $t1, -84($fp) +# Moving self to local_Razz_Razz_n_20 +move $t1, $t0 +sw $t1, -84($fp) +lw $t2, -68($fp) +# Moving local_Razz_Razz_n_20 to local_Razz_Razz_internal_16 +move $t2, $t1 +sw $t2, -68($fp) +sw $t0, -0($fp) +sw $t1, -84($fp) +sw $t2, -68($fp) +j end__518 +next__524_0: +lw $t0, -0($fp) +lw $t1, -88($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_41: +move $t8, $v0 +beqz $t8, false_41 +lw $v1, 0($t8) +beq $t9, $v1, true_41 +lw $v0, 4($t8) +j loop_41 +true_41: +li $t1, 1 +j end_41 +false_41: +li $t1, 0 +end_41: +# If not local_Razz_Razz_internal_21 goto next__532_1 +sw $t0, -0($fp) +sw $t1, -88($fp) +beqz $t1, next__532_1 +lw $t0, -0($fp) +lw $t1, -92($fp) +# Moving self to local_Razz_Razz_n_22 +move $t1, $t0 +sw $t1, -92($fp) +lw $t2, -96($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -92($fp) +sw $t2, -96($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Moving local_Razz_Razz_internal_23 to local_Razz_Razz_internal_16 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -96($fp) +sw $t1, -68($fp) +j end__518 +next__532_1: +lw $t0, -0($fp) +lw $t1, -100($fp) +la $t9, type_Foo +lw $v0, 8($t0) +loop_42: +move $t8, $v0 +beqz $t8, false_42 +lw $v1, 0($t8) +beq $t9, $v1, true_42 +lw $v0, 4($t8) +j loop_42 +true_42: +li $t1, 1 +j end_42 +false_42: +li $t1, 0 +end_42: +# If not local_Razz_Razz_internal_24 goto next__543_2 +sw $t0, -0($fp) +sw $t1, -100($fp) +beqz $t1, next__543_2 +lw $t0, -0($fp) +lw $t1, -104($fp) +# Moving self to local_Razz_Razz_n_25 +move $t1, $t0 +sw $t1, -104($fp) +lw $t2, -108($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -104($fp) +sw $t2, -108($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Moving local_Razz_Razz_internal_26 to local_Razz_Razz_internal_16 +move $t1, $t0 +sw $t1, -68($fp) +sw $t0, -108($fp) +sw $t1, -68($fp) +j end__518 +next__543_2: +la $a0, case_error +j .raise +error__518: +la $a0, case_void_error +j .raise +end__518: +lw $t0, -68($fp) +lw $t1, -0($fp) +# self . a <- SET local_Razz_Razz_internal_16 +sw $t0, 24($t1) +lw $t2, -124($fp) +# local_Razz_Razz_a_30 <- GET self . a +lw $t2, 24($t1) +lw $t3, -132($fp) +# local_Razz_Razz_internal_32 <- Type of local_Razz_Razz_a_30 +lw $t3, 0($t2) +lw $t4, -136($fp) +# Saves in local_Razz_Razz_internal_33 data_0 +la $t4, data_0 +# local_Razz_Razz_internal_32 <- local_Razz_Razz_internal_32 = local_Razz_Razz_internal_33 +move $t8, $t3 +move $t9, $t4 +loop_43: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_43 +beqz $a1, mismatch_43 +seq $v0, $a0, $a1 +beqz $v0, mismatch_43 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_43 +mismatch_43: +li $v0, 0 +j end_43 +check_43: +bnez $a1, mismatch_43 +li $v0, 1 +end_43: +move $t3, $v0 +# If not local_Razz_Razz_internal_32 goto continue__566 +sw $t0, -68($fp) +sw $t1, -0($fp) +sw $t2, -124($fp) +sw $t3, -132($fp) +sw $t4, -136($fp) +beqz $t3, continue__566 +la $a0, dispatch_error +j .raise +continue__566: +lw $t0, -124($fp) +lw $t1, -128($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -124($fp) +sw $t1, -128($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -128($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -140($fp) +# local_Razz_Razz_g_34 <- GET self . g +lw $t2, 16($t1) +lw $t3, -148($fp) +# local_Razz_Razz_internal_36 <- Type of local_Razz_Razz_g_34 +lw $t3, 0($t2) +lw $t4, -152($fp) +# Saves in local_Razz_Razz_internal_37 data_0 +la $t4, data_0 +# local_Razz_Razz_internal_36 <- local_Razz_Razz_internal_36 = local_Razz_Razz_internal_37 +move $t8, $t3 +move $t9, $t4 +loop_44: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_44 +beqz $a1, mismatch_44 +seq $v0, $a0, $a1 +beqz $v0, mismatch_44 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_44 +mismatch_44: +li $v0, 0 +j end_44 +check_44: +bnez $a1, mismatch_44 +li $v0, 1 +end_44: +move $t3, $v0 +# If not local_Razz_Razz_internal_36 goto continue__580 +sw $t0, -128($fp) +sw $t1, -0($fp) +sw $t2, -140($fp) +sw $t3, -148($fp) +sw $t4, -152($fp) +beqz $t3, continue__580 +la $a0, dispatch_error +j .raise +continue__580: +lw $t0, -140($fp) +lw $t1, -144($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -140($fp) +sw $t1, -144($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -144($fp) +# saves the return value +move $t0, $v0 +lw $t1, -128($fp) +lw $t2, -120($fp) +# local_Razz_Razz_internal_29 <- local_Razz_Razz_internal_31 + local_Razz_Razz_internal_35 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -156($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -144($fp) +sw $t1, -128($fp) +sw $t2, -120($fp) +sw $t3, -0($fp) +sw $t4, -156($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -156($fp) +# saves the return value +move $t0, $v0 +lw $t1, -120($fp) +lw $t2, -116($fp) +# local_Razz_Razz_internal_28 <- local_Razz_Razz_internal_29 + local_Razz_Razz_internal_38 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -160($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -156($fp) +sw $t1, -120($fp) +sw $t2, -116($fp) +sw $t3, -0($fp) +sw $t4, -160($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -160($fp) +# saves the return value +move $t0, $v0 +lw $t1, -116($fp) +lw $t2, -112($fp) +# local_Razz_Razz_internal_27 <- local_Razz_Razz_internal_28 + local_Razz_Razz_internal_39 +add $t2, $t1, $t0 +lw $t3, -0($fp) +# self . b <- SET local_Razz_Razz_internal_27 +sw $t2, 28($t3) +lw $t4, -168($fp) +# local_Razz_Razz_internal_41 <- Type of self +lw $t4, 0($t3) +lw $t5, -172($fp) +# Saves in local_Razz_Razz_internal_42 data_0 +la $t5, data_0 +# local_Razz_Razz_internal_41 <- local_Razz_Razz_internal_41 = local_Razz_Razz_internal_42 +move $t8, $t4 +move $t9, $t5 +loop_45: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_45 +beqz $a1, mismatch_45 +seq $v0, $a0, $a1 +beqz $v0, mismatch_45 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_45 +mismatch_45: +li $v0, 0 +j end_45 +check_45: +bnez $a1, mismatch_45 +li $v0, 1 +end_45: +move $t4, $v0 +# If local_Razz_Razz_internal_41 goto error__601 +sw $t0, -160($fp) +sw $t1, -116($fp) +sw $t2, -112($fp) +sw $t3, -0($fp) +sw $t4, -168($fp) +sw $t5, -172($fp) +bnez $t4, error__601 +lw $t0, -0($fp) +lw $t1, -176($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_46: +move $t8, $v0 +beqz $t8, false_46 +lw $v1, 0($t8) +beq $t9, $v1, true_46 +lw $v0, 4($t8) +j loop_46 +true_46: +li $t1, 1 +j end_46 +false_46: +li $t1, 0 +end_46: +# If not local_Razz_Razz_internal_43 goto next__607_0 +sw $t0, -0($fp) +sw $t1, -176($fp) +beqz $t1, next__607_0 +lw $t0, -0($fp) +lw $t1, -180($fp) +# Moving self to local_Razz_Razz_n_44 +move $t1, $t0 +sw $t1, -180($fp) +lw $t2, -164($fp) +# Moving local_Razz_Razz_n_44 to local_Razz_Razz_internal_40 +move $t2, $t1 +sw $t2, -164($fp) +sw $t0, -0($fp) +sw $t1, -180($fp) +sw $t2, -164($fp) +j end__601 +next__607_0: +lw $t0, -0($fp) +lw $t1, -184($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_47: +move $t8, $v0 +beqz $t8, false_47 +lw $v1, 0($t8) +beq $t9, $v1, true_47 +lw $v0, 4($t8) +j loop_47 +true_47: +li $t1, 1 +j end_47 +false_47: +li $t1, 0 +end_47: +# If not local_Razz_Razz_internal_45 goto next__615_1 +sw $t0, -0($fp) +sw $t1, -184($fp) +beqz $t1, next__615_1 +lw $t0, -0($fp) +lw $t1, -188($fp) +# Moving self to local_Razz_Razz_n_46 +move $t1, $t0 +sw $t1, -188($fp) +lw $t2, -192($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -188($fp) +sw $t2, -192($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -192($fp) +# saves the return value +move $t0, $v0 +lw $t1, -164($fp) +# Moving local_Razz_Razz_internal_47 to local_Razz_Razz_internal_40 +move $t1, $t0 +sw $t1, -164($fp) +sw $t0, -192($fp) +sw $t1, -164($fp) +j end__601 +next__615_1: +la $a0, case_error +j .raise +error__601: +la $a0, case_void_error +j .raise +end__601: +lw $t0, -164($fp) +lw $t1, -0($fp) +# self . e <- SET local_Razz_Razz_internal_40 +sw $t0, 32($t1) +lw $t2, -212($fp) +# local_Razz_Razz_a_52 <- GET self . a +lw $t2, 24($t1) +lw $t3, -220($fp) +# local_Razz_Razz_internal_54 <- Type of local_Razz_Razz_a_52 +lw $t3, 0($t2) +lw $t4, -224($fp) +# Saves in local_Razz_Razz_internal_55 data_0 +la $t4, data_0 +# local_Razz_Razz_internal_54 <- local_Razz_Razz_internal_54 = local_Razz_Razz_internal_55 +move $t8, $t3 +move $t9, $t4 +loop_48: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_48 +beqz $a1, mismatch_48 +seq $v0, $a0, $a1 +beqz $v0, mismatch_48 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_48 +mismatch_48: +li $v0, 0 +j end_48 +check_48: +bnez $a1, mismatch_48 +li $v0, 1 +end_48: +move $t3, $v0 +# If not local_Razz_Razz_internal_54 goto continue__639 +sw $t0, -164($fp) +sw $t1, -0($fp) +sw $t2, -212($fp) +sw $t3, -220($fp) +sw $t4, -224($fp) +beqz $t3, continue__639 +la $a0, dispatch_error +j .raise +continue__639: +lw $t0, -216($fp) +# Static Dispatch of the method doh +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -212($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -216($fp) +sw $t1, -212($fp) +# This function will consume the arguments +jal function_doh_Bazz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -216($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -228($fp) +# local_Razz_Razz_g_56 <- GET self . g +lw $t2, 16($t1) +lw $t3, -236($fp) +# local_Razz_Razz_internal_58 <- Type of local_Razz_Razz_g_56 +lw $t3, 0($t2) +lw $t4, -240($fp) +# Saves in local_Razz_Razz_internal_59 data_0 +la $t4, data_0 +# local_Razz_Razz_internal_58 <- local_Razz_Razz_internal_58 = local_Razz_Razz_internal_59 +move $t8, $t3 +move $t9, $t4 +loop_49: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_49 +beqz $a1, mismatch_49 +seq $v0, $a0, $a1 +beqz $v0, mismatch_49 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_49 +mismatch_49: +li $v0, 0 +j end_49 +check_49: +bnez $a1, mismatch_49 +li $v0, 1 +end_49: +move $t3, $v0 +# If not local_Razz_Razz_internal_58 goto continue__653 +sw $t0, -216($fp) +sw $t1, -0($fp) +sw $t2, -228($fp) +sw $t3, -236($fp) +sw $t4, -240($fp) +beqz $t3, continue__653 +la $a0, dispatch_error +j .raise +continue__653: +lw $t0, -228($fp) +lw $t1, -232($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -228($fp) +sw $t1, -232($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -232($fp) +# saves the return value +move $t0, $v0 +lw $t1, -216($fp) +lw $t2, -208($fp) +# local_Razz_Razz_internal_51 <- local_Razz_Razz_internal_53 + local_Razz_Razz_internal_57 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -244($fp) +# local_Razz_Razz_e_60 <- GET self . e +lw $t4, 32($t3) +lw $t5, -252($fp) +# local_Razz_Razz_internal_62 <- Type of local_Razz_Razz_e_60 +lw $t5, 0($t4) +lw $t6, -256($fp) +# Saves in local_Razz_Razz_internal_63 data_0 +la $t6, data_0 +# local_Razz_Razz_internal_62 <- local_Razz_Razz_internal_62 = local_Razz_Razz_internal_63 +move $t8, $t5 +move $t9, $t6 +loop_50: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_50 +beqz $a1, mismatch_50 +seq $v0, $a0, $a1 +beqz $v0, mismatch_50 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_50 +mismatch_50: +li $v0, 0 +j end_50 +check_50: +bnez $a1, mismatch_50 +li $v0, 1 +end_50: +move $t5, $v0 +# If not local_Razz_Razz_internal_62 goto continue__668 +sw $t0, -232($fp) +sw $t1, -216($fp) +sw $t2, -208($fp) +sw $t3, -0($fp) +sw $t4, -244($fp) +sw $t5, -252($fp) +sw $t6, -256($fp) +beqz $t5, continue__668 +la $a0, dispatch_error +j .raise +continue__668: +lw $t0, -244($fp) +lw $t1, -248($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -244($fp) +sw $t1, -248($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -248($fp) +# saves the return value +move $t0, $v0 +lw $t1, -208($fp) +lw $t2, -204($fp) +# local_Razz_Razz_internal_50 <- local_Razz_Razz_internal_51 + local_Razz_Razz_internal_61 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -260($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_doh_Foo +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -248($fp) +sw $t1, -208($fp) +sw $t2, -204($fp) +sw $t3, -0($fp) +sw $t4, -260($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -260($fp) +# saves the return value +move $t0, $v0 +lw $t1, -204($fp) +lw $t2, -200($fp) +# local_Razz_Razz_internal_49 <- local_Razz_Razz_internal_50 + local_Razz_Razz_internal_64 +add $t2, $t1, $t0 +lw $t3, -0($fp) +lw $t4, -264($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -260($fp) +sw $t1, -204($fp) +sw $t2, -200($fp) +sw $t3, -0($fp) +sw $t4, -264($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -264($fp) +# saves the return value +move $t0, $v0 +lw $t1, -200($fp) +lw $t2, -196($fp) +# local_Razz_Razz_internal_48 <- local_Razz_Razz_internal_49 + local_Razz_Razz_internal_65 +add $t2, $t1, $t0 +lw $t3, -0($fp) +# self . f <- SET local_Razz_Razz_internal_48 +sw $t2, 36($t3) +lw $t4, -268($fp) +# Moving self to local_Razz_Razz_internal_66 +move $t4, $t3 +sw $t4, -268($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -264($fp) +sw $t1, -200($fp) +sw $t2, -196($fp) +sw $t3, -0($fp) +sw $t4, -268($fp) +# Removing all locals from stack +addiu $sp, $sp, 272 +jr $ra + + +function_Bazz_Bazz: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Bazz_Bazz_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_n_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_n_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_n_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_n_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Bazz_Bazz_internal_16 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . h <- SET 1 +li $t9, 1 +sw $t9, 12($t0) +lw $t1, -8($fp) +# local_Bazz_Bazz_internal_1 <- Type of self +lw $t1, 0($t0) +lw $t2, -12($fp) +# Saves in local_Bazz_Bazz_internal_2 data_0 +la $t2, data_0 +# local_Bazz_Bazz_internal_1 <- local_Bazz_Bazz_internal_1 = local_Bazz_Bazz_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_51: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_51 +beqz $a1, mismatch_51 +seq $v0, $a0, $a1 +beqz $v0, mismatch_51 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_51 +mismatch_51: +li $v0, 0 +j end_51 +check_51: +bnez $a1, mismatch_51 +li $v0, 1 +end_51: +move $t1, $v0 +# If local_Bazz_Bazz_internal_1 goto error__695 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +bnez $t1, error__695 +lw $t0, -0($fp) +lw $t1, -16($fp) +la $t9, type_Bar +lw $v0, 8($t0) +loop_52: +move $t8, $v0 +beqz $t8, false_52 +lw $v1, 0($t8) +beq $t9, $v1, true_52 +lw $v0, 4($t8) +j loop_52 +true_52: +li $t1, 1 +j end_52 +false_52: +li $t1, 0 +end_52: +# If not local_Bazz_Bazz_internal_3 goto next__701_0 +sw $t0, -0($fp) +sw $t1, -16($fp) +beqz $t1, next__701_0 +lw $t0, -0($fp) +lw $t1, -20($fp) +# Moving self to local_Bazz_Bazz_n_4 +move $t1, $t0 +sw $t1, -20($fp) +lw $t2, -4($fp) +# Moving local_Bazz_Bazz_n_4 to local_Bazz_Bazz_internal_0 +move $t2, $t1 +sw $t2, -4($fp) +sw $t0, -0($fp) +sw $t1, -20($fp) +sw $t2, -4($fp) +j end__695 +next__701_0: +lw $t0, -0($fp) +lw $t1, -24($fp) +la $t9, type_Razz +lw $v0, 8($t0) +loop_53: +move $t8, $v0 +beqz $t8, false_53 +lw $v1, 0($t8) +beq $t9, $v1, true_53 +lw $v0, 4($t8) +j loop_53 +true_53: +li $t1, 1 +j end_53 +false_53: +li $t1, 0 +end_53: +# If not local_Bazz_Bazz_internal_5 goto next__709_1 +sw $t0, -0($fp) +sw $t1, -24($fp) +beqz $t1, next__709_1 +lw $t0, -0($fp) +lw $t1, -28($fp) +# Moving self to local_Bazz_Bazz_n_6 +move $t1, $t0 +sw $t1, -28($fp) +lw $t2, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Bazz_Bazz_internal_7 to local_Bazz_Bazz_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -32($fp) +sw $t1, -4($fp) +j end__695 +next__709_1: +lw $t0, -0($fp) +lw $t1, -36($fp) +la $t9, type_Foo +lw $v0, 8($t0) +loop_54: +move $t8, $v0 +beqz $t8, false_54 +lw $v1, 0($t8) +beq $t9, $v1, true_54 +lw $v0, 4($t8) +j loop_54 +true_54: +li $t1, 1 +j end_54 +false_54: +li $t1, 0 +end_54: +# If not local_Bazz_Bazz_internal_8 goto next__720_2 +sw $t0, -0($fp) +sw $t1, -36($fp) +beqz $t1, next__720_2 +lw $t0, -0($fp) +lw $t1, -40($fp) +# Moving self to local_Bazz_Bazz_n_9 +move $t1, $t0 +sw $t1, -40($fp) +lw $t2, -44($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Bazz_Bazz_internal_10 to local_Bazz_Bazz_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -44($fp) +sw $t1, -4($fp) +j end__695 +next__720_2: +lw $t0, -0($fp) +lw $t1, -48($fp) +la $t9, type_Bazz +lw $v0, 8($t0) +loop_55: +move $t8, $v0 +beqz $t8, false_55 +lw $v1, 0($t8) +beq $t9, $v1, true_55 +lw $v0, 4($t8) +j loop_55 +true_55: +li $t1, 1 +j end_55 +false_55: +li $t1, 0 +end_55: +# If not local_Bazz_Bazz_internal_11 goto next__731_3 +sw $t0, -0($fp) +sw $t1, -48($fp) +beqz $t1, next__731_3 +lw $t0, -0($fp) +lw $t1, -52($fp) +# Moving self to local_Bazz_Bazz_n_12 +move $t1, $t0 +sw $t1, -52($fp) +lw $t2, -56($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 32 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Foo +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 32 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Foo +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +# This function will consume the arguments +jal function_Foo_Foo +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_Bazz_Bazz_internal_13 to local_Bazz_Bazz_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +sw $t0, -56($fp) +sw $t1, -4($fp) +j end__695 +next__731_3: +la $a0, case_error +j .raise +error__695: +la $a0, case_void_error +j .raise +end__695: +lw $t0, -4($fp) +lw $t1, -0($fp) +# self . g <- SET local_Bazz_Bazz_internal_0 +sw $t0, 16($t1) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_printh_Bazz +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Initialize new node +li $a0, 12 +li $v0, 9 +syscall +la $t9, type_Int +sw $t9, 0($v0) +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Saving the methods of object +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t1) +lw $t2, -0($fp) +# self . i <- SET local_Bazz_Bazz_internal_15 +sw $t1, 20($t2) +lw $t3, -68($fp) +# Moving self to local_Bazz_Bazz_internal_16 +move $t3, $t2 +sw $t3, -68($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -60($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +sw $t3, -68($fp) +# Removing all locals from stack +addiu $sp, $sp, 72 +jr $ra + + +function_printh_Bazz: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_printh_Bazz_h_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_printh_Bazz_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_printh_Bazz_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_printh_Bazz_h_0 <- GET self . h +lw $t1, 12($t0) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving 0 to local_printh_Bazz_internal_2 +li $t1, 0 +sw $t1, -12($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_doh_Bazz: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_doh_Bazz_i_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Bazz_h_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Bazz_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Bazz_h_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_doh_Bazz_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_doh_Bazz_h_1 <- GET self . h +lw $t1, 12($t0) +lw $t2, -4($fp) +# Moving local_doh_Bazz_h_1 to local_doh_Bazz_i_0 +move $t2, $t1 +sw $t2, -4($fp) +lw $t3, -16($fp) +# local_doh_Bazz_h_3 <- GET self . h +lw $t3, 12($t0) +lw $t4, -12($fp) +# local_doh_Bazz_internal_2 <- local_doh_Bazz_h_3 + 1 +addi $t4, $t3, 1 +# self . h <- SET local_doh_Bazz_internal_2 +sw $t4, 12($t0) +lw $t5, -20($fp) +# Moving local_doh_Bazz_i_0 to local_doh_Bazz_internal_4 +move $t5, $t2 +sw $t5, -20($fp) +move $v0, $t5 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -4($fp) +sw $t3, -16($fp) +sw $t4, -12($fp) +sw $t5, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 24 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bazz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 24 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Bazz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# This function will consume the arguments +jal function_Bazz_Bazz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . a <- SET local_Main_Main_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 32 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Foo +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 32 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Foo +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal function_Foo_Foo +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . b <- SET local_Main_Main_internal_1 +sw $t0, 16($t1) +lw $t2, -12($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 40 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Razz +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 40 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Razz +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal function_Razz_Razz +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . c <- SET local_Main_Main_internal_2 +sw $t0, 20($t1) +lw $t2, -16($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 48 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Bar +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 48 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method Bar +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -16($fp) +# This function will consume the arguments +jal function_Bar_Bar +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . d <- SET local_Main_Main_internal_3 +sw $t0, 24($t1) +lw $t2, -20($fp) +# Moving self to local_Main_Main_internal_4 +move $t2, $t1 +sw $t2, -20($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Foo: .asciiz "Foo" +type_Bar: .asciiz "Bar" +type_Razz: .asciiz "Razz" +type_Bazz: .asciiz "Bazz" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "do nothing" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/hello_world.cl b/tests/codegen/hello_world.cl old mode 100755 new mode 100644 index 0c818f90..b0a180a2 --- a/tests/codegen/hello_world.cl +++ b/tests/codegen/hello_world.cl @@ -1,5 +1,5 @@ -class Main inherits IO { - main(): IO { - out_string("Hello, World.\n") - }; -}; +class Main inherits IO { + main(): IO { + out_string("Hello, World.\n") + }; +}; diff --git a/tests/codegen/hello_world.mips b/tests/codegen/hello_world.mips new file mode 100644 index 00000000..5b9e044e --- /dev/null +++ b/tests/codegen/hello_world.mips @@ -0,0 +1,1028 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_main_Main +sw $t9, 80($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 36 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello, World. +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/io.cl b/tests/codegen/io.cl old mode 100755 new mode 100644 index 7f0de869..42ee6854 --- a/tests/codegen/io.cl +++ b/tests/codegen/io.cl @@ -1,103 +1,103 @@ -(* - * The IO class is predefined and has 4 methods: - * - * out_string(s : String) : SELF_TYPE - * out_int(i : Int) : SELF_TYPE - * in_string() : String - * in_int() : Int - * - * The out operations print their argument to the terminal. The - * in_string method reads an entire line from the terminal and returns a - * string not containing the new line. The in_int method also reads - * an entire line from the terminal and returns the integer - * corresponding to the first non blank word on the line. If that - * word is not an integer, it returns 0. - * - * - * Because our language is object oriented, we need an object of type - * IO in order to call any of these methods. - * - * There are basically two ways of getting access to IO in a class C. - * - * 1) Define C to Inherit from IO. This way the IO methods become - * methods of C, and they can be called using the abbreviated - * dispatch, i.e. - * - * class C inherits IO is - * ... - * out_string("Hello world\n") - * ... - * end; - * - * 2) If your class C does not directly or indirectly inherit from - * IO, the best way to access IO is through an initialized - * attribute of type IO. - * - * class C inherits Foo is - * io : IO <- new IO; - * ... - * io.out_string("Hello world\n"); - * ... - * end; - * - * Approach 1) is most often used, in particular when you need IO - * functions in the Main class. - * - *) - - -class A { - - -- Let's assume that we don't want A to not inherit from IO. - - io : IO <- new IO; - - out_a() : Object { io.out_string("A: Hello world\n") }; - -}; - - -class B inherits A { - - -- B does not have to an extra attribute, since it inherits io from A. - - out_b() : Object { io.out_string("B: Hello world\n") }; - -}; - - -class C inherits IO { - - -- Now the IO methods are part of C. - - out_c() : Object { out_string("C: Hello world\n") }; - - -- Note that out_string(...) is just a shorthand for self.out_string(...) - -}; - - -class D inherits C { - - -- Inherits IO methods from C. - - out_d() : Object { out_string("D: Hello world\n") }; - -}; - - -class Main inherits IO { - - -- Same case as class C. - - main() : Object { - { - (new A).out_a(); - (new B).out_b(); - (new C).out_c(); - (new D).out_d(); - out_string("Done.\n"); - } - }; - -}; +(* + * The IO class is predefined and has 4 methods: + * + * out_string(s : String) : SELF_TYPE + * out_int(i : Int) : SELF_TYPE + * in_string() : String + * in_int() : Int + * + * The out operations print their argument to the terminal. The + * in_string method reads an entire line from the terminal and returns a + * string not containing the new line. The in_int method also reads + * an entire line from the terminal and returns the integer + * corresponding to the first non blank word on the line. If that + * word is not an integer, it returns 0. + * + * + * Because our language is object oriented, we need an object of type + * IO in order to call any of these methods. + * + * There are basically two ways of getting access to IO in a class C. + * + * 1) Define C to Inherit from IO. This way the IO methods become + * methods of C, and they can be called using the abbreviated + * dispatch, i.e. + * + * class C inherits IO is + * ... + * out_string("Hello world\n") + * ... + * end; + * + * 2) If your class C does not directly or indirectly inherit from + * IO, the best way to access IO is through an initialized + * attribute of type IO. + * + * class C inherits Foo is + * io : IO <- new IO; + * ... + * io.out_string("Hello world\n"); + * ... + * end; + * + * Approach 1) is most often used, in particular when you need IO + * functions in the Main class. + * + *) + + +class A { + + -- Let's assume that we don't want A to not inherit from IO. + + io : IO <- new IO; + + out_a() : Object { io.out_string("A: Hello world\n") }; + +}; + + +class B inherits A { + + -- B does not have to an extra attribute, since it inherits io from A. + + out_b() : Object { io.out_string("B: Hello world\n") }; + +}; + + +class C inherits IO { + + -- Now the IO methods are part of C. + + out_c() : Object { out_string("C: Hello world\n") }; + + -- Note that out_string(...) is just a shorthand for self.out_string(...) + +}; + + +class D inherits C { + + -- Inherits IO methods from C. + + out_d() : Object { out_string("D: Hello world\n") }; + +}; + + +class Main inherits IO { + + -- Same case as class C. + + main() : Object { + { + (new A).out_a(); + (new B).out_b(); + (new C).out_c(); + (new D).out_d(); + out_string("Done.\n"); + } + }; + +}; diff --git a/tests/codegen/io.mips b/tests/codegen/io.mips new file mode 100644 index 00000000..a9fff600 --- /dev/null +++ b/tests/codegen/io.mips @@ -0,0 +1,2073 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_A_A +sw $t9, 80($v0) +la $t9, function_out_a_A +sw $t9, 84($v0) +la $t9, function_B_B +sw $t9, 88($v0) +la $t9, function_out_b_B +sw $t9, 92($v0) +la $t9, function_out_c_C +sw $t9, 96($v0) +la $t9, function_out_d_D +sw $t9, 100($v0) +la $t9, function_main_Main +sw $t9, 104($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 24 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_a_A in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_A_A in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_a_A in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_A_A in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_out_b_B in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_B_B in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 36 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_out_c_C in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_D +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_out_c_C in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_out_d_D in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 36($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 36 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 28($t9) +sw $t8, 4($v0) +lw $v0, 36($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_A_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_A_A_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_A_A_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_IO +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 16($t8) +sw $v0, 8($t0) +lw $t1, -0($fp) +# self . io <- SET local_A_A_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_A_A_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_a_A: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_a_A_io_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_a_A_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_a_A_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_a_A_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_a_A_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_out_a_A_io_0 <- GET self . io +lw $t1, 12($t0) +lw $t2, -8($fp) +# Saves in local_out_a_A_internal_1 data_1 +la $t2, data_1 +lw $t3, -16($fp) +# local_out_a_A_internal_3 <- Type of local_out_a_A_io_0 +lw $t3, 0($t1) +lw $t4, -20($fp) +# Saves in local_out_a_A_internal_4 data_0 +la $t4, data_0 +# local_out_a_A_internal_3 <- local_out_a_A_internal_3 = local_out_a_A_internal_4 +move $t8, $t3 +move $t9, $t4 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t3, $v0 +# If not local_out_a_A_internal_3 goto continue__64 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +sw $t3, -16($fp) +sw $t4, -20($fp) +beqz $t3, continue__64 +la $a0, dispatch_error +j .raise +continue__64: +lw $t0, -4($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_B_B: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_B_B_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_B_B_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_IO +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 16($t8) +sw $v0, 8($t0) +lw $t1, -0($fp) +# self . io <- SET local_B_B_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_B_B_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_b_B: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_b_B_io_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_b_B_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_b_B_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_b_B_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_b_B_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_out_b_B_io_0 <- GET self . io +lw $t1, 12($t0) +lw $t2, -8($fp) +# Saves in local_out_b_B_internal_1 data_2 +la $t2, data_2 +lw $t3, -16($fp) +# local_out_b_B_internal_3 <- Type of local_out_b_B_io_0 +lw $t3, 0($t1) +lw $t4, -20($fp) +# Saves in local_out_b_B_internal_4 data_0 +la $t4, data_0 +# local_out_b_B_internal_3 <- local_out_b_B_internal_3 = local_out_b_B_internal_4 +move $t8, $t3 +move $t9, $t4 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t3, $v0 +# If not local_out_b_B_internal_3 goto continue__93 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +sw $t3, -16($fp) +sw $t4, -20($fp) +beqz $t3, continue__93 +la $a0, dispatch_error +j .raise +continue__93: +lw $t0, -4($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_out_c_C: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_c_C_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_c_C_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_out_c_C_internal_0 data_3 +la $t0, data_3 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_d_D: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_d_D_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_out_d_D_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_out_d_D_internal_0 data_4 +la $t0, data_4 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method A +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# This function will consume the arguments +jal function_A_A +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# local_main_Main_internal_2 <- Type of local_main_Main_internal_0 +lw $t1, 0($t0) +lw $t2, -16($fp) +# Saves in local_main_Main_internal_3 data_0 +la $t2, data_0 +# local_main_Main_internal_2 <- local_main_Main_internal_2 = local_main_Main_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t1, $v0 +# If not local_main_Main_internal_2 goto continue__131 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +beqz $t1, continue__131 +la $a0, dispatch_error +j .raise +continue__131: +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_a_A +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +# Static Dispatch of the method B +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -20($fp) +# This function will consume the arguments +jal function_B_B +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# local_main_Main_internal_6 <- Type of local_main_Main_internal_4 +lw $t1, 0($t0) +lw $t2, -32($fp) +# Saves in local_main_Main_internal_7 data_0 +la $t2, data_0 +# local_main_Main_internal_6 <- local_main_Main_internal_6 = local_main_Main_internal_7 +move $t8, $t1 +move $t9, $t2 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t1, $v0 +# If not local_main_Main_internal_6 goto continue__146 +sw $t0, -20($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +beqz $t1, continue__146 +la $a0, dispatch_error +j .raise +continue__146: +lw $t0, -20($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_b_B +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# local_main_Main_internal_10 <- Type of local_main_Main_internal_8 +lw $t2, 0($t1) +lw $t3, -48($fp) +# Saves in local_main_Main_internal_11 data_0 +la $t3, data_0 +# local_main_Main_internal_10 <- local_main_Main_internal_10 = local_main_Main_internal_11 +move $t8, $t2 +move $t9, $t3 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t2, $v0 +# If not local_main_Main_internal_10 goto continue__160 +sw $t0, -24($fp) +sw $t1, -36($fp) +sw $t2, -44($fp) +sw $t3, -48($fp) +beqz $t2, continue__160 +la $a0, dispatch_error +j .raise +continue__160: +lw $t0, -36($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_c_C +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_D +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t1) +lw $t2, -60($fp) +# local_main_Main_internal_14 <- Type of local_main_Main_internal_12 +lw $t2, 0($t1) +lw $t3, -64($fp) +# Saves in local_main_Main_internal_15 data_0 +la $t3, data_0 +# local_main_Main_internal_14 <- local_main_Main_internal_14 = local_main_Main_internal_15 +move $t8, $t2 +move $t9, $t3 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t2, $v0 +# If not local_main_Main_internal_14 goto continue__174 +sw $t0, -40($fp) +sw $t1, -52($fp) +sw $t2, -60($fp) +sw $t3, -64($fp) +beqz $t2, continue__174 +la $a0, dispatch_error +j .raise +continue__174: +lw $t0, -52($fp) +lw $t1, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_d_D +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -68($fp) +# Saves in local_main_Main_internal_16 data_5 +la $t1, data_5 +lw $t2, -0($fp) +lw $t3, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -68($fp) +sw $t2, -0($fp) +sw $t3, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -76($fp) +# Moving local_main_Main_internal_17 to local_main_Main_internal_18 +move $t1, $t0 +sw $t1, -76($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -72($fp) +sw $t1, -76($fp) +# Removing all locals from stack +addiu $sp, $sp, 80 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_D: .asciiz "D" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "A: Hello world +" +data_2: .asciiz "B: Hello world +" +data_3: .asciiz "C: Hello world +" +data_4: .asciiz "D: Hello world +" +data_5: .asciiz "Done. +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/life.cl b/tests/codegen/life.cl old mode 100755 new mode 100644 index b83d9795..7d7a41fd --- a/tests/codegen/life.cl +++ b/tests/codegen/life.cl @@ -1,436 +1,436 @@ -(* The Game of Life - Tendo Kayiira, Summer '95 - With code taken from /private/cool/class/examples/cells.cl - - This introduction was taken off the internet. It gives a brief - description of the Game Of Life. It also gives the rules by which - this particular game follows. - - Introduction - - John Conway's Game of Life is a mathematical amusement, but it - is also much more: an insight into how a system of simple - cellualar automata can create complex, odd, and often aesthetically - pleasing patterns. It is played on a cartesian grid of cells - which are either 'on' or 'off' The game gets it's name from the - similarity between the behaviour of these cells and the behaviour - of living organisms. - - The Rules - - The playfield is a cartesian grid of arbitrary size. Each cell in - this grid can be in an 'on' state or an 'off' state. On each 'turn' - (called a generation,) the state of each cell changes simultaneously - depending on it's state and the state of all cells adjacent to it. - - For 'on' cells, - If the cell has 0 or 1 neighbours which are 'on', the cell turns - 'off'. ('dies of loneliness') - If the cell has 2 or 3 neighbours which are 'on', the cell stays - 'on'. (nothing happens to that cell) - If the cell has 4, 5, 6, 7, 8, or 9 neighbours which are 'on', - the cell turns 'off'. ('dies of overcrowding') - - For 'off' cells, - If the cell has 0, 1, 2, 4, 5, 6, 7, 8, or 9 neighbours which - are 'on', the cell stays 'off'. (nothing happens to that cell) - If the cell has 3 neighbours which are 'on', the cell turns - 'on'. (3 neighbouring 'alive' cells 'give birth' to a fourth.) - - Repeat for as many generations as desired. - - *) - - -class Board inherits IO { - - rows : Int; - columns : Int; - board_size : Int; - - size_of_board(initial : String) : Int { - initial.length() - }; - - board_init(start : String) : Board { - (let size :Int <- size_of_board(start) in - { - if size = 15 then - { - rows <- 3; - columns <- 5; - board_size <- size; - } - else if size = 16 then - { - rows <- 4; - columns <- 4; - board_size <- size; - } - else if size = 20 then - { - rows <- 4; - columns <- 5; - board_size <- size; - } - else if size = 21 then - { - rows <- 3; - columns <- 7; - board_size <- size; - } - else if size = 25 then - { - rows <- 5; - columns <- 5; - board_size <- size; - } - else if size = 28 then - { - rows <- 7; - columns <- 4; - board_size <- size; - } - else -- If none of the above fit, then just give - { -- the configuration of the most common board - rows <- 5; - columns <- 5; - board_size <- size; - } - fi fi fi fi fi fi; - self; - } - ) - }; - -}; - - - -class CellularAutomaton inherits Board { - population_map : String; - - init(map : String) : CellularAutomaton { - { - population_map <- map; - board_init(map); - self; - } - }; - - - - - print() : CellularAutomaton { - - (let i : Int <- 0 in - (let num : Int <- board_size in - { - out_string("\n"); - while i < num loop - { - out_string(population_map.substr(i,columns)); - out_string("\n"); - i <- i + columns; - } - pool; - out_string("\n"); - self; - } - ) ) - }; - - num_cells() : Int { - population_map.length() - }; - - cell(position : Int) : String { - if board_size - 1 < position then - " " - else - population_map.substr(position, 1) - fi - }; - - north(position : Int): String { - if (position - columns) < 0 then - " " - else - cell(position - columns) - fi - }; - - south(position : Int): String { - if board_size < (position + columns) then - " " - else - cell(position + columns) - fi - }; - - east(position : Int): String { - if (((position + 1) /columns ) * columns) = (position + 1) then - " " - else - cell(position + 1) - fi - }; - - west(position : Int): String { - if position = 0 then - " " - else - if ((position / columns) * columns) = position then - " " - else - cell(position - 1) - fi fi - }; - - northwest(position : Int): String { - if (position - columns) < 0 then - " " - else if ((position / columns) * columns) = position then - " " - else - north(position - 1) - fi fi - }; - - northeast(position : Int): String { - if (position - columns) < 0 then - " " - else if (((position + 1) /columns ) * columns) = (position + 1) then - " " - else - north(position + 1) - fi fi - }; - - southeast(position : Int): String { - if board_size < (position + columns) then - " " - else if (((position + 1) /columns ) * columns) = (position + 1) then - " " - else - south(position + 1) - fi fi - }; - - southwest(position : Int): String { - if board_size < (position + columns) then - " " - else if ((position / columns) * columns) = position then - " " - else - south(position - 1) - fi fi - }; - - neighbors(position: Int): Int { - { - if north(position) = "X" then 1 else 0 fi - + if south(position) = "X" then 1 else 0 fi - + if east(position) = "X" then 1 else 0 fi - + if west(position) = "X" then 1 else 0 fi - + if northeast(position) = "X" then 1 else 0 fi - + if northwest(position) = "X" then 1 else 0 fi - + if southeast(position) = "X" then 1 else 0 fi - + if southwest(position) = "X" then 1 else 0 fi; - } - }; - - -(* A cell will live if 2 or 3 of it's neighbors are alive. It dies - otherwise. A cell is born if only 3 of it's neighbors are alive. *) - - cell_at_next_evolution(position : Int) : String { - - if neighbors(position) = 3 then - "X" - else - if neighbors(position) = 2 then - if cell(position) = "X" then - "X" - else - "-" - fi - else - "-" - fi fi - }; - - - evolve() : CellularAutomaton { - (let position : Int <- 0 in - (let num : Int <- num_cells() in - (let temp : String in - { - while position < num loop - { - temp <- temp.concat(cell_at_next_evolution(position)); - position <- position + 1; - } - pool; - population_map <- temp; - self; - } - ) ) ) - }; - -(* This is where the background pattern is detremined by the user. More - patterns can be added as long as whoever adds keeps the board either - 3x5, 4x5, 5x5, 3x7, 7x4, 4x4 with the row first then column. *) - option(): String { - { - (let num : Int in - { - out_string("\nPlease chose a number:\n"); - out_string("\t1: A cross\n"); - out_string("\t2: A slash from the upper left to lower right\n"); - out_string("\t3: A slash from the upper right to lower left\n"); - out_string("\t4: An X\n"); - out_string("\t5: A greater than sign \n"); - out_string("\t6: A less than sign\n"); - out_string("\t7: Two greater than signs\n"); - out_string("\t8: Two less than signs\n"); - out_string("\t9: A 'V'\n"); - out_string("\t10: An inverse 'V'\n"); - out_string("\t11: Numbers 9 and 10 combined\n"); - out_string("\t12: A full grid\n"); - out_string("\t13: A 'T'\n"); - out_string("\t14: A plus '+'\n"); - out_string("\t15: A 'W'\n"); - out_string("\t16: An 'M'\n"); - out_string("\t17: An 'E'\n"); - out_string("\t18: A '3'\n"); - out_string("\t19: An 'O'\n"); - out_string("\t20: An '8'\n"); - out_string("\t21: An 'S'\n"); - out_string("Your choice => "); - num <- in_int(); - out_string("\n"); - if num = 1 then - " XX XXXX XXXX XX " - else if num = 2 then - " X X X X X " - else if num = 3 then - "X X X X X" - else if num = 4 then - "X X X X X X X X X" - else if num = 5 then - "X X X X X " - else if num = 6 then - " X X X X X" - else if num = 7 then - "X X X XX X " - else if num = 8 then - " X XX X X X " - else if num = 9 then - "X X X X X " - else if num = 10 then - " X X X X X" - else if num = 11 then - "X X X X X X X X" - else if num = 12 then - "XXXXXXXXXXXXXXXXXXXXXXXXX" - else if num = 13 then - "XXXXX X X X X " - else if num = 14 then - " X X XXXXX X X " - else if num = 15 then - "X X X X X X X " - else if num = 16 then - " X X X X X X X" - else if num = 17 then - "XXXXX X XXXXX X XXXX" - else if num = 18 then - "XXX X X X X XXXX " - else if num = 19 then - " XX X XX X XX " - else if num = 20 then - " XX X XX X XX X XX X XX " - else if num = 21 then - " XXXX X XX X XXXX " - else - " " - fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi; - } - ); - } - }; - - - - - prompt() : Bool { - { - (let ans : String in - { - out_string("Would you like to continue with the next generation? \n"); - out_string("Please use lowercase y or n for your answer [y]: "); - ans <- in_string(); - out_string("\n"); - if ans = "n" then - false - else - true - fi; - } - ); - } - }; - - - prompt2() : Bool { - (let ans : String in - { - out_string("\n\n"); - out_string("Would you like to choose a background pattern? \n"); - out_string("Please use lowercase y or n for your answer [n]: "); - ans <- in_string(); - if ans = "y" then - true - else - false - fi; - } - ) - }; - - -}; - -class Main inherits CellularAutomaton { - cells : CellularAutomaton; - - main() : Main { - { - (let continue : Bool in - (let choice : String in - { - out_string("Welcome to the Game of Life.\n"); - out_string("There are many initial states to choose from. \n"); - while prompt2() loop - { - continue <- true; - choice <- option(); - cells <- (new CellularAutomaton).init(choice); - cells.print(); - while continue loop - if prompt() then - { - cells.evolve(); - cells.print(); - } - else - continue <- false - fi - pool; - } - pool; - self; - } ) ); } - }; -}; - +(* The Game of Life + Tendo Kayiira, Summer '95 + With code taken from /private/cool/class/examples/cells.cl + + This introduction was taken off the internet. It gives a brief + description of the Game Of Life. It also gives the rules by which + this particular game follows. + + Introduction + + John Conway's Game of Life is a mathematical amusement, but it + is also much more: an insight into how a system of simple + cellualar automata can create complex, odd, and often aesthetically + pleasing patterns. It is played on a cartesian grid of cells + which are either 'on' or 'off' The game gets it's name from the + similarity between the behaviour of these cells and the behaviour + of living organisms. + + The Rules + + The playfield is a cartesian grid of arbitrary size. Each cell in + this grid can be in an 'on' state or an 'off' state. On each 'turn' + (called a generation,) the state of each cell changes simultaneously + depending on it's state and the state of all cells adjacent to it. + + For 'on' cells, + If the cell has 0 or 1 neighbours which are 'on', the cell turns + 'off'. ('dies of loneliness') + If the cell has 2 or 3 neighbours which are 'on', the cell stays + 'on'. (nothing happens to that cell) + If the cell has 4, 5, 6, 7, 8, or 9 neighbours which are 'on', + the cell turns 'off'. ('dies of overcrowding') + + For 'off' cells, + If the cell has 0, 1, 2, 4, 5, 6, 7, 8, or 9 neighbours which + are 'on', the cell stays 'off'. (nothing happens to that cell) + If the cell has 3 neighbours which are 'on', the cell turns + 'on'. (3 neighbouring 'alive' cells 'give birth' to a fourth.) + + Repeat for as many generations as desired. + + *) + + +class Board inherits IO { + + rows : Int; + columns : Int; + board_size : Int; + + size_of_board(initial : String) : Int { + initial.length() + }; + + board_init(start : String) : Board { + (let size :Int <- size_of_board(start) in + { + if size = 15 then + { + rows <- 3; + columns <- 5; + board_size <- size; + } + else if size = 16 then + { + rows <- 4; + columns <- 4; + board_size <- size; + } + else if size = 20 then + { + rows <- 4; + columns <- 5; + board_size <- size; + } + else if size = 21 then + { + rows <- 3; + columns <- 7; + board_size <- size; + } + else if size = 25 then + { + rows <- 5; + columns <- 5; + board_size <- size; + } + else if size = 28 then + { + rows <- 7; + columns <- 4; + board_size <- size; + } + else -- If none of the above fit, then just give + { -- the configuration of the most common board + rows <- 5; + columns <- 5; + board_size <- size; + } + fi fi fi fi fi fi; + self; + } + ) + }; + +}; + + + +class CellularAutomaton inherits Board { + population_map : String; + + init(map : String) : CellularAutomaton { + { + population_map <- map; + board_init(map); + self; + } + }; + + + + + print() : CellularAutomaton { + + (let i : Int <- 0 in + (let num : Int <- board_size in + { + out_string("\n"); + while i < num loop + { + out_string(population_map.substr(i,columns)); + out_string("\n"); + i <- i + columns; + } + pool; + out_string("\n"); + self; + } + ) ) + }; + + num_cells() : Int { + population_map.length() + }; + + cell(position : Int) : String { + if board_size - 1 < position then + " " + else + population_map.substr(position, 1) + fi + }; + + north(position : Int): String { + if (position - columns) < 0 then + " " + else + cell(position - columns) + fi + }; + + south(position : Int): String { + if board_size < (position + columns) then + " " + else + cell(position + columns) + fi + }; + + east(position : Int): String { + if (((position + 1) /columns ) * columns) = (position + 1) then + " " + else + cell(position + 1) + fi + }; + + west(position : Int): String { + if position = 0 then + " " + else + if ((position / columns) * columns) = position then + " " + else + cell(position - 1) + fi fi + }; + + northwest(position : Int): String { + if (position - columns) < 0 then + " " + else if ((position / columns) * columns) = position then + " " + else + north(position - 1) + fi fi + }; + + northeast(position : Int): String { + if (position - columns) < 0 then + " " + else if (((position + 1) /columns ) * columns) = (position + 1) then + " " + else + north(position + 1) + fi fi + }; + + southeast(position : Int): String { + if board_size < (position + columns) then + " " + else if (((position + 1) /columns ) * columns) = (position + 1) then + " " + else + south(position + 1) + fi fi + }; + + southwest(position : Int): String { + if board_size < (position + columns) then + " " + else if ((position / columns) * columns) = position then + " " + else + south(position - 1) + fi fi + }; + + neighbors(position: Int): Int { + { + if north(position) = "X" then 1 else 0 fi + + if south(position) = "X" then 1 else 0 fi + + if east(position) = "X" then 1 else 0 fi + + if west(position) = "X" then 1 else 0 fi + + if northeast(position) = "X" then 1 else 0 fi + + if northwest(position) = "X" then 1 else 0 fi + + if southeast(position) = "X" then 1 else 0 fi + + if southwest(position) = "X" then 1 else 0 fi; + } + }; + + +(* A cell will live if 2 or 3 of it's neighbors are alive. It dies + otherwise. A cell is born if only 3 of it's neighbors are alive. *) + + cell_at_next_evolution(position : Int) : String { + + if neighbors(position) = 3 then + "X" + else + if neighbors(position) = 2 then + if cell(position) = "X" then + "X" + else + "-" + fi + else + "-" + fi fi + }; + + + evolve() : CellularAutomaton { + (let position : Int <- 0 in + (let num : Int <- num_cells() in + (let temp : String in + { + while position < num loop + { + temp <- temp.concat(cell_at_next_evolution(position)); + position <- position + 1; + } + pool; + population_map <- temp; + self; + } + ) ) ) + }; + +(* This is where the background pattern is detremined by the user. More + patterns can be added as long as whoever adds keeps the board either + 3x5, 4x5, 5x5, 3x7, 7x4, 4x4 with the row first then column. *) + option(): String { + { + (let num : Int in + { + out_string("\nPlease chose a number:\n"); + out_string("\t1: A cross\n"); + out_string("\t2: A slash from the upper left to lower right\n"); + out_string("\t3: A slash from the upper right to lower left\n"); + out_string("\t4: An X\n"); + out_string("\t5: A greater than sign \n"); + out_string("\t6: A less than sign\n"); + out_string("\t7: Two greater than signs\n"); + out_string("\t8: Two less than signs\n"); + out_string("\t9: A 'V'\n"); + out_string("\t10: An inverse 'V'\n"); + out_string("\t11: Numbers 9 and 10 combined\n"); + out_string("\t12: A full grid\n"); + out_string("\t13: A 'T'\n"); + out_string("\t14: A plus '+'\n"); + out_string("\t15: A 'W'\n"); + out_string("\t16: An 'M'\n"); + out_string("\t17: An 'E'\n"); + out_string("\t18: A '3'\n"); + out_string("\t19: An 'O'\n"); + out_string("\t20: An '8'\n"); + out_string("\t21: An 'S'\n"); + out_string("Your choice => "); + num <- in_int(); + out_string("\n"); + if num = 1 then + " XX XXXX XXXX XX " + else if num = 2 then + " X X X X X " + else if num = 3 then + "X X X X X" + else if num = 4 then + "X X X X X X X X X" + else if num = 5 then + "X X X X X " + else if num = 6 then + " X X X X X" + else if num = 7 then + "X X X XX X " + else if num = 8 then + " X XX X X X " + else if num = 9 then + "X X X X X " + else if num = 10 then + " X X X X X" + else if num = 11 then + "X X X X X X X X" + else if num = 12 then + "XXXXXXXXXXXXXXXXXXXXXXXXX" + else if num = 13 then + "XXXXX X X X X " + else if num = 14 then + " X X XXXXX X X " + else if num = 15 then + "X X X X X X X " + else if num = 16 then + " X X X X X X X" + else if num = 17 then + "XXXXX X XXXXX X XXXX" + else if num = 18 then + "XXX X X X X XXXX " + else if num = 19 then + " XX X XX X XX " + else if num = 20 then + " XX X XX X XX X XX X XX " + else if num = 21 then + " XXXX X XX X XXXX " + else + " " + fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi fi; + } + ); + } + }; + + + + + prompt() : Bool { + { + (let ans : String in + { + out_string("Would you like to continue with the next generation? \n"); + out_string("Please use lowercase y or n for your answer [y]: "); + ans <- in_string(); + out_string("\n"); + if ans = "n" then + false + else + true + fi; + } + ); + } + }; + + + prompt2() : Bool { + (let ans : String in + { + out_string("\n\n"); + out_string("Would you like to choose a background pattern? \n"); + out_string("Please use lowercase y or n for your answer [n]: "); + ans <- in_string(); + if ans = "y" then + true + else + false + fi; + } + ) + }; + + +}; + +class Main inherits CellularAutomaton { + cells : CellularAutomaton; + + main() : Main { + { + (let continue : Bool in + (let choice : String in + { + out_string("Welcome to the Game of Life.\n"); + out_string("There are many initial states to choose from. \n"); + while prompt2() loop + { + continue <- true; + choice <- option(); + cells <- (new CellularAutomaton).init(choice); + cells.print(); + while continue loop + if prompt() then + { + cells.evolve(); + cells.print(); + } + else + continue <- false + fi + pool; + } + pool; + self; + } ) ); } + }; +}; + diff --git a/tests/codegen/life.mips b/tests/codegen/life.mips new file mode 100644 index 00000000..af09b693 --- /dev/null +++ b/tests/codegen/life.mips @@ -0,0 +1,8188 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Board_Board +sw $t9, 80($v0) +la $t9, function_size_of_board_Board +sw $t9, 84($v0) +la $t9, function_board_init_Board +sw $t9, 88($v0) +la $t9, function_CellularAutomaton_CellularAutomaton +sw $t9, 92($v0) +la $t9, function_init_CellularAutomaton +sw $t9, 96($v0) +la $t9, function_print_CellularAutomaton +sw $t9, 100($v0) +la $t9, function_num_cells_CellularAutomaton +sw $t9, 104($v0) +la $t9, function_cell_CellularAutomaton +sw $t9, 108($v0) +la $t9, function_north_CellularAutomaton +sw $t9, 112($v0) +la $t9, function_south_CellularAutomaton +sw $t9, 116($v0) +la $t9, function_east_CellularAutomaton +sw $t9, 120($v0) +la $t9, function_west_CellularAutomaton +sw $t9, 124($v0) +la $t9, function_northwest_CellularAutomaton +sw $t9, 128($v0) +la $t9, function_northeast_CellularAutomaton +sw $t9, 132($v0) +la $t9, function_southeast_CellularAutomaton +sw $t9, 136($v0) +la $t9, function_southwest_CellularAutomaton +sw $t9, 140($v0) +la $t9, function_neighbors_CellularAutomaton +sw $t9, 144($v0) +la $t9, function_cell_at_next_evolution_CellularAutomaton +sw $t9, 148($v0) +la $t9, function_evolve_CellularAutomaton +sw $t9, 152($v0) +la $t9, function_option_CellularAutomaton +sw $t9, 156($v0) +la $t9, function_prompt_CellularAutomaton +sw $t9, 160($v0) +la $t9, function_prompt2_CellularAutomaton +sw $t9, 164($v0) +la $t9, function_Main_Main +sw $t9, 168($v0) +la $t9, function_main_Main +sw $t9, 172($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Board +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_size_of_board_Board in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_board_init_Board in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Board_Board in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_CellularAutomaton +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 120 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_size_of_board_Board in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_board_init_Board in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Board_Board in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_init_CellularAutomaton in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_print_CellularAutomaton in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_num_cells_CellularAutomaton in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_cell_CellularAutomaton in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_north_CellularAutomaton in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_south_CellularAutomaton in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +# Save the direction of the method function_east_CellularAutomaton in a0 +lw $a0, 120($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 68($v0) +# Save the direction of the method function_west_CellularAutomaton in a0 +lw $a0, 124($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 72($v0) +# Save the direction of the method function_northwest_CellularAutomaton in a0 +lw $a0, 128($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 76($v0) +# Save the direction of the method function_northeast_CellularAutomaton in a0 +lw $a0, 132($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 80($v0) +# Save the direction of the method function_southeast_CellularAutomaton in a0 +lw $a0, 136($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 84($v0) +# Save the direction of the method function_southwest_CellularAutomaton in a0 +lw $a0, 140($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 88($v0) +# Save the direction of the method function_neighbors_CellularAutomaton in a0 +lw $a0, 144($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 92($v0) +# Save the direction of the method function_cell_at_next_evolution_CellularAutomaton in a0 +lw $a0, 148($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 96($v0) +# Save the direction of the method function_evolve_CellularAutomaton in a0 +lw $a0, 152($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 100($v0) +# Save the direction of the method function_option_CellularAutomaton in a0 +lw $a0, 156($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 104($v0) +# Save the direction of the method function_prompt_CellularAutomaton in a0 +lw $a0, 160($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 108($v0) +# Save the direction of the method function_prompt2_CellularAutomaton in a0 +lw $a0, 164($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 112($v0) +# Save the direction of the method function_CellularAutomaton_CellularAutomaton in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 116($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 128 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_size_of_board_Board in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_board_init_Board in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Board_Board in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_init_CellularAutomaton in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_print_CellularAutomaton in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_num_cells_CellularAutomaton in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_cell_CellularAutomaton in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_north_CellularAutomaton in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_south_CellularAutomaton in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +# Save the direction of the method function_east_CellularAutomaton in a0 +lw $a0, 120($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 68($v0) +# Save the direction of the method function_west_CellularAutomaton in a0 +lw $a0, 124($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 72($v0) +# Save the direction of the method function_northwest_CellularAutomaton in a0 +lw $a0, 128($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 76($v0) +# Save the direction of the method function_northeast_CellularAutomaton in a0 +lw $a0, 132($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 80($v0) +# Save the direction of the method function_southeast_CellularAutomaton in a0 +lw $a0, 136($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 84($v0) +# Save the direction of the method function_southwest_CellularAutomaton in a0 +lw $a0, 140($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 88($v0) +# Save the direction of the method function_neighbors_CellularAutomaton in a0 +lw $a0, 144($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 92($v0) +# Save the direction of the method function_cell_at_next_evolution_CellularAutomaton in a0 +lw $a0, 148($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 96($v0) +# Save the direction of the method function_evolve_CellularAutomaton in a0 +lw $a0, 152($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 100($v0) +# Save the direction of the method function_option_CellularAutomaton in a0 +lw $a0, 156($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 104($v0) +# Save the direction of the method function_prompt_CellularAutomaton in a0 +lw $a0, 160($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 108($v0) +# Save the direction of the method function_prompt2_CellularAutomaton in a0 +lw $a0, 164($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 112($v0) +# Save the direction of the method function_CellularAutomaton_CellularAutomaton in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 116($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 172($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 120($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 168($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 124($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 32 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 32 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Board_Board: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Board_Board_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . rows <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +# self . columns <- SET 0 +li $t9, 0 +sw $t9, 16($t0) +# self . board_size <- SET 0 +li $t9, 0 +sw $t9, 20($t0) +lw $t1, -4($fp) +# Moving self to local_Board_Board_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_size_of_board_Board: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value initial +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_size_of_board_Board_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_size_of_board_Board_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_size_of_board_Board_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -12($fp) +# local_size_of_board_Board_internal_1 <- Type of initial +la $t1, type_String +lw $t2, -16($fp) +# Saves in local_size_of_board_Board_internal_2 data_0 +la $t2, data_0 +# local_size_of_board_Board_internal_1 <- local_size_of_board_Board_internal_1 = local_size_of_board_Board_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_size_of_board_Board_internal_1 goto continue__60 +sw $t0, -0($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +beqz $t1, continue__60 +la $a0, dispatch_error +j .raise +continue__60: +lw $t0, -8($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 20 +jr $ra + + +function_board_init_Board: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value start +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_board_init_Board_size_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_board_init_Board_internal_21 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_size_of_board_Board +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_board_init_Board_internal_1 to local_board_init_Board_size_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -16($fp) +# local_board_init_Board_internal_2 <- local_board_init_Board_size_0 = 15 +li $t9, 15 +seq $t2, $t1, $t9 +# If local_board_init_Board_internal_2 goto true__82 +sw $t0, -12($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +bnez $t2, true__82 +lw $t0, -8($fp) +lw $t1, -24($fp) +# local_board_init_Board_internal_4 <- local_board_init_Board_size_0 = 16 +li $t9, 16 +seq $t1, $t0, $t9 +# If local_board_init_Board_internal_4 goto true__86 +sw $t0, -8($fp) +sw $t1, -24($fp) +bnez $t1, true__86 +lw $t0, -8($fp) +lw $t1, -32($fp) +# local_board_init_Board_internal_6 <- local_board_init_Board_size_0 = 20 +li $t9, 20 +seq $t1, $t0, $t9 +# If local_board_init_Board_internal_6 goto true__90 +sw $t0, -8($fp) +sw $t1, -32($fp) +bnez $t1, true__90 +lw $t0, -8($fp) +lw $t1, -40($fp) +# local_board_init_Board_internal_8 <- local_board_init_Board_size_0 = 21 +li $t9, 21 +seq $t1, $t0, $t9 +# If local_board_init_Board_internal_8 goto true__94 +sw $t0, -8($fp) +sw $t1, -40($fp) +bnez $t1, true__94 +lw $t0, -8($fp) +lw $t1, -48($fp) +# local_board_init_Board_internal_10 <- local_board_init_Board_size_0 = 25 +li $t9, 25 +seq $t1, $t0, $t9 +# If local_board_init_Board_internal_10 goto true__98 +sw $t0, -8($fp) +sw $t1, -48($fp) +bnez $t1, true__98 +lw $t0, -8($fp) +lw $t1, -56($fp) +# local_board_init_Board_internal_12 <- local_board_init_Board_size_0 = 28 +li $t9, 28 +seq $t1, $t0, $t9 +# If local_board_init_Board_internal_12 goto true__102 +sw $t0, -8($fp) +sw $t1, -56($fp) +bnez $t1, true__102 +lw $t0, -4($fp) +# self . rows <- SET 5 +li $t9, 5 +sw $t9, 12($t0) +# self . columns <- SET 5 +li $t9, 5 +sw $t9, 16($t0) +lw $t1, -8($fp) +# self . board_size <- SET local_board_init_Board_size_0 +sw $t1, 20($t0) +lw $t2, -64($fp) +# Moving local_board_init_Board_size_0 to local_board_init_Board_internal_14 +move $t2, $t1 +sw $t2, -64($fp) +lw $t3, -60($fp) +# Moving local_board_init_Board_internal_14 to local_board_init_Board_internal_13 +move $t3, $t2 +sw $t3, -60($fp) +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -64($fp) +sw $t3, -60($fp) +j end__102 +true__102: +lw $t0, -4($fp) +# self . rows <- SET 7 +li $t9, 7 +sw $t9, 12($t0) +# self . columns <- SET 4 +li $t9, 4 +sw $t9, 16($t0) +lw $t1, -8($fp) +# self . board_size <- SET local_board_init_Board_size_0 +sw $t1, 20($t0) +lw $t2, -68($fp) +# Moving local_board_init_Board_size_0 to local_board_init_Board_internal_15 +move $t2, $t1 +sw $t2, -68($fp) +lw $t3, -60($fp) +# Moving local_board_init_Board_internal_15 to local_board_init_Board_internal_13 +move $t3, $t2 +sw $t3, -60($fp) +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -68($fp) +sw $t3, -60($fp) +end__102: +lw $t0, -60($fp) +lw $t1, -52($fp) +# Moving local_board_init_Board_internal_13 to local_board_init_Board_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -60($fp) +sw $t1, -52($fp) +j end__98 +true__98: +lw $t0, -4($fp) +# self . rows <- SET 5 +li $t9, 5 +sw $t9, 12($t0) +# self . columns <- SET 5 +li $t9, 5 +sw $t9, 16($t0) +lw $t1, -8($fp) +# self . board_size <- SET local_board_init_Board_size_0 +sw $t1, 20($t0) +lw $t2, -72($fp) +# Moving local_board_init_Board_size_0 to local_board_init_Board_internal_16 +move $t2, $t1 +sw $t2, -72($fp) +lw $t3, -52($fp) +# Moving local_board_init_Board_internal_16 to local_board_init_Board_internal_11 +move $t3, $t2 +sw $t3, -52($fp) +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -72($fp) +sw $t3, -52($fp) +end__98: +lw $t0, -52($fp) +lw $t1, -44($fp) +# Moving local_board_init_Board_internal_11 to local_board_init_Board_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -52($fp) +sw $t1, -44($fp) +j end__94 +true__94: +lw $t0, -4($fp) +# self . rows <- SET 3 +li $t9, 3 +sw $t9, 12($t0) +# self . columns <- SET 7 +li $t9, 7 +sw $t9, 16($t0) +lw $t1, -8($fp) +# self . board_size <- SET local_board_init_Board_size_0 +sw $t1, 20($t0) +lw $t2, -76($fp) +# Moving local_board_init_Board_size_0 to local_board_init_Board_internal_17 +move $t2, $t1 +sw $t2, -76($fp) +lw $t3, -44($fp) +# Moving local_board_init_Board_internal_17 to local_board_init_Board_internal_9 +move $t3, $t2 +sw $t3, -44($fp) +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -76($fp) +sw $t3, -44($fp) +end__94: +lw $t0, -44($fp) +lw $t1, -36($fp) +# Moving local_board_init_Board_internal_9 to local_board_init_Board_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -44($fp) +sw $t1, -36($fp) +j end__90 +true__90: +lw $t0, -4($fp) +# self . rows <- SET 4 +li $t9, 4 +sw $t9, 12($t0) +# self . columns <- SET 5 +li $t9, 5 +sw $t9, 16($t0) +lw $t1, -8($fp) +# self . board_size <- SET local_board_init_Board_size_0 +sw $t1, 20($t0) +lw $t2, -80($fp) +# Moving local_board_init_Board_size_0 to local_board_init_Board_internal_18 +move $t2, $t1 +sw $t2, -80($fp) +lw $t3, -36($fp) +# Moving local_board_init_Board_internal_18 to local_board_init_Board_internal_7 +move $t3, $t2 +sw $t3, -36($fp) +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -80($fp) +sw $t3, -36($fp) +end__90: +lw $t0, -36($fp) +lw $t1, -28($fp) +# Moving local_board_init_Board_internal_7 to local_board_init_Board_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -36($fp) +sw $t1, -28($fp) +j end__86 +true__86: +lw $t0, -4($fp) +# self . rows <- SET 4 +li $t9, 4 +sw $t9, 12($t0) +# self . columns <- SET 4 +li $t9, 4 +sw $t9, 16($t0) +lw $t1, -8($fp) +# self . board_size <- SET local_board_init_Board_size_0 +sw $t1, 20($t0) +lw $t2, -84($fp) +# Moving local_board_init_Board_size_0 to local_board_init_Board_internal_19 +move $t2, $t1 +sw $t2, -84($fp) +lw $t3, -28($fp) +# Moving local_board_init_Board_internal_19 to local_board_init_Board_internal_5 +move $t3, $t2 +sw $t3, -28($fp) +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -84($fp) +sw $t3, -28($fp) +end__86: +lw $t0, -28($fp) +lw $t1, -20($fp) +# Moving local_board_init_Board_internal_5 to local_board_init_Board_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -28($fp) +sw $t1, -20($fp) +j end__82 +true__82: +lw $t0, -4($fp) +# self . rows <- SET 3 +li $t9, 3 +sw $t9, 12($t0) +# self . columns <- SET 5 +li $t9, 5 +sw $t9, 16($t0) +lw $t1, -8($fp) +# self . board_size <- SET local_board_init_Board_size_0 +sw $t1, 20($t0) +lw $t2, -88($fp) +# Moving local_board_init_Board_size_0 to local_board_init_Board_internal_20 +move $t2, $t1 +sw $t2, -88($fp) +lw $t3, -20($fp) +# Moving local_board_init_Board_internal_20 to local_board_init_Board_internal_3 +move $t3, $t2 +sw $t3, -20($fp) +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -88($fp) +sw $t3, -20($fp) +end__82: +lw $t0, -4($fp) +lw $t1, -92($fp) +# Moving self to local_board_init_Board_internal_21 +move $t1, $t0 +sw $t1, -92($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -92($fp) +# Removing all locals from stack +addiu $sp, $sp, 96 +jr $ra + + +function_CellularAutomaton_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_CellularAutomaton_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_CellularAutomaton_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . rows <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +# self . columns <- SET 0 +li $t9, 0 +sw $t9, 16($t0) +# self . board_size <- SET 0 +li $t9, 0 +sw $t9, 20($t0) +lw $t1, -4($fp) +# Saves in local_CellularAutomaton_CellularAutomaton_internal_0 data_1 +la $t1, data_1 +# self . population_map <- SET local_CellularAutomaton_CellularAutomaton_internal_0 +sw $t1, 24($t0) +lw $t2, -8($fp) +# Moving self to local_CellularAutomaton_CellularAutomaton_internal_1 +move $t2, $t0 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_init_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value map +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_init_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# self . population_map <- SET map +sw $t0, 24($t1) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_board_init_Board +lw $t8, 36($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -12($fp) +# Moving self to local_init_CellularAutomaton_internal_1 +move $t2, $t1 +sw $t2, -12($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_print_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_CellularAutomaton_i_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_num_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_board_size_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_population_map_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_columns_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_columns_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_CellularAutomaton_internal_20 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_print_CellularAutomaton_i_0 +li $t0, 0 +sw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# local_print_CellularAutomaton_board_size_2 <- GET self . board_size +lw $t2, 20($t1) +lw $t3, -8($fp) +# Moving local_print_CellularAutomaton_board_size_2 to local_print_CellularAutomaton_num_1 +move $t3, $t2 +sw $t3, -8($fp) +lw $t4, -16($fp) +# Saves in local_print_CellularAutomaton_internal_3 data_2 +la $t4, data_2 +lw $t5, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +sw $t4, -16($fp) +sw $t5, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t1, $v0 +sw $t0, -20($fp) +sw $t1, -24($fp) +start__210: +lw $t0, -4($fp) +lw $t1, -8($fp) +lw $t2, -28($fp) +# local_print_CellularAutomaton_internal_6 <- local_print_CellularAutomaton_i_0 < local_print_CellularAutomaton_num_1 +slt $t2, $t0, $t1 +# If not local_print_CellularAutomaton_internal_6 goto end__210 +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -28($fp) +beqz $t2, end__210 +lw $t0, -0($fp) +lw $t1, -32($fp) +# local_print_CellularAutomaton_population_map_7 <- GET self . population_map +lw $t1, 24($t0) +lw $t2, -36($fp) +# local_print_CellularAutomaton_columns_8 <- GET self . columns +lw $t2, 16($t0) +lw $t3, -44($fp) +# local_print_CellularAutomaton_internal_10 <- Type of local_print_CellularAutomaton_population_map_7 +la $t3, type_String +lw $t4, -48($fp) +# Saves in local_print_CellularAutomaton_internal_11 data_0 +la $t4, data_0 +# local_print_CellularAutomaton_internal_10 <- local_print_CellularAutomaton_internal_10 = local_print_CellularAutomaton_internal_11 +move $t8, $t3 +move $t9, $t4 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t3, $v0 +# If not local_print_CellularAutomaton_internal_10 goto continue__225 +sw $t0, -0($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +sw $t3, -44($fp) +sw $t4, -48($fp) +beqz $t3, continue__225 +la $a0, dispatch_error +j .raise +continue__225: +lw $t0, -40($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -36($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -32($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -36($fp) +sw $t2, -4($fp) +sw $t3, -32($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -52($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -0($fp) +sw $t2, -52($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Saves in local_print_CellularAutomaton_internal_13 data_3 +la $t1, data_3 +lw $t2, -0($fp) +lw $t3, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +sw $t2, -0($fp) +sw $t3, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -68($fp) +# local_print_CellularAutomaton_columns_16 <- GET self . columns +lw $t2, 16($t1) +lw $t3, -4($fp) +lw $t4, -64($fp) +# local_print_CellularAutomaton_internal_15 <- local_print_CellularAutomaton_i_0 + local_print_CellularAutomaton_columns_16 +add $t4, $t3, $t2 +# Moving local_print_CellularAutomaton_internal_15 to local_print_CellularAutomaton_i_0 +move $t3, $t4 +sw $t3, -4($fp) +lw $t5, -72($fp) +# Moving local_print_CellularAutomaton_internal_15 to local_print_CellularAutomaton_internal_17 +move $t5, $t4 +sw $t5, -72($fp) +lw $t6, -24($fp) +# Moving local_print_CellularAutomaton_internal_17 to local_print_CellularAutomaton_internal_5 +move $t6, $t5 +sw $t6, -24($fp) +sw $t0, -60($fp) +sw $t1, -0($fp) +sw $t2, -68($fp) +sw $t3, -4($fp) +sw $t4, -64($fp) +sw $t5, -72($fp) +sw $t6, -24($fp) +j start__210 +end__210: +lw $t0, -76($fp) +# Saves in local_print_CellularAutomaton_internal_18 data_4 +la $t0, data_4 +lw $t1, -0($fp) +lw $t2, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -0($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -84($fp) +# Moving self to local_print_CellularAutomaton_internal_20 +move $t2, $t1 +sw $t2, -84($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -80($fp) +sw $t1, -0($fp) +sw $t2, -84($fp) +# Removing all locals from stack +addiu $sp, $sp, 88 +jr $ra + + +function_num_cells_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_num_cells_CellularAutomaton_population_map_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_num_cells_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_num_cells_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_num_cells_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_num_cells_CellularAutomaton_population_map_0 <- GET self . population_map +lw $t1, 24($t0) +lw $t2, -12($fp) +# local_num_cells_CellularAutomaton_internal_2 <- Type of local_num_cells_CellularAutomaton_population_map_0 +la $t2, type_String +lw $t3, -16($fp) +# Saves in local_num_cells_CellularAutomaton_internal_3 data_0 +la $t3, data_0 +# local_num_cells_CellularAutomaton_internal_2 <- local_num_cells_CellularAutomaton_internal_2 = local_num_cells_CellularAutomaton_internal_3 +move $t8, $t2 +move $t9, $t3 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t2, $v0 +# If not local_num_cells_CellularAutomaton_internal_2 goto continue__271 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +beqz $t2, continue__271 +la $a0, dispatch_error +j .raise +continue__271: +lw $t0, -8($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -4($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 20 +jr $ra + + +function_cell_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_board_size_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_population_map_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -16($fp) +# local_cell_CellularAutomaton_board_size_2 <- GET self . board_size +lw $t1, 20($t0) +lw $t2, -12($fp) +# local_cell_CellularAutomaton_internal_1 <- local_cell_CellularAutomaton_board_size_2 - 1 +addi $t2, $t1, -1 +lw $t3, -0($fp) +lw $t4, -8($fp) +# local_cell_CellularAutomaton_internal_0 <- local_cell_CellularAutomaton_internal_1 < position +slt $t4, $t2, $t3 +# If local_cell_CellularAutomaton_internal_0 goto true__291 +sw $t0, -4($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -0($fp) +sw $t4, -8($fp) +bnez $t4, true__291 +lw $t0, -4($fp) +lw $t1, -24($fp) +# local_cell_CellularAutomaton_population_map_4 <- GET self . population_map +lw $t1, 24($t0) +lw $t2, -32($fp) +# local_cell_CellularAutomaton_internal_6 <- Type of local_cell_CellularAutomaton_population_map_4 +la $t2, type_String +lw $t3, -36($fp) +# Saves in local_cell_CellularAutomaton_internal_7 data_0 +la $t3, data_0 +# local_cell_CellularAutomaton_internal_6 <- local_cell_CellularAutomaton_internal_6 = local_cell_CellularAutomaton_internal_7 +move $t8, $t2 +move $t9, $t3 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If not local_cell_CellularAutomaton_internal_6 goto continue__299 +sw $t0, -4($fp) +sw $t1, -24($fp) +sw $t2, -32($fp) +sw $t3, -36($fp) +beqz $t2, continue__299 +la $a0, dispatch_error +j .raise +continue__299: +lw $t0, -28($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -0($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_cell_CellularAutomaton_internal_5 to local_cell_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -28($fp) +sw $t1, -20($fp) +j end__291 +true__291: +lw $t0, -40($fp) +# Saves in local_cell_CellularAutomaton_internal_8 data_5 +la $t0, data_5 +lw $t1, -20($fp) +# Moving local_cell_CellularAutomaton_internal_8 to local_cell_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -40($fp) +sw $t1, -20($fp) +end__291: +lw $t0, -20($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 44 +jr $ra + + +function_north_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_north_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_north_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_north_CellularAutomaton_columns_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_north_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_north_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_north_CellularAutomaton_columns_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_north_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_north_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -16($fp) +# local_north_CellularAutomaton_columns_2 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -12($fp) +# local_north_CellularAutomaton_internal_1 <- position - local_north_CellularAutomaton_columns_2 +sub $t3, $t2, $t1 +lw $t4, -8($fp) +# local_north_CellularAutomaton_internal_0 <- local_north_CellularAutomaton_internal_1 < 0 +li $t9, 0 +slt $t4, $t3, $t9 +# If local_north_CellularAutomaton_internal_0 goto true__327 +sw $t0, -4($fp) +sw $t1, -16($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +sw $t4, -8($fp) +bnez $t4, true__327 +lw $t0, -4($fp) +lw $t1, -28($fp) +# local_north_CellularAutomaton_columns_5 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -24($fp) +# local_north_CellularAutomaton_internal_4 <- position - local_north_CellularAutomaton_columns_5 +sub $t3, $t2, $t1 +lw $t4, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -28($fp) +sw $t2, -0($fp) +sw $t3, -24($fp) +sw $t4, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_north_CellularAutomaton_internal_6 to local_north_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -32($fp) +sw $t1, -20($fp) +j end__327 +true__327: +lw $t0, -36($fp) +# Saves in local_north_CellularAutomaton_internal_7 data_6 +la $t0, data_6 +lw $t1, -20($fp) +# Moving local_north_CellularAutomaton_internal_7 to local_north_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -36($fp) +sw $t1, -20($fp) +end__327: +lw $t0, -20($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 40 +jr $ra + + +function_south_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_south_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_board_size_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_columns_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_columns_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_south_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -12($fp) +# local_south_CellularAutomaton_board_size_1 <- GET self . board_size +lw $t1, 20($t0) +lw $t2, -20($fp) +# local_south_CellularAutomaton_columns_3 <- GET self . columns +lw $t2, 16($t0) +lw $t3, -0($fp) +lw $t4, -16($fp) +# local_south_CellularAutomaton_internal_2 <- position + local_south_CellularAutomaton_columns_3 +add $t4, $t3, $t2 +lw $t5, -8($fp) +# local_south_CellularAutomaton_internal_0 <- local_south_CellularAutomaton_board_size_1 < local_south_CellularAutomaton_internal_2 +slt $t5, $t1, $t4 +# If local_south_CellularAutomaton_internal_0 goto true__357 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -20($fp) +sw $t3, -0($fp) +sw $t4, -16($fp) +sw $t5, -8($fp) +bnez $t5, true__357 +lw $t0, -4($fp) +lw $t1, -32($fp) +# local_south_CellularAutomaton_columns_6 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -28($fp) +# local_south_CellularAutomaton_internal_5 <- position + local_south_CellularAutomaton_columns_6 +add $t3, $t2, $t1 +lw $t4, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -32($fp) +sw $t2, -0($fp) +sw $t3, -28($fp) +sw $t4, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Moving local_south_CellularAutomaton_internal_7 to local_south_CellularAutomaton_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -36($fp) +sw $t1, -24($fp) +j end__357 +true__357: +lw $t0, -40($fp) +# Saves in local_south_CellularAutomaton_internal_8 data_7 +la $t0, data_7 +lw $t1, -24($fp) +# Moving local_south_CellularAutomaton_internal_8 to local_south_CellularAutomaton_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -40($fp) +sw $t1, -24($fp) +end__357: +lw $t0, -24($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 44 +jr $ra + + +function_east_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_east_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_columns_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_columns_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_east_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -20($fp) +# local_east_CellularAutomaton_internal_3 <- position + 1 +addi $t1, $t0, 1 +lw $t2, -4($fp) +lw $t3, -24($fp) +# local_east_CellularAutomaton_columns_4 <- GET self . columns +lw $t3, 16($t2) +lw $t4, -16($fp) +# local_east_CellularAutomaton_internal_2 <- local_east_CellularAutomaton_internal_3 / local_east_CellularAutomaton_columns_4 +la $a0, zero_error +beqz $t3, .raise +div $t1, $t3 +mflo $t4 +lw $t5, -28($fp) +# local_east_CellularAutomaton_columns_5 <- GET self . columns +lw $t5, 16($t2) +lw $t6, -12($fp) +# local_east_CellularAutomaton_internal_1 <- local_east_CellularAutomaton_internal_2 * local_east_CellularAutomaton_columns_5 +mult $t4, $t5 +mflo $t6 +lw $t7, -32($fp) +# local_east_CellularAutomaton_internal_6 <- position + 1 +addi $t7, $t0, 1 +lw $a1, -8($fp) +# local_east_CellularAutomaton_internal_0 <- local_east_CellularAutomaton_internal_1 = local_east_CellularAutomaton_internal_6 +seq $a1, $t6, $t7 +# If local_east_CellularAutomaton_internal_0 goto true__393 +sw $t0, -0($fp) +sw $t1, -20($fp) +sw $t2, -4($fp) +sw $t3, -24($fp) +sw $t4, -16($fp) +sw $t5, -28($fp) +sw $t6, -12($fp) +sw $t7, -32($fp) +sw $a1, -8($fp) +bnez $a1, true__393 +lw $t0, -0($fp) +lw $t1, -40($fp) +# local_east_CellularAutomaton_internal_8 <- position + 1 +addi $t1, $t0, 1 +lw $t2, -4($fp) +lw $t3, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -4($fp) +sw $t3, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# Moving local_east_CellularAutomaton_internal_9 to local_east_CellularAutomaton_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -44($fp) +sw $t1, -36($fp) +j end__393 +true__393: +lw $t0, -48($fp) +# Saves in local_east_CellularAutomaton_internal_10 data_8 +la $t0, data_8 +lw $t1, -36($fp) +# Moving local_east_CellularAutomaton_internal_10 to local_east_CellularAutomaton_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -48($fp) +sw $t1, -36($fp) +end__393: +lw $t0, -36($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +# Removing all locals from stack +addiu $sp, $sp, 52 +jr $ra + + +function_west_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_west_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_columns_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_columns_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_west_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_west_CellularAutomaton_internal_0 <- position = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_west_CellularAutomaton_internal_0 goto true__415 +sw $t0, -0($fp) +sw $t1, -8($fp) +bnez $t1, true__415 +lw $t0, -4($fp) +lw $t1, -28($fp) +# local_west_CellularAutomaton_columns_5 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -24($fp) +# local_west_CellularAutomaton_internal_4 <- position / local_west_CellularAutomaton_columns_5 +la $a0, zero_error +beqz $t1, .raise +div $t2, $t1 +mflo $t3 +lw $t4, -32($fp) +# local_west_CellularAutomaton_columns_6 <- GET self . columns +lw $t4, 16($t0) +lw $t5, -20($fp) +# local_west_CellularAutomaton_internal_3 <- local_west_CellularAutomaton_internal_4 * local_west_CellularAutomaton_columns_6 +mult $t3, $t4 +mflo $t5 +lw $t6, -16($fp) +# local_west_CellularAutomaton_internal_2 <- local_west_CellularAutomaton_internal_3 = position +seq $t6, $t5, $t2 +# If local_west_CellularAutomaton_internal_2 goto true__427 +sw $t0, -4($fp) +sw $t1, -28($fp) +sw $t2, -0($fp) +sw $t3, -24($fp) +sw $t4, -32($fp) +sw $t5, -20($fp) +sw $t6, -16($fp) +bnez $t6, true__427 +lw $t0, -0($fp) +lw $t1, -40($fp) +# local_west_CellularAutomaton_internal_8 <- position - 1 +addi $t1, $t0, -1 +lw $t2, -4($fp) +lw $t3, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -4($fp) +sw $t3, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# Moving local_west_CellularAutomaton_internal_9 to local_west_CellularAutomaton_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -44($fp) +sw $t1, -36($fp) +j end__427 +true__427: +lw $t0, -48($fp) +# Saves in local_west_CellularAutomaton_internal_10 data_9 +la $t0, data_9 +lw $t1, -36($fp) +# Moving local_west_CellularAutomaton_internal_10 to local_west_CellularAutomaton_internal_7 +move $t1, $t0 +sw $t1, -36($fp) +sw $t0, -48($fp) +sw $t1, -36($fp) +end__427: +lw $t0, -36($fp) +lw $t1, -12($fp) +# Moving local_west_CellularAutomaton_internal_7 to local_west_CellularAutomaton_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -36($fp) +sw $t1, -12($fp) +j end__415 +true__415: +lw $t0, -52($fp) +# Saves in local_west_CellularAutomaton_internal_11 data_10 +la $t0, data_10 +lw $t1, -12($fp) +# Moving local_west_CellularAutomaton_internal_11 to local_west_CellularAutomaton_internal_1 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -52($fp) +sw $t1, -12($fp) +end__415: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 56 +jr $ra + + +function_northwest_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_columns_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_columns_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_columns_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northwest_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -16($fp) +# local_northwest_CellularAutomaton_columns_2 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -12($fp) +# local_northwest_CellularAutomaton_internal_1 <- position - local_northwest_CellularAutomaton_columns_2 +sub $t3, $t2, $t1 +lw $t4, -8($fp) +# local_northwest_CellularAutomaton_internal_0 <- local_northwest_CellularAutomaton_internal_1 < 0 +li $t9, 0 +slt $t4, $t3, $t9 +# If local_northwest_CellularAutomaton_internal_0 goto true__461 +sw $t0, -4($fp) +sw $t1, -16($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +sw $t4, -8($fp) +bnez $t4, true__461 +lw $t0, -4($fp) +lw $t1, -36($fp) +# local_northwest_CellularAutomaton_columns_7 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -32($fp) +# local_northwest_CellularAutomaton_internal_6 <- position / local_northwest_CellularAutomaton_columns_7 +la $a0, zero_error +beqz $t1, .raise +div $t2, $t1 +mflo $t3 +lw $t4, -40($fp) +# local_northwest_CellularAutomaton_columns_8 <- GET self . columns +lw $t4, 16($t0) +lw $t5, -28($fp) +# local_northwest_CellularAutomaton_internal_5 <- local_northwest_CellularAutomaton_internal_6 * local_northwest_CellularAutomaton_columns_8 +mult $t3, $t4 +mflo $t5 +lw $t6, -24($fp) +# local_northwest_CellularAutomaton_internal_4 <- local_northwest_CellularAutomaton_internal_5 = position +seq $t6, $t5, $t2 +# If local_northwest_CellularAutomaton_internal_4 goto true__473 +sw $t0, -4($fp) +sw $t1, -36($fp) +sw $t2, -0($fp) +sw $t3, -32($fp) +sw $t4, -40($fp) +sw $t5, -28($fp) +sw $t6, -24($fp) +bnez $t6, true__473 +lw $t0, -0($fp) +lw $t1, -48($fp) +# local_northwest_CellularAutomaton_internal_10 <- position - 1 +addi $t1, $t0, -1 +lw $t2, -4($fp) +lw $t3, -52($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_north_CellularAutomaton +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -48($fp) +sw $t2, -4($fp) +sw $t3, -52($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Moving local_northwest_CellularAutomaton_internal_11 to local_northwest_CellularAutomaton_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -52($fp) +sw $t1, -44($fp) +j end__473 +true__473: +lw $t0, -56($fp) +# Saves in local_northwest_CellularAutomaton_internal_12 data_11 +la $t0, data_11 +lw $t1, -44($fp) +# Moving local_northwest_CellularAutomaton_internal_12 to local_northwest_CellularAutomaton_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -56($fp) +sw $t1, -44($fp) +end__473: +lw $t0, -44($fp) +lw $t1, -20($fp) +# Moving local_northwest_CellularAutomaton_internal_9 to local_northwest_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -44($fp) +sw $t1, -20($fp) +j end__461 +true__461: +lw $t0, -60($fp) +# Saves in local_northwest_CellularAutomaton_internal_13 data_12 +la $t0, data_12 +lw $t1, -20($fp) +# Moving local_northwest_CellularAutomaton_internal_13 to local_northwest_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -60($fp) +sw $t1, -20($fp) +end__461: +lw $t0, -20($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 64 +jr $ra + + +function_northeast_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_columns_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_columns_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_columns_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_northeast_CellularAutomaton_internal_15 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -16($fp) +# local_northeast_CellularAutomaton_columns_2 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -12($fp) +# local_northeast_CellularAutomaton_internal_1 <- position - local_northeast_CellularAutomaton_columns_2 +sub $t3, $t2, $t1 +lw $t4, -8($fp) +# local_northeast_CellularAutomaton_internal_0 <- local_northeast_CellularAutomaton_internal_1 < 0 +li $t9, 0 +slt $t4, $t3, $t9 +# If local_northeast_CellularAutomaton_internal_0 goto true__507 +sw $t0, -4($fp) +sw $t1, -16($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +sw $t4, -8($fp) +bnez $t4, true__507 +lw $t0, -0($fp) +lw $t1, -36($fp) +# local_northeast_CellularAutomaton_internal_7 <- position + 1 +addi $t1, $t0, 1 +lw $t2, -4($fp) +lw $t3, -40($fp) +# local_northeast_CellularAutomaton_columns_8 <- GET self . columns +lw $t3, 16($t2) +lw $t4, -32($fp) +# local_northeast_CellularAutomaton_internal_6 <- local_northeast_CellularAutomaton_internal_7 / local_northeast_CellularAutomaton_columns_8 +la $a0, zero_error +beqz $t3, .raise +div $t1, $t3 +mflo $t4 +lw $t5, -44($fp) +# local_northeast_CellularAutomaton_columns_9 <- GET self . columns +lw $t5, 16($t2) +lw $t6, -28($fp) +# local_northeast_CellularAutomaton_internal_5 <- local_northeast_CellularAutomaton_internal_6 * local_northeast_CellularAutomaton_columns_9 +mult $t4, $t5 +mflo $t6 +lw $t7, -48($fp) +# local_northeast_CellularAutomaton_internal_10 <- position + 1 +addi $t7, $t0, 1 +lw $a1, -24($fp) +# local_northeast_CellularAutomaton_internal_4 <- local_northeast_CellularAutomaton_internal_5 = local_northeast_CellularAutomaton_internal_10 +seq $a1, $t6, $t7 +# If local_northeast_CellularAutomaton_internal_4 goto true__523 +sw $t0, -0($fp) +sw $t1, -36($fp) +sw $t2, -4($fp) +sw $t3, -40($fp) +sw $t4, -32($fp) +sw $t5, -44($fp) +sw $t6, -28($fp) +sw $t7, -48($fp) +sw $a1, -24($fp) +bnez $a1, true__523 +lw $t0, -0($fp) +lw $t1, -56($fp) +# local_northeast_CellularAutomaton_internal_12 <- position + 1 +addi $t1, $t0, 1 +lw $t2, -4($fp) +lw $t3, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_north_CellularAutomaton +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -56($fp) +sw $t2, -4($fp) +sw $t3, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Moving local_northeast_CellularAutomaton_internal_13 to local_northeast_CellularAutomaton_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -60($fp) +sw $t1, -52($fp) +j end__523 +true__523: +lw $t0, -64($fp) +# Saves in local_northeast_CellularAutomaton_internal_14 data_13 +la $t0, data_13 +lw $t1, -52($fp) +# Moving local_northeast_CellularAutomaton_internal_14 to local_northeast_CellularAutomaton_internal_11 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -64($fp) +sw $t1, -52($fp) +end__523: +lw $t0, -52($fp) +lw $t1, -20($fp) +# Moving local_northeast_CellularAutomaton_internal_11 to local_northeast_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -52($fp) +sw $t1, -20($fp) +j end__507 +true__507: +lw $t0, -68($fp) +# Saves in local_northeast_CellularAutomaton_internal_15 data_14 +la $t0, data_14 +lw $t1, -20($fp) +# Moving local_northeast_CellularAutomaton_internal_15 to local_northeast_CellularAutomaton_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -68($fp) +sw $t1, -20($fp) +end__507: +lw $t0, -20($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 72 +jr $ra + + +function_southeast_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_board_size_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_columns_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_columns_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_columns_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southeast_CellularAutomaton_internal_16 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -12($fp) +# local_southeast_CellularAutomaton_board_size_1 <- GET self . board_size +lw $t1, 20($t0) +lw $t2, -20($fp) +# local_southeast_CellularAutomaton_columns_3 <- GET self . columns +lw $t2, 16($t0) +lw $t3, -0($fp) +lw $t4, -16($fp) +# local_southeast_CellularAutomaton_internal_2 <- position + local_southeast_CellularAutomaton_columns_3 +add $t4, $t3, $t2 +lw $t5, -8($fp) +# local_southeast_CellularAutomaton_internal_0 <- local_southeast_CellularAutomaton_board_size_1 < local_southeast_CellularAutomaton_internal_2 +slt $t5, $t1, $t4 +# If local_southeast_CellularAutomaton_internal_0 goto true__559 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -20($fp) +sw $t3, -0($fp) +sw $t4, -16($fp) +sw $t5, -8($fp) +bnez $t5, true__559 +lw $t0, -0($fp) +lw $t1, -40($fp) +# local_southeast_CellularAutomaton_internal_8 <- position + 1 +addi $t1, $t0, 1 +lw $t2, -4($fp) +lw $t3, -44($fp) +# local_southeast_CellularAutomaton_columns_9 <- GET self . columns +lw $t3, 16($t2) +lw $t4, -36($fp) +# local_southeast_CellularAutomaton_internal_7 <- local_southeast_CellularAutomaton_internal_8 / local_southeast_CellularAutomaton_columns_9 +la $a0, zero_error +beqz $t3, .raise +div $t1, $t3 +mflo $t4 +lw $t5, -48($fp) +# local_southeast_CellularAutomaton_columns_10 <- GET self . columns +lw $t5, 16($t2) +lw $t6, -32($fp) +# local_southeast_CellularAutomaton_internal_6 <- local_southeast_CellularAutomaton_internal_7 * local_southeast_CellularAutomaton_columns_10 +mult $t4, $t5 +mflo $t6 +lw $t7, -52($fp) +# local_southeast_CellularAutomaton_internal_11 <- position + 1 +addi $t7, $t0, 1 +lw $a1, -28($fp) +# local_southeast_CellularAutomaton_internal_5 <- local_southeast_CellularAutomaton_internal_6 = local_southeast_CellularAutomaton_internal_11 +seq $a1, $t6, $t7 +# If local_southeast_CellularAutomaton_internal_5 goto true__575 +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -4($fp) +sw $t3, -44($fp) +sw $t4, -36($fp) +sw $t5, -48($fp) +sw $t6, -32($fp) +sw $t7, -52($fp) +sw $a1, -28($fp) +bnez $a1, true__575 +lw $t0, -0($fp) +lw $t1, -60($fp) +# local_southeast_CellularAutomaton_internal_13 <- position + 1 +addi $t1, $t0, 1 +lw $t2, -4($fp) +lw $t3, -64($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_south_CellularAutomaton +lw $t8, 64($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -60($fp) +sw $t2, -4($fp) +sw $t3, -64($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -64($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Moving local_southeast_CellularAutomaton_internal_14 to local_southeast_CellularAutomaton_internal_12 +move $t1, $t0 +sw $t1, -56($fp) +sw $t0, -64($fp) +sw $t1, -56($fp) +j end__575 +true__575: +lw $t0, -68($fp) +# Saves in local_southeast_CellularAutomaton_internal_15 data_15 +la $t0, data_15 +lw $t1, -56($fp) +# Moving local_southeast_CellularAutomaton_internal_15 to local_southeast_CellularAutomaton_internal_12 +move $t1, $t0 +sw $t1, -56($fp) +sw $t0, -68($fp) +sw $t1, -56($fp) +end__575: +lw $t0, -56($fp) +lw $t1, -24($fp) +# Moving local_southeast_CellularAutomaton_internal_12 to local_southeast_CellularAutomaton_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -56($fp) +sw $t1, -24($fp) +j end__559 +true__559: +lw $t0, -72($fp) +# Saves in local_southeast_CellularAutomaton_internal_16 data_16 +la $t0, data_16 +lw $t1, -24($fp) +# Moving local_southeast_CellularAutomaton_internal_16 to local_southeast_CellularAutomaton_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -72($fp) +sw $t1, -24($fp) +end__559: +lw $t0, -24($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 76 +jr $ra + + +function_southwest_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_board_size_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_columns_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_columns_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_columns_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_southwest_CellularAutomaton_internal_14 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -12($fp) +# local_southwest_CellularAutomaton_board_size_1 <- GET self . board_size +lw $t1, 20($t0) +lw $t2, -20($fp) +# local_southwest_CellularAutomaton_columns_3 <- GET self . columns +lw $t2, 16($t0) +lw $t3, -0($fp) +lw $t4, -16($fp) +# local_southwest_CellularAutomaton_internal_2 <- position + local_southwest_CellularAutomaton_columns_3 +add $t4, $t3, $t2 +lw $t5, -8($fp) +# local_southwest_CellularAutomaton_internal_0 <- local_southwest_CellularAutomaton_board_size_1 < local_southwest_CellularAutomaton_internal_2 +slt $t5, $t1, $t4 +# If local_southwest_CellularAutomaton_internal_0 goto true__611 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -20($fp) +sw $t3, -0($fp) +sw $t4, -16($fp) +sw $t5, -8($fp) +bnez $t5, true__611 +lw $t0, -4($fp) +lw $t1, -40($fp) +# local_southwest_CellularAutomaton_columns_8 <- GET self . columns +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -36($fp) +# local_southwest_CellularAutomaton_internal_7 <- position / local_southwest_CellularAutomaton_columns_8 +la $a0, zero_error +beqz $t1, .raise +div $t2, $t1 +mflo $t3 +lw $t4, -44($fp) +# local_southwest_CellularAutomaton_columns_9 <- GET self . columns +lw $t4, 16($t0) +lw $t5, -32($fp) +# local_southwest_CellularAutomaton_internal_6 <- local_southwest_CellularAutomaton_internal_7 * local_southwest_CellularAutomaton_columns_9 +mult $t3, $t4 +mflo $t5 +lw $t6, -28($fp) +# local_southwest_CellularAutomaton_internal_5 <- local_southwest_CellularAutomaton_internal_6 = position +seq $t6, $t5, $t2 +# If local_southwest_CellularAutomaton_internal_5 goto true__623 +sw $t0, -4($fp) +sw $t1, -40($fp) +sw $t2, -0($fp) +sw $t3, -36($fp) +sw $t4, -44($fp) +sw $t5, -32($fp) +sw $t6, -28($fp) +bnez $t6, true__623 +lw $t0, -0($fp) +lw $t1, -52($fp) +# local_southwest_CellularAutomaton_internal_11 <- position - 1 +addi $t1, $t0, -1 +lw $t2, -4($fp) +lw $t3, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_south_CellularAutomaton +lw $t8, 64($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -52($fp) +sw $t2, -4($fp) +sw $t3, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Moving local_southwest_CellularAutomaton_internal_12 to local_southwest_CellularAutomaton_internal_10 +move $t1, $t0 +sw $t1, -48($fp) +sw $t0, -56($fp) +sw $t1, -48($fp) +j end__623 +true__623: +lw $t0, -60($fp) +# Saves in local_southwest_CellularAutomaton_internal_13 data_17 +la $t0, data_17 +lw $t1, -48($fp) +# Moving local_southwest_CellularAutomaton_internal_13 to local_southwest_CellularAutomaton_internal_10 +move $t1, $t0 +sw $t1, -48($fp) +sw $t0, -60($fp) +sw $t1, -48($fp) +end__623: +lw $t0, -48($fp) +lw $t1, -24($fp) +# Moving local_southwest_CellularAutomaton_internal_10 to local_southwest_CellularAutomaton_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -48($fp) +sw $t1, -24($fp) +j end__611 +true__611: +lw $t0, -64($fp) +# Saves in local_southwest_CellularAutomaton_internal_14 data_18 +la $t0, data_18 +lw $t1, -24($fp) +# Moving local_southwest_CellularAutomaton_internal_14 to local_southwest_CellularAutomaton_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -64($fp) +sw $t1, -24($fp) +end__611: +lw $t0, -24($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 68 +jr $ra + + +function_neighbors_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_neighbors_CellularAutomaton_internal_39 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_north_CellularAutomaton +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -40($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_neighbors_CellularAutomaton_internal_9 data_19 +la $t1, data_19 +lw $t2, -36($fp) +# local_neighbors_CellularAutomaton_internal_7 <- local_neighbors_CellularAutomaton_internal_8 = local_neighbors_CellularAutomaton_internal_9 +move $t8, $t0 +move $t9, $t1 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_7 goto true__667 +sw $t0, -40($fp) +sw $t1, -44($fp) +sw $t2, -36($fp) +bnez $t2, true__667 +lw $t0, -48($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_10 +li $t0, 0 +sw $t0, -48($fp) +sw $t0, -48($fp) +j end__667 +true__667: +lw $t0, -48($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_10 +li $t0, 1 +sw $t0, -48($fp) +sw $t0, -48($fp) +end__667: +lw $t0, -4($fp) +lw $t1, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_south_CellularAutomaton +lw $t8, 64($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -56($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -60($fp) +# Saves in local_neighbors_CellularAutomaton_internal_13 data_20 +la $t1, data_20 +lw $t2, -52($fp) +# local_neighbors_CellularAutomaton_internal_11 <- local_neighbors_CellularAutomaton_internal_12 = local_neighbors_CellularAutomaton_internal_13 +move $t8, $t0 +move $t9, $t1 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_11 goto true__683 +sw $t0, -56($fp) +sw $t1, -60($fp) +sw $t2, -52($fp) +bnez $t2, true__683 +lw $t0, -64($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_14 +li $t0, 0 +sw $t0, -64($fp) +sw $t0, -64($fp) +j end__683 +true__683: +lw $t0, -64($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_14 +li $t0, 1 +sw $t0, -64($fp) +sw $t0, -64($fp) +end__683: +lw $t0, -48($fp) +lw $t1, -64($fp) +lw $t2, -32($fp) +# local_neighbors_CellularAutomaton_internal_6 <- local_neighbors_CellularAutomaton_internal_10 + local_neighbors_CellularAutomaton_internal_14 +add $t2, $t0, $t1 +lw $t3, -4($fp) +lw $t4, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_east_CellularAutomaton +lw $t8, 68($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t5, -0($fp) +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -64($fp) +sw $t2, -32($fp) +sw $t3, -4($fp) +sw $t4, -72($fp) +sw $t5, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -76($fp) +# Saves in local_neighbors_CellularAutomaton_internal_17 data_21 +la $t1, data_21 +lw $t2, -68($fp) +# local_neighbors_CellularAutomaton_internal_15 <- local_neighbors_CellularAutomaton_internal_16 = local_neighbors_CellularAutomaton_internal_17 +move $t8, $t0 +move $t9, $t1 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_15 goto true__700 +sw $t0, -72($fp) +sw $t1, -76($fp) +sw $t2, -68($fp) +bnez $t2, true__700 +lw $t0, -80($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_18 +li $t0, 0 +sw $t0, -80($fp) +sw $t0, -80($fp) +j end__700 +true__700: +lw $t0, -80($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_18 +li $t0, 1 +sw $t0, -80($fp) +sw $t0, -80($fp) +end__700: +lw $t0, -32($fp) +lw $t1, -80($fp) +lw $t2, -28($fp) +# local_neighbors_CellularAutomaton_internal_5 <- local_neighbors_CellularAutomaton_internal_6 + local_neighbors_CellularAutomaton_internal_18 +add $t2, $t0, $t1 +lw $t3, -4($fp) +lw $t4, -88($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_west_CellularAutomaton +lw $t8, 72($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t5, -0($fp) +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -80($fp) +sw $t2, -28($fp) +sw $t3, -4($fp) +sw $t4, -88($fp) +sw $t5, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Saves in local_neighbors_CellularAutomaton_internal_21 data_22 +la $t1, data_22 +lw $t2, -84($fp) +# local_neighbors_CellularAutomaton_internal_19 <- local_neighbors_CellularAutomaton_internal_20 = local_neighbors_CellularAutomaton_internal_21 +move $t8, $t0 +move $t9, $t1 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_19 goto true__717 +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -84($fp) +bnez $t2, true__717 +lw $t0, -96($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_22 +li $t0, 0 +sw $t0, -96($fp) +sw $t0, -96($fp) +j end__717 +true__717: +lw $t0, -96($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_22 +li $t0, 1 +sw $t0, -96($fp) +sw $t0, -96($fp) +end__717: +lw $t0, -28($fp) +lw $t1, -96($fp) +lw $t2, -24($fp) +# local_neighbors_CellularAutomaton_internal_4 <- local_neighbors_CellularAutomaton_internal_5 + local_neighbors_CellularAutomaton_internal_22 +add $t2, $t0, $t1 +lw $t3, -4($fp) +lw $t4, -104($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_northeast_CellularAutomaton +lw $t8, 80($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t5, -0($fp) +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -96($fp) +sw $t2, -24($fp) +sw $t3, -4($fp) +sw $t4, -104($fp) +sw $t5, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -104($fp) +# saves the return value +move $t0, $v0 +lw $t1, -108($fp) +# Saves in local_neighbors_CellularAutomaton_internal_25 data_23 +la $t1, data_23 +lw $t2, -100($fp) +# local_neighbors_CellularAutomaton_internal_23 <- local_neighbors_CellularAutomaton_internal_24 = local_neighbors_CellularAutomaton_internal_25 +move $t8, $t0 +move $t9, $t1 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_23 goto true__734 +sw $t0, -104($fp) +sw $t1, -108($fp) +sw $t2, -100($fp) +bnez $t2, true__734 +lw $t0, -112($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_26 +li $t0, 0 +sw $t0, -112($fp) +sw $t0, -112($fp) +j end__734 +true__734: +lw $t0, -112($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_26 +li $t0, 1 +sw $t0, -112($fp) +sw $t0, -112($fp) +end__734: +lw $t0, -24($fp) +lw $t1, -112($fp) +lw $t2, -20($fp) +# local_neighbors_CellularAutomaton_internal_3 <- local_neighbors_CellularAutomaton_internal_4 + local_neighbors_CellularAutomaton_internal_26 +add $t2, $t0, $t1 +lw $t3, -4($fp) +lw $t4, -120($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_northwest_CellularAutomaton +lw $t8, 76($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t5, -0($fp) +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -112($fp) +sw $t2, -20($fp) +sw $t3, -4($fp) +sw $t4, -120($fp) +sw $t5, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -120($fp) +# saves the return value +move $t0, $v0 +lw $t1, -124($fp) +# Saves in local_neighbors_CellularAutomaton_internal_29 data_24 +la $t1, data_24 +lw $t2, -116($fp) +# local_neighbors_CellularAutomaton_internal_27 <- local_neighbors_CellularAutomaton_internal_28 = local_neighbors_CellularAutomaton_internal_29 +move $t8, $t0 +move $t9, $t1 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_27 goto true__751 +sw $t0, -120($fp) +sw $t1, -124($fp) +sw $t2, -116($fp) +bnez $t2, true__751 +lw $t0, -128($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_30 +li $t0, 0 +sw $t0, -128($fp) +sw $t0, -128($fp) +j end__751 +true__751: +lw $t0, -128($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_30 +li $t0, 1 +sw $t0, -128($fp) +sw $t0, -128($fp) +end__751: +lw $t0, -20($fp) +lw $t1, -128($fp) +lw $t2, -16($fp) +# local_neighbors_CellularAutomaton_internal_2 <- local_neighbors_CellularAutomaton_internal_3 + local_neighbors_CellularAutomaton_internal_30 +add $t2, $t0, $t1 +lw $t3, -4($fp) +lw $t4, -136($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_southeast_CellularAutomaton +lw $t8, 84($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t5, -0($fp) +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -128($fp) +sw $t2, -16($fp) +sw $t3, -4($fp) +sw $t4, -136($fp) +sw $t5, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -136($fp) +# saves the return value +move $t0, $v0 +lw $t1, -140($fp) +# Saves in local_neighbors_CellularAutomaton_internal_33 data_25 +la $t1, data_25 +lw $t2, -132($fp) +# local_neighbors_CellularAutomaton_internal_31 <- local_neighbors_CellularAutomaton_internal_32 = local_neighbors_CellularAutomaton_internal_33 +move $t8, $t0 +move $t9, $t1 +loop_16: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_16 +beqz $a1, mismatch_16 +seq $v0, $a0, $a1 +beqz $v0, mismatch_16 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_16 +mismatch_16: +li $v0, 0 +j end_16 +check_16: +bnez $a1, mismatch_16 +li $v0, 1 +end_16: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_31 goto true__768 +sw $t0, -136($fp) +sw $t1, -140($fp) +sw $t2, -132($fp) +bnez $t2, true__768 +lw $t0, -144($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_34 +li $t0, 0 +sw $t0, -144($fp) +sw $t0, -144($fp) +j end__768 +true__768: +lw $t0, -144($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_34 +li $t0, 1 +sw $t0, -144($fp) +sw $t0, -144($fp) +end__768: +lw $t0, -16($fp) +lw $t1, -144($fp) +lw $t2, -12($fp) +# local_neighbors_CellularAutomaton_internal_1 <- local_neighbors_CellularAutomaton_internal_2 + local_neighbors_CellularAutomaton_internal_34 +add $t2, $t0, $t1 +lw $t3, -4($fp) +lw $t4, -152($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_southwest_CellularAutomaton +lw $t8, 88($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t5, -0($fp) +sw $t5, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -144($fp) +sw $t2, -12($fp) +sw $t3, -4($fp) +sw $t4, -152($fp) +sw $t5, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -152($fp) +# saves the return value +move $t0, $v0 +lw $t1, -156($fp) +# Saves in local_neighbors_CellularAutomaton_internal_37 data_26 +la $t1, data_26 +lw $t2, -148($fp) +# local_neighbors_CellularAutomaton_internal_35 <- local_neighbors_CellularAutomaton_internal_36 = local_neighbors_CellularAutomaton_internal_37 +move $t8, $t0 +move $t9, $t1 +loop_17: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_17 +beqz $a1, mismatch_17 +seq $v0, $a0, $a1 +beqz $v0, mismatch_17 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_17 +mismatch_17: +li $v0, 0 +j end_17 +check_17: +bnez $a1, mismatch_17 +li $v0, 1 +end_17: +move $t2, $v0 +# If local_neighbors_CellularAutomaton_internal_35 goto true__785 +sw $t0, -152($fp) +sw $t1, -156($fp) +sw $t2, -148($fp) +bnez $t2, true__785 +lw $t0, -160($fp) +# Moving 0 to local_neighbors_CellularAutomaton_internal_38 +li $t0, 0 +sw $t0, -160($fp) +sw $t0, -160($fp) +j end__785 +true__785: +lw $t0, -160($fp) +# Moving 1 to local_neighbors_CellularAutomaton_internal_38 +li $t0, 1 +sw $t0, -160($fp) +sw $t0, -160($fp) +end__785: +lw $t0, -12($fp) +lw $t1, -160($fp) +lw $t2, -8($fp) +# local_neighbors_CellularAutomaton_internal_0 <- local_neighbors_CellularAutomaton_internal_1 + local_neighbors_CellularAutomaton_internal_38 +add $t2, $t0, $t1 +lw $t3, -164($fp) +# Moving local_neighbors_CellularAutomaton_internal_0 to local_neighbors_CellularAutomaton_internal_39 +move $t3, $t2 +sw $t3, -164($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -160($fp) +sw $t2, -8($fp) +sw $t3, -164($fp) +# Removing all locals from stack +addiu $sp, $sp, 168 +jr $ra + + +function_cell_at_next_evolution_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value position +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cell_at_next_evolution_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_neighbors_CellularAutomaton +lw $t8, 92($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_0 <- local_cell_at_next_evolution_CellularAutomaton_internal_1 = 3 +li $t9, 3 +seq $t1, $t0, $t9 +# If local_cell_at_next_evolution_CellularAutomaton_internal_0 goto true__805 +sw $t0, -12($fp) +sw $t1, -8($fp) +bnez $t1, true__805 +lw $t0, -4($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_neighbors_CellularAutomaton +lw $t8, 92($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -24($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_3 <- local_cell_at_next_evolution_CellularAutomaton_internal_4 = 2 +li $t9, 2 +seq $t1, $t0, $t9 +# If local_cell_at_next_evolution_CellularAutomaton_internal_3 goto true__813 +sw $t0, -24($fp) +sw $t1, -20($fp) +bnez $t1, true__813 +lw $t0, -32($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_6 data_27 +la $t0, data_27 +lw $t1, -28($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_6 to local_cell_at_next_evolution_CellularAutomaton_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -32($fp) +sw $t1, -28($fp) +j end__813 +true__813: +lw $t0, -4($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_CellularAutomaton +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -40($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_9 data_28 +la $t1, data_28 +lw $t2, -36($fp) +# local_cell_at_next_evolution_CellularAutomaton_internal_7 <- local_cell_at_next_evolution_CellularAutomaton_internal_8 = local_cell_at_next_evolution_CellularAutomaton_internal_9 +move $t8, $t0 +move $t9, $t1 +loop_18: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_18 +beqz $a1, mismatch_18 +seq $v0, $a0, $a1 +beqz $v0, mismatch_18 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_18 +mismatch_18: +li $v0, 0 +j end_18 +check_18: +bnez $a1, mismatch_18 +li $v0, 1 +end_18: +move $t2, $v0 +# If local_cell_at_next_evolution_CellularAutomaton_internal_7 goto true__830 +sw $t0, -40($fp) +sw $t1, -44($fp) +sw $t2, -36($fp) +bnez $t2, true__830 +lw $t0, -52($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_11 data_29 +la $t0, data_29 +lw $t1, -48($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_11 to local_cell_at_next_evolution_CellularAutomaton_internal_10 +move $t1, $t0 +sw $t1, -48($fp) +sw $t0, -52($fp) +sw $t1, -48($fp) +j end__830 +true__830: +lw $t0, -56($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_12 data_30 +la $t0, data_30 +lw $t1, -48($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_12 to local_cell_at_next_evolution_CellularAutomaton_internal_10 +move $t1, $t0 +sw $t1, -48($fp) +sw $t0, -56($fp) +sw $t1, -48($fp) +end__830: +lw $t0, -48($fp) +lw $t1, -28($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_10 to local_cell_at_next_evolution_CellularAutomaton_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -48($fp) +sw $t1, -28($fp) +end__813: +lw $t0, -28($fp) +lw $t1, -16($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_5 to local_cell_at_next_evolution_CellularAutomaton_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -28($fp) +sw $t1, -16($fp) +j end__805 +true__805: +lw $t0, -60($fp) +# Saves in local_cell_at_next_evolution_CellularAutomaton_internal_13 data_31 +la $t0, data_31 +lw $t1, -16($fp) +# Moving local_cell_at_next_evolution_CellularAutomaton_internal_13 to local_cell_at_next_evolution_CellularAutomaton_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -60($fp) +sw $t1, -16($fp) +end__805: +lw $t0, -16($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 64 +jr $ra + + +function_evolve_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_evolve_CellularAutomaton_position_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_num_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_temp_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_evolve_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_evolve_CellularAutomaton_position_0 +li $t0, 0 +sw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_num_cells_CellularAutomaton +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_evolve_CellularAutomaton_internal_2 to local_evolve_CellularAutomaton_num_1 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -20($fp) +# Saves in local_evolve_CellularAutomaton_internal_4 data_32 +la $t2, data_32 +lw $t3, -16($fp) +# Moving local_evolve_CellularAutomaton_internal_4 to local_evolve_CellularAutomaton_temp_3 +move $t3, $t2 +sw $t3, -16($fp) +lw $t4, -24($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t4, $v0 +sw $t0, -12($fp) +sw $t1, -8($fp) +sw $t2, -20($fp) +sw $t3, -16($fp) +sw $t4, -24($fp) +start__868: +lw $t0, -4($fp) +lw $t1, -8($fp) +lw $t2, -28($fp) +# local_evolve_CellularAutomaton_internal_6 <- local_evolve_CellularAutomaton_position_0 < local_evolve_CellularAutomaton_num_1 +slt $t2, $t0, $t1 +# If not local_evolve_CellularAutomaton_internal_6 goto end__868 +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -28($fp) +beqz $t2, end__868 +lw $t0, -0($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cell_at_next_evolution_CellularAutomaton +lw $t8, 96($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -32($fp) +sw $t2, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +lw $t2, -40($fp) +# local_evolve_CellularAutomaton_internal_9 <- Type of local_evolve_CellularAutomaton_temp_3 +la $t2, type_String +lw $t3, -44($fp) +# Saves in local_evolve_CellularAutomaton_internal_10 data_0 +la $t3, data_0 +# local_evolve_CellularAutomaton_internal_9 <- local_evolve_CellularAutomaton_internal_9 = local_evolve_CellularAutomaton_internal_10 +move $t8, $t2 +move $t9, $t3 +loop_19: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_19 +beqz $a1, mismatch_19 +seq $v0, $a0, $a1 +beqz $v0, mismatch_19 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_19 +mismatch_19: +li $v0, 0 +j end_19 +check_19: +bnez $a1, mismatch_19 +li $v0, 1 +end_19: +move $t2, $v0 +# If not local_evolve_CellularAutomaton_internal_9 goto continue__881 +sw $t0, -32($fp) +sw $t1, -16($fp) +sw $t2, -40($fp) +sw $t3, -44($fp) +beqz $t2, continue__881 +la $a0, dispatch_error +j .raise +continue__881: +lw $t0, -36($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -32($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -16($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -32($fp) +sw $t2, -16($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Moving local_evolve_CellularAutomaton_internal_8 to local_evolve_CellularAutomaton_temp_3 +move $t1, $t0 +sw $t1, -16($fp) +lw $t2, -4($fp) +lw $t3, -48($fp) +# local_evolve_CellularAutomaton_internal_11 <- local_evolve_CellularAutomaton_position_0 + 1 +addi $t3, $t2, 1 +# Moving local_evolve_CellularAutomaton_internal_11 to local_evolve_CellularAutomaton_position_0 +move $t2, $t3 +sw $t2, -4($fp) +lw $t4, -52($fp) +# Moving local_evolve_CellularAutomaton_internal_11 to local_evolve_CellularAutomaton_internal_12 +move $t4, $t3 +sw $t4, -52($fp) +lw $t5, -24($fp) +# Moving local_evolve_CellularAutomaton_internal_12 to local_evolve_CellularAutomaton_internal_5 +move $t5, $t4 +sw $t5, -24($fp) +sw $t0, -36($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -48($fp) +sw $t4, -52($fp) +sw $t5, -24($fp) +j start__868 +end__868: +lw $t0, -16($fp) +lw $t1, -0($fp) +# self . population_map <- SET local_evolve_CellularAutomaton_temp_3 +sw $t0, 24($t1) +lw $t2, -56($fp) +# Moving self to local_evolve_CellularAutomaton_internal_13 +move $t2, $t1 +sw $t2, -56($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -56($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_option_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_option_CellularAutomaton_num_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_39 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_40 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_41 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_42 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_43 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_44 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_45 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_46 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_47 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_48 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_49 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_50 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_51 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_52 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_53 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_54 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_55 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_56 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_57 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_58 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_59 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_60 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_61 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_62 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_63 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_64 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_65 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_66 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_67 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_68 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_69 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_70 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_71 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_72 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_73 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_74 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_75 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_76 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_77 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_78 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_79 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_80 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_81 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_82 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_83 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_84 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_85 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_86 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_87 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_88 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_89 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_90 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_91 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_92 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_93 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_94 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_95 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_96 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_97 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_98 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_99 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_100 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_101 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_102 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_103 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_104 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_105 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_106 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_107 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_108 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_109 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_110 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_111 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_112 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_113 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_114 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_option_CellularAutomaton_internal_115 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_option_CellularAutomaton_num_0 +li $t0, 0 +sw $t0, -4($fp) +lw $t1, -8($fp) +# Saves in local_option_CellularAutomaton_internal_1 data_33 +la $t1, data_33 +lw $t2, -0($fp) +lw $t3, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Saves in local_option_CellularAutomaton_internal_3 data_34 +la $t1, data_34 +lw $t2, -0($fp) +lw $t3, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -16($fp) +sw $t2, -0($fp) +sw $t3, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Saves in local_option_CellularAutomaton_internal_5 data_35 +la $t1, data_35 +lw $t2, -0($fp) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +sw $t2, -0($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Saves in local_option_CellularAutomaton_internal_7 data_36 +la $t1, data_36 +lw $t2, -0($fp) +lw $t3, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -0($fp) +sw $t3, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Saves in local_option_CellularAutomaton_internal_9 data_37 +la $t1, data_37 +lw $t2, -0($fp) +lw $t3, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -0($fp) +sw $t3, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Saves in local_option_CellularAutomaton_internal_11 data_38 +la $t1, data_38 +lw $t2, -0($fp) +lw $t3, -52($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -0($fp) +sw $t3, -52($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Saves in local_option_CellularAutomaton_internal_13 data_39 +la $t1, data_39 +lw $t2, -0($fp) +lw $t3, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +sw $t2, -0($fp) +sw $t3, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Saves in local_option_CellularAutomaton_internal_15 data_40 +la $t1, data_40 +lw $t2, -0($fp) +lw $t3, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -60($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +sw $t3, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Saves in local_option_CellularAutomaton_internal_17 data_41 +la $t1, data_41 +lw $t2, -0($fp) +lw $t3, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -0($fp) +sw $t3, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Saves in local_option_CellularAutomaton_internal_19 data_42 +la $t1, data_42 +lw $t2, -0($fp) +lw $t3, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -0($fp) +sw $t3, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Saves in local_option_CellularAutomaton_internal_21 data_43 +la $t1, data_43 +lw $t2, -0($fp) +lw $t3, -92($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -0($fp) +sw $t3, -92($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# Saves in local_option_CellularAutomaton_internal_23 data_44 +la $t1, data_44 +lw $t2, -0($fp) +lw $t3, -100($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +sw $t2, -0($fp) +sw $t3, -100($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -100($fp) +# saves the return value +move $t0, $v0 +lw $t1, -104($fp) +# Saves in local_option_CellularAutomaton_internal_25 data_45 +la $t1, data_45 +lw $t2, -0($fp) +lw $t3, -108($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -100($fp) +sw $t1, -104($fp) +sw $t2, -0($fp) +sw $t3, -108($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +lw $t1, -112($fp) +# Saves in local_option_CellularAutomaton_internal_27 data_46 +la $t1, data_46 +lw $t2, -0($fp) +lw $t3, -116($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -108($fp) +sw $t1, -112($fp) +sw $t2, -0($fp) +sw $t3, -116($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -116($fp) +# saves the return value +move $t0, $v0 +lw $t1, -120($fp) +# Saves in local_option_CellularAutomaton_internal_29 data_47 +la $t1, data_47 +lw $t2, -0($fp) +lw $t3, -124($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -116($fp) +sw $t1, -120($fp) +sw $t2, -0($fp) +sw $t3, -124($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -124($fp) +# saves the return value +move $t0, $v0 +lw $t1, -128($fp) +# Saves in local_option_CellularAutomaton_internal_31 data_48 +la $t1, data_48 +lw $t2, -0($fp) +lw $t3, -132($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -124($fp) +sw $t1, -128($fp) +sw $t2, -0($fp) +sw $t3, -132($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -132($fp) +# saves the return value +move $t0, $v0 +lw $t1, -136($fp) +# Saves in local_option_CellularAutomaton_internal_33 data_49 +la $t1, data_49 +lw $t2, -0($fp) +lw $t3, -140($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -132($fp) +sw $t1, -136($fp) +sw $t2, -0($fp) +sw $t3, -140($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -140($fp) +# saves the return value +move $t0, $v0 +lw $t1, -144($fp) +# Saves in local_option_CellularAutomaton_internal_35 data_50 +la $t1, data_50 +lw $t2, -0($fp) +lw $t3, -148($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -140($fp) +sw $t1, -144($fp) +sw $t2, -0($fp) +sw $t3, -148($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -148($fp) +# saves the return value +move $t0, $v0 +lw $t1, -152($fp) +# Saves in local_option_CellularAutomaton_internal_37 data_51 +la $t1, data_51 +lw $t2, -0($fp) +lw $t3, -156($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -148($fp) +sw $t1, -152($fp) +sw $t2, -0($fp) +sw $t3, -156($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -156($fp) +# saves the return value +move $t0, $v0 +lw $t1, -160($fp) +# Saves in local_option_CellularAutomaton_internal_39 data_52 +la $t1, data_52 +lw $t2, -0($fp) +lw $t3, -164($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -156($fp) +sw $t1, -160($fp) +sw $t2, -0($fp) +sw $t3, -164($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -164($fp) +# saves the return value +move $t0, $v0 +lw $t1, -168($fp) +# Saves in local_option_CellularAutomaton_internal_41 data_53 +la $t1, data_53 +lw $t2, -0($fp) +lw $t3, -172($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -164($fp) +sw $t1, -168($fp) +sw $t2, -0($fp) +sw $t3, -172($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -172($fp) +# saves the return value +move $t0, $v0 +lw $t1, -176($fp) +# Saves in local_option_CellularAutomaton_internal_43 data_54 +la $t1, data_54 +lw $t2, -0($fp) +lw $t3, -180($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -172($fp) +sw $t1, -176($fp) +sw $t2, -0($fp) +sw $t3, -180($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -180($fp) +# saves the return value +move $t0, $v0 +lw $t1, -184($fp) +# Saves in local_option_CellularAutomaton_internal_45 data_55 +la $t1, data_55 +lw $t2, -0($fp) +lw $t3, -188($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -180($fp) +sw $t1, -184($fp) +sw $t2, -0($fp) +sw $t3, -188($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -188($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -192($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_int_IO +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -188($fp) +sw $t1, -0($fp) +sw $t2, -192($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -192($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_option_CellularAutomaton_internal_47 to local_option_CellularAutomaton_num_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -196($fp) +# Saves in local_option_CellularAutomaton_internal_48 data_56 +la $t2, data_56 +lw $t3, -0($fp) +lw $t4, -200($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -192($fp) +sw $t1, -4($fp) +sw $t2, -196($fp) +sw $t3, -0($fp) +sw $t4, -200($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -200($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -204($fp) +# local_option_CellularAutomaton_internal_50 <- local_option_CellularAutomaton_num_0 = 1 +li $t9, 1 +seq $t2, $t1, $t9 +# If local_option_CellularAutomaton_internal_50 goto true__1082 +sw $t0, -200($fp) +sw $t1, -4($fp) +sw $t2, -204($fp) +bnez $t2, true__1082 +lw $t0, -4($fp) +lw $t1, -212($fp) +# local_option_CellularAutomaton_internal_52 <- local_option_CellularAutomaton_num_0 = 2 +li $t9, 2 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_52 goto true__1086 +sw $t0, -4($fp) +sw $t1, -212($fp) +bnez $t1, true__1086 +lw $t0, -4($fp) +lw $t1, -220($fp) +# local_option_CellularAutomaton_internal_54 <- local_option_CellularAutomaton_num_0 = 3 +li $t9, 3 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_54 goto true__1090 +sw $t0, -4($fp) +sw $t1, -220($fp) +bnez $t1, true__1090 +lw $t0, -4($fp) +lw $t1, -228($fp) +# local_option_CellularAutomaton_internal_56 <- local_option_CellularAutomaton_num_0 = 4 +li $t9, 4 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_56 goto true__1094 +sw $t0, -4($fp) +sw $t1, -228($fp) +bnez $t1, true__1094 +lw $t0, -4($fp) +lw $t1, -236($fp) +# local_option_CellularAutomaton_internal_58 <- local_option_CellularAutomaton_num_0 = 5 +li $t9, 5 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_58 goto true__1098 +sw $t0, -4($fp) +sw $t1, -236($fp) +bnez $t1, true__1098 +lw $t0, -4($fp) +lw $t1, -244($fp) +# local_option_CellularAutomaton_internal_60 <- local_option_CellularAutomaton_num_0 = 6 +li $t9, 6 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_60 goto true__1102 +sw $t0, -4($fp) +sw $t1, -244($fp) +bnez $t1, true__1102 +lw $t0, -4($fp) +lw $t1, -252($fp) +# local_option_CellularAutomaton_internal_62 <- local_option_CellularAutomaton_num_0 = 7 +li $t9, 7 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_62 goto true__1106 +sw $t0, -4($fp) +sw $t1, -252($fp) +bnez $t1, true__1106 +lw $t0, -4($fp) +lw $t1, -260($fp) +# local_option_CellularAutomaton_internal_64 <- local_option_CellularAutomaton_num_0 = 8 +li $t9, 8 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_64 goto true__1110 +sw $t0, -4($fp) +sw $t1, -260($fp) +bnez $t1, true__1110 +lw $t0, -4($fp) +lw $t1, -268($fp) +# local_option_CellularAutomaton_internal_66 <- local_option_CellularAutomaton_num_0 = 9 +li $t9, 9 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_66 goto true__1114 +sw $t0, -4($fp) +sw $t1, -268($fp) +bnez $t1, true__1114 +lw $t0, -4($fp) +lw $t1, -276($fp) +# local_option_CellularAutomaton_internal_68 <- local_option_CellularAutomaton_num_0 = 10 +li $t9, 10 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_68 goto true__1118 +sw $t0, -4($fp) +sw $t1, -276($fp) +bnez $t1, true__1118 +lw $t0, -4($fp) +lw $t1, -284($fp) +# local_option_CellularAutomaton_internal_70 <- local_option_CellularAutomaton_num_0 = 11 +li $t9, 11 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_70 goto true__1122 +sw $t0, -4($fp) +sw $t1, -284($fp) +bnez $t1, true__1122 +lw $t0, -4($fp) +lw $t1, -292($fp) +# local_option_CellularAutomaton_internal_72 <- local_option_CellularAutomaton_num_0 = 12 +li $t9, 12 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_72 goto true__1126 +sw $t0, -4($fp) +sw $t1, -292($fp) +bnez $t1, true__1126 +lw $t0, -4($fp) +lw $t1, -300($fp) +# local_option_CellularAutomaton_internal_74 <- local_option_CellularAutomaton_num_0 = 13 +li $t9, 13 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_74 goto true__1130 +sw $t0, -4($fp) +sw $t1, -300($fp) +bnez $t1, true__1130 +lw $t0, -4($fp) +lw $t1, -308($fp) +# local_option_CellularAutomaton_internal_76 <- local_option_CellularAutomaton_num_0 = 14 +li $t9, 14 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_76 goto true__1134 +sw $t0, -4($fp) +sw $t1, -308($fp) +bnez $t1, true__1134 +lw $t0, -4($fp) +lw $t1, -316($fp) +# local_option_CellularAutomaton_internal_78 <- local_option_CellularAutomaton_num_0 = 15 +li $t9, 15 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_78 goto true__1138 +sw $t0, -4($fp) +sw $t1, -316($fp) +bnez $t1, true__1138 +lw $t0, -4($fp) +lw $t1, -324($fp) +# local_option_CellularAutomaton_internal_80 <- local_option_CellularAutomaton_num_0 = 16 +li $t9, 16 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_80 goto true__1142 +sw $t0, -4($fp) +sw $t1, -324($fp) +bnez $t1, true__1142 +lw $t0, -4($fp) +lw $t1, -332($fp) +# local_option_CellularAutomaton_internal_82 <- local_option_CellularAutomaton_num_0 = 17 +li $t9, 17 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_82 goto true__1146 +sw $t0, -4($fp) +sw $t1, -332($fp) +bnez $t1, true__1146 +lw $t0, -4($fp) +lw $t1, -340($fp) +# local_option_CellularAutomaton_internal_84 <- local_option_CellularAutomaton_num_0 = 18 +li $t9, 18 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_84 goto true__1150 +sw $t0, -4($fp) +sw $t1, -340($fp) +bnez $t1, true__1150 +lw $t0, -4($fp) +lw $t1, -348($fp) +# local_option_CellularAutomaton_internal_86 <- local_option_CellularAutomaton_num_0 = 19 +li $t9, 19 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_86 goto true__1154 +sw $t0, -4($fp) +sw $t1, -348($fp) +bnez $t1, true__1154 +lw $t0, -4($fp) +lw $t1, -356($fp) +# local_option_CellularAutomaton_internal_88 <- local_option_CellularAutomaton_num_0 = 20 +li $t9, 20 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_88 goto true__1158 +sw $t0, -4($fp) +sw $t1, -356($fp) +bnez $t1, true__1158 +lw $t0, -4($fp) +lw $t1, -364($fp) +# local_option_CellularAutomaton_internal_90 <- local_option_CellularAutomaton_num_0 = 21 +li $t9, 21 +seq $t1, $t0, $t9 +# If local_option_CellularAutomaton_internal_90 goto true__1162 +sw $t0, -4($fp) +sw $t1, -364($fp) +bnez $t1, true__1162 +lw $t0, -372($fp) +# Saves in local_option_CellularAutomaton_internal_92 data_57 +la $t0, data_57 +lw $t1, -368($fp) +# Moving local_option_CellularAutomaton_internal_92 to local_option_CellularAutomaton_internal_91 +move $t1, $t0 +sw $t1, -368($fp) +sw $t0, -372($fp) +sw $t1, -368($fp) +j end__1162 +true__1162: +lw $t0, -376($fp) +# Saves in local_option_CellularAutomaton_internal_93 data_58 +la $t0, data_58 +lw $t1, -368($fp) +# Moving local_option_CellularAutomaton_internal_93 to local_option_CellularAutomaton_internal_91 +move $t1, $t0 +sw $t1, -368($fp) +sw $t0, -376($fp) +sw $t1, -368($fp) +end__1162: +lw $t0, -368($fp) +lw $t1, -360($fp) +# Moving local_option_CellularAutomaton_internal_91 to local_option_CellularAutomaton_internal_89 +move $t1, $t0 +sw $t1, -360($fp) +sw $t0, -368($fp) +sw $t1, -360($fp) +j end__1158 +true__1158: +lw $t0, -380($fp) +# Saves in local_option_CellularAutomaton_internal_94 data_59 +la $t0, data_59 +lw $t1, -360($fp) +# Moving local_option_CellularAutomaton_internal_94 to local_option_CellularAutomaton_internal_89 +move $t1, $t0 +sw $t1, -360($fp) +sw $t0, -380($fp) +sw $t1, -360($fp) +end__1158: +lw $t0, -360($fp) +lw $t1, -352($fp) +# Moving local_option_CellularAutomaton_internal_89 to local_option_CellularAutomaton_internal_87 +move $t1, $t0 +sw $t1, -352($fp) +sw $t0, -360($fp) +sw $t1, -352($fp) +j end__1154 +true__1154: +lw $t0, -384($fp) +# Saves in local_option_CellularAutomaton_internal_95 data_60 +la $t0, data_60 +lw $t1, -352($fp) +# Moving local_option_CellularAutomaton_internal_95 to local_option_CellularAutomaton_internal_87 +move $t1, $t0 +sw $t1, -352($fp) +sw $t0, -384($fp) +sw $t1, -352($fp) +end__1154: +lw $t0, -352($fp) +lw $t1, -344($fp) +# Moving local_option_CellularAutomaton_internal_87 to local_option_CellularAutomaton_internal_85 +move $t1, $t0 +sw $t1, -344($fp) +sw $t0, -352($fp) +sw $t1, -344($fp) +j end__1150 +true__1150: +lw $t0, -388($fp) +# Saves in local_option_CellularAutomaton_internal_96 data_61 +la $t0, data_61 +lw $t1, -344($fp) +# Moving local_option_CellularAutomaton_internal_96 to local_option_CellularAutomaton_internal_85 +move $t1, $t0 +sw $t1, -344($fp) +sw $t0, -388($fp) +sw $t1, -344($fp) +end__1150: +lw $t0, -344($fp) +lw $t1, -336($fp) +# Moving local_option_CellularAutomaton_internal_85 to local_option_CellularAutomaton_internal_83 +move $t1, $t0 +sw $t1, -336($fp) +sw $t0, -344($fp) +sw $t1, -336($fp) +j end__1146 +true__1146: +lw $t0, -392($fp) +# Saves in local_option_CellularAutomaton_internal_97 data_62 +la $t0, data_62 +lw $t1, -336($fp) +# Moving local_option_CellularAutomaton_internal_97 to local_option_CellularAutomaton_internal_83 +move $t1, $t0 +sw $t1, -336($fp) +sw $t0, -392($fp) +sw $t1, -336($fp) +end__1146: +lw $t0, -336($fp) +lw $t1, -328($fp) +# Moving local_option_CellularAutomaton_internal_83 to local_option_CellularAutomaton_internal_81 +move $t1, $t0 +sw $t1, -328($fp) +sw $t0, -336($fp) +sw $t1, -328($fp) +j end__1142 +true__1142: +lw $t0, -396($fp) +# Saves in local_option_CellularAutomaton_internal_98 data_63 +la $t0, data_63 +lw $t1, -328($fp) +# Moving local_option_CellularAutomaton_internal_98 to local_option_CellularAutomaton_internal_81 +move $t1, $t0 +sw $t1, -328($fp) +sw $t0, -396($fp) +sw $t1, -328($fp) +end__1142: +lw $t0, -328($fp) +lw $t1, -320($fp) +# Moving local_option_CellularAutomaton_internal_81 to local_option_CellularAutomaton_internal_79 +move $t1, $t0 +sw $t1, -320($fp) +sw $t0, -328($fp) +sw $t1, -320($fp) +j end__1138 +true__1138: +lw $t0, -400($fp) +# Saves in local_option_CellularAutomaton_internal_99 data_64 +la $t0, data_64 +lw $t1, -320($fp) +# Moving local_option_CellularAutomaton_internal_99 to local_option_CellularAutomaton_internal_79 +move $t1, $t0 +sw $t1, -320($fp) +sw $t0, -400($fp) +sw $t1, -320($fp) +end__1138: +lw $t0, -320($fp) +lw $t1, -312($fp) +# Moving local_option_CellularAutomaton_internal_79 to local_option_CellularAutomaton_internal_77 +move $t1, $t0 +sw $t1, -312($fp) +sw $t0, -320($fp) +sw $t1, -312($fp) +j end__1134 +true__1134: +lw $t0, -404($fp) +# Saves in local_option_CellularAutomaton_internal_100 data_65 +la $t0, data_65 +lw $t1, -312($fp) +# Moving local_option_CellularAutomaton_internal_100 to local_option_CellularAutomaton_internal_77 +move $t1, $t0 +sw $t1, -312($fp) +sw $t0, -404($fp) +sw $t1, -312($fp) +end__1134: +lw $t0, -312($fp) +lw $t1, -304($fp) +# Moving local_option_CellularAutomaton_internal_77 to local_option_CellularAutomaton_internal_75 +move $t1, $t0 +sw $t1, -304($fp) +sw $t0, -312($fp) +sw $t1, -304($fp) +j end__1130 +true__1130: +lw $t0, -408($fp) +# Saves in local_option_CellularAutomaton_internal_101 data_66 +la $t0, data_66 +lw $t1, -304($fp) +# Moving local_option_CellularAutomaton_internal_101 to local_option_CellularAutomaton_internal_75 +move $t1, $t0 +sw $t1, -304($fp) +sw $t0, -408($fp) +sw $t1, -304($fp) +end__1130: +lw $t0, -304($fp) +lw $t1, -296($fp) +# Moving local_option_CellularAutomaton_internal_75 to local_option_CellularAutomaton_internal_73 +move $t1, $t0 +sw $t1, -296($fp) +sw $t0, -304($fp) +sw $t1, -296($fp) +j end__1126 +true__1126: +lw $t0, -412($fp) +# Saves in local_option_CellularAutomaton_internal_102 data_67 +la $t0, data_67 +lw $t1, -296($fp) +# Moving local_option_CellularAutomaton_internal_102 to local_option_CellularAutomaton_internal_73 +move $t1, $t0 +sw $t1, -296($fp) +sw $t0, -412($fp) +sw $t1, -296($fp) +end__1126: +lw $t0, -296($fp) +lw $t1, -288($fp) +# Moving local_option_CellularAutomaton_internal_73 to local_option_CellularAutomaton_internal_71 +move $t1, $t0 +sw $t1, -288($fp) +sw $t0, -296($fp) +sw $t1, -288($fp) +j end__1122 +true__1122: +lw $t0, -416($fp) +# Saves in local_option_CellularAutomaton_internal_103 data_68 +la $t0, data_68 +lw $t1, -288($fp) +# Moving local_option_CellularAutomaton_internal_103 to local_option_CellularAutomaton_internal_71 +move $t1, $t0 +sw $t1, -288($fp) +sw $t0, -416($fp) +sw $t1, -288($fp) +end__1122: +lw $t0, -288($fp) +lw $t1, -280($fp) +# Moving local_option_CellularAutomaton_internal_71 to local_option_CellularAutomaton_internal_69 +move $t1, $t0 +sw $t1, -280($fp) +sw $t0, -288($fp) +sw $t1, -280($fp) +j end__1118 +true__1118: +lw $t0, -420($fp) +# Saves in local_option_CellularAutomaton_internal_104 data_69 +la $t0, data_69 +lw $t1, -280($fp) +# Moving local_option_CellularAutomaton_internal_104 to local_option_CellularAutomaton_internal_69 +move $t1, $t0 +sw $t1, -280($fp) +sw $t0, -420($fp) +sw $t1, -280($fp) +end__1118: +lw $t0, -280($fp) +lw $t1, -272($fp) +# Moving local_option_CellularAutomaton_internal_69 to local_option_CellularAutomaton_internal_67 +move $t1, $t0 +sw $t1, -272($fp) +sw $t0, -280($fp) +sw $t1, -272($fp) +j end__1114 +true__1114: +lw $t0, -424($fp) +# Saves in local_option_CellularAutomaton_internal_105 data_70 +la $t0, data_70 +lw $t1, -272($fp) +# Moving local_option_CellularAutomaton_internal_105 to local_option_CellularAutomaton_internal_67 +move $t1, $t0 +sw $t1, -272($fp) +sw $t0, -424($fp) +sw $t1, -272($fp) +end__1114: +lw $t0, -272($fp) +lw $t1, -264($fp) +# Moving local_option_CellularAutomaton_internal_67 to local_option_CellularAutomaton_internal_65 +move $t1, $t0 +sw $t1, -264($fp) +sw $t0, -272($fp) +sw $t1, -264($fp) +j end__1110 +true__1110: +lw $t0, -428($fp) +# Saves in local_option_CellularAutomaton_internal_106 data_71 +la $t0, data_71 +lw $t1, -264($fp) +# Moving local_option_CellularAutomaton_internal_106 to local_option_CellularAutomaton_internal_65 +move $t1, $t0 +sw $t1, -264($fp) +sw $t0, -428($fp) +sw $t1, -264($fp) +end__1110: +lw $t0, -264($fp) +lw $t1, -256($fp) +# Moving local_option_CellularAutomaton_internal_65 to local_option_CellularAutomaton_internal_63 +move $t1, $t0 +sw $t1, -256($fp) +sw $t0, -264($fp) +sw $t1, -256($fp) +j end__1106 +true__1106: +lw $t0, -432($fp) +# Saves in local_option_CellularAutomaton_internal_107 data_72 +la $t0, data_72 +lw $t1, -256($fp) +# Moving local_option_CellularAutomaton_internal_107 to local_option_CellularAutomaton_internal_63 +move $t1, $t0 +sw $t1, -256($fp) +sw $t0, -432($fp) +sw $t1, -256($fp) +end__1106: +lw $t0, -256($fp) +lw $t1, -248($fp) +# Moving local_option_CellularAutomaton_internal_63 to local_option_CellularAutomaton_internal_61 +move $t1, $t0 +sw $t1, -248($fp) +sw $t0, -256($fp) +sw $t1, -248($fp) +j end__1102 +true__1102: +lw $t0, -436($fp) +# Saves in local_option_CellularAutomaton_internal_108 data_73 +la $t0, data_73 +lw $t1, -248($fp) +# Moving local_option_CellularAutomaton_internal_108 to local_option_CellularAutomaton_internal_61 +move $t1, $t0 +sw $t1, -248($fp) +sw $t0, -436($fp) +sw $t1, -248($fp) +end__1102: +lw $t0, -248($fp) +lw $t1, -240($fp) +# Moving local_option_CellularAutomaton_internal_61 to local_option_CellularAutomaton_internal_59 +move $t1, $t0 +sw $t1, -240($fp) +sw $t0, -248($fp) +sw $t1, -240($fp) +j end__1098 +true__1098: +lw $t0, -440($fp) +# Saves in local_option_CellularAutomaton_internal_109 data_74 +la $t0, data_74 +lw $t1, -240($fp) +# Moving local_option_CellularAutomaton_internal_109 to local_option_CellularAutomaton_internal_59 +move $t1, $t0 +sw $t1, -240($fp) +sw $t0, -440($fp) +sw $t1, -240($fp) +end__1098: +lw $t0, -240($fp) +lw $t1, -232($fp) +# Moving local_option_CellularAutomaton_internal_59 to local_option_CellularAutomaton_internal_57 +move $t1, $t0 +sw $t1, -232($fp) +sw $t0, -240($fp) +sw $t1, -232($fp) +j end__1094 +true__1094: +lw $t0, -444($fp) +# Saves in local_option_CellularAutomaton_internal_110 data_75 +la $t0, data_75 +lw $t1, -232($fp) +# Moving local_option_CellularAutomaton_internal_110 to local_option_CellularAutomaton_internal_57 +move $t1, $t0 +sw $t1, -232($fp) +sw $t0, -444($fp) +sw $t1, -232($fp) +end__1094: +lw $t0, -232($fp) +lw $t1, -224($fp) +# Moving local_option_CellularAutomaton_internal_57 to local_option_CellularAutomaton_internal_55 +move $t1, $t0 +sw $t1, -224($fp) +sw $t0, -232($fp) +sw $t1, -224($fp) +j end__1090 +true__1090: +lw $t0, -448($fp) +# Saves in local_option_CellularAutomaton_internal_111 data_76 +la $t0, data_76 +lw $t1, -224($fp) +# Moving local_option_CellularAutomaton_internal_111 to local_option_CellularAutomaton_internal_55 +move $t1, $t0 +sw $t1, -224($fp) +sw $t0, -448($fp) +sw $t1, -224($fp) +end__1090: +lw $t0, -224($fp) +lw $t1, -216($fp) +# Moving local_option_CellularAutomaton_internal_55 to local_option_CellularAutomaton_internal_53 +move $t1, $t0 +sw $t1, -216($fp) +sw $t0, -224($fp) +sw $t1, -216($fp) +j end__1086 +true__1086: +lw $t0, -452($fp) +# Saves in local_option_CellularAutomaton_internal_112 data_77 +la $t0, data_77 +lw $t1, -216($fp) +# Moving local_option_CellularAutomaton_internal_112 to local_option_CellularAutomaton_internal_53 +move $t1, $t0 +sw $t1, -216($fp) +sw $t0, -452($fp) +sw $t1, -216($fp) +end__1086: +lw $t0, -216($fp) +lw $t1, -208($fp) +# Moving local_option_CellularAutomaton_internal_53 to local_option_CellularAutomaton_internal_51 +move $t1, $t0 +sw $t1, -208($fp) +sw $t0, -216($fp) +sw $t1, -208($fp) +j end__1082 +true__1082: +lw $t0, -456($fp) +# Saves in local_option_CellularAutomaton_internal_113 data_78 +la $t0, data_78 +lw $t1, -208($fp) +# Moving local_option_CellularAutomaton_internal_113 to local_option_CellularAutomaton_internal_51 +move $t1, $t0 +sw $t1, -208($fp) +sw $t0, -456($fp) +sw $t1, -208($fp) +end__1082: +lw $t0, -208($fp) +lw $t1, -460($fp) +# Moving local_option_CellularAutomaton_internal_51 to local_option_CellularAutomaton_internal_114 +move $t1, $t0 +sw $t1, -460($fp) +lw $t2, -464($fp) +# Moving local_option_CellularAutomaton_internal_114 to local_option_CellularAutomaton_internal_115 +move $t2, $t1 +sw $t2, -464($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -208($fp) +sw $t1, -460($fp) +sw $t2, -464($fp) +# Removing all locals from stack +addiu $sp, $sp, 468 +jr $ra + + +function_prompt_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_prompt_CellularAutomaton_ans_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt_CellularAutomaton_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Saves in local_prompt_CellularAutomaton_internal_1 data_79 +la $t0, data_79 +lw $t1, -4($fp) +# Moving local_prompt_CellularAutomaton_internal_1 to local_prompt_CellularAutomaton_ans_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -12($fp) +# Saves in local_prompt_CellularAutomaton_internal_2 data_80 +la $t2, data_80 +lw $t3, -0($fp) +lw $t4, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -0($fp) +sw $t4, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Saves in local_prompt_CellularAutomaton_internal_4 data_81 +la $t1, data_81 +lw $t2, -0($fp) +lw $t3, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -0($fp) +sw $t3, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_string_IO +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -0($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_prompt_CellularAutomaton_internal_6 to local_prompt_CellularAutomaton_ans_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -32($fp) +# Saves in local_prompt_CellularAutomaton_internal_7 data_82 +la $t2, data_82 +lw $t3, -0($fp) +lw $t4, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -4($fp) +sw $t2, -32($fp) +sw $t3, -0($fp) +sw $t4, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -44($fp) +# Saves in local_prompt_CellularAutomaton_internal_10 data_83 +la $t1, data_83 +lw $t2, -4($fp) +lw $t3, -40($fp) +# local_prompt_CellularAutomaton_internal_9 <- local_prompt_CellularAutomaton_ans_0 = local_prompt_CellularAutomaton_internal_10 +move $t8, $t2 +move $t9, $t1 +loop_20: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_20 +beqz $a1, mismatch_20 +seq $v0, $a0, $a1 +beqz $v0, mismatch_20 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_20 +mismatch_20: +li $v0, 0 +j end_20 +check_20: +bnez $a1, mismatch_20 +li $v0, 1 +end_20: +move $t3, $v0 +# If local_prompt_CellularAutomaton_internal_9 goto true__1377 +sw $t0, -36($fp) +sw $t1, -44($fp) +sw $t2, -4($fp) +sw $t3, -40($fp) +bnez $t3, true__1377 +lw $t0, -48($fp) +# Moving 1 to local_prompt_CellularAutomaton_internal_11 +li $t0, 1 +sw $t0, -48($fp) +sw $t0, -48($fp) +j end__1377 +true__1377: +lw $t0, -48($fp) +# Moving 0 to local_prompt_CellularAutomaton_internal_11 +li $t0, 0 +sw $t0, -48($fp) +sw $t0, -48($fp) +end__1377: +lw $t0, -48($fp) +lw $t1, -52($fp) +# Moving local_prompt_CellularAutomaton_internal_11 to local_prompt_CellularAutomaton_internal_12 +move $t1, $t0 +sw $t1, -52($fp) +lw $t2, -56($fp) +# Moving local_prompt_CellularAutomaton_internal_12 to local_prompt_CellularAutomaton_internal_13 +move $t2, $t1 +sw $t2, -56($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_prompt2_CellularAutomaton: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_prompt2_CellularAutomaton_ans_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_prompt2_CellularAutomaton_internal_12 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Saves in local_prompt2_CellularAutomaton_internal_1 data_84 +la $t0, data_84 +lw $t1, -4($fp) +# Moving local_prompt2_CellularAutomaton_internal_1 to local_prompt2_CellularAutomaton_ans_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -12($fp) +# Saves in local_prompt2_CellularAutomaton_internal_2 data_85 +la $t2, data_85 +lw $t3, -0($fp) +lw $t4, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -0($fp) +sw $t4, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Saves in local_prompt2_CellularAutomaton_internal_4 data_86 +la $t1, data_86 +lw $t2, -0($fp) +lw $t3, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -0($fp) +sw $t3, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# Saves in local_prompt2_CellularAutomaton_internal_6 data_87 +la $t1, data_87 +lw $t2, -0($fp) +lw $t3, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -28($fp) +sw $t2, -0($fp) +sw $t3, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_string_IO +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -0($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_prompt2_CellularAutomaton_internal_8 to local_prompt2_CellularAutomaton_ans_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -44($fp) +# Saves in local_prompt2_CellularAutomaton_internal_10 data_88 +la $t2, data_88 +lw $t3, -40($fp) +# local_prompt2_CellularAutomaton_internal_9 <- local_prompt2_CellularAutomaton_ans_0 = local_prompt2_CellularAutomaton_internal_10 +move $t8, $t1 +move $t9, $t2 +loop_21: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_21 +beqz $a1, mismatch_21 +seq $v0, $a0, $a1 +beqz $v0, mismatch_21 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_21 +mismatch_21: +li $v0, 0 +j end_21 +check_21: +bnez $a1, mismatch_21 +li $v0, 1 +end_21: +move $t3, $v0 +# If local_prompt2_CellularAutomaton_internal_9 goto true__1426 +sw $t0, -36($fp) +sw $t1, -4($fp) +sw $t2, -44($fp) +sw $t3, -40($fp) +bnez $t3, true__1426 +lw $t0, -48($fp) +# Moving 0 to local_prompt2_CellularAutomaton_internal_11 +li $t0, 0 +sw $t0, -48($fp) +sw $t0, -48($fp) +j end__1426 +true__1426: +lw $t0, -48($fp) +# Moving 1 to local_prompt2_CellularAutomaton_internal_11 +li $t0, 1 +sw $t0, -48($fp) +sw $t0, -48($fp) +end__1426: +lw $t0, -48($fp) +lw $t1, -52($fp) +# Moving local_prompt2_CellularAutomaton_internal_11 to local_prompt2_CellularAutomaton_internal_12 +move $t1, $t0 +sw $t1, -52($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +# Removing all locals from stack +addiu $sp, $sp, 56 +jr $ra + + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_cells_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . rows <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +# self . columns <- SET 0 +li $t9, 0 +sw $t9, 16($t0) +# self . board_size <- SET 0 +li $t9, 0 +sw $t9, 20($t0) +lw $t1, -4($fp) +# Saves in local_Main_Main_internal_0 data_89 +la $t1, data_89 +# self . population_map <- SET local_Main_Main_internal_0 +sw $t1, 24($t0) +lw $t2, -8($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t2, $v0 +# self . cells <- SET local_Main_Main_cells_1 +sw $t2, 28($t0) +lw $t3, -12($fp) +# Moving self to local_Main_Main_internal_2 +move $t3, $t0 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_continue_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_choice_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_cells_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_cells_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_cells_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_32 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_main_Main_continue_0 +li $t0, 0 +sw $t0, -4($fp) +lw $t1, -12($fp) +# Saves in local_main_Main_internal_2 data_90 +la $t1, data_90 +lw $t2, -8($fp) +# Moving local_main_Main_internal_2 to local_main_Main_choice_1 +move $t2, $t1 +sw $t2, -8($fp) +lw $t3, -16($fp) +# Saves in local_main_Main_internal_3 data_91 +la $t3, data_91 +lw $t4, -0($fp) +lw $t5, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -16($fp) +sw $t4, -0($fp) +sw $t5, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Saves in local_main_Main_internal_5 data_92 +la $t1, data_92 +lw $t2, -0($fp) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +sw $t2, -0($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t1, $v0 +sw $t0, -28($fp) +sw $t1, -32($fp) +start__1474: +lw $t0, -0($fp) +lw $t1, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_prompt2_CellularAutomaton +lw $t8, 112($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +# If not local_main_Main_internal_8 goto end__1474 +sw $t0, -36($fp) +beqz $t0, end__1474 +lw $t0, -4($fp) +# Moving 1 to local_main_Main_continue_0 +li $t0, 1 +sw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_option_CellularAutomaton +lw $t8, 104($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_main_Main_internal_9 to local_main_Main_choice_1 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -44($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 28 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_CellularAutomaton +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 28 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t2) +# Static Dispatch of the method CellularAutomaton +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -40($fp) +sw $t1, -8($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal function_CellularAutomaton_CellularAutomaton +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# local_main_Main_internal_12 <- Type of local_main_Main_internal_10 +lw $t1, 0($t0) +lw $t2, -56($fp) +# Saves in local_main_Main_internal_13 data_0 +la $t2, data_0 +# local_main_Main_internal_12 <- local_main_Main_internal_12 = local_main_Main_internal_13 +move $t8, $t1 +move $t9, $t2 +loop_22: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_22 +beqz $a1, mismatch_22 +seq $v0, $a0, $a1 +beqz $v0, mismatch_22 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_22 +mismatch_22: +li $v0, 0 +j end_22 +check_22: +bnez $a1, mismatch_22 +li $v0, 1 +end_22: +move $t1, $v0 +# If not local_main_Main_internal_12 goto continue__1492 +sw $t0, -44($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +beqz $t1, continue__1492 +la $a0, dispatch_error +j .raise +continue__1492: +lw $t0, -44($fp) +lw $t1, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_CellularAutomaton +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -8($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . cells <- SET local_main_Main_internal_11 +sw $t0, 28($t1) +lw $t2, -60($fp) +# local_main_Main_cells_14 <- GET self . cells +lw $t2, 28($t1) +lw $t3, -68($fp) +# local_main_Main_internal_16 <- Type of local_main_Main_cells_14 +lw $t3, 0($t2) +lw $t4, -72($fp) +# Saves in local_main_Main_internal_17 data_0 +la $t4, data_0 +# local_main_Main_internal_16 <- local_main_Main_internal_16 = local_main_Main_internal_17 +move $t8, $t3 +move $t9, $t4 +loop_23: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_23 +beqz $a1, mismatch_23 +seq $v0, $a0, $a1 +beqz $v0, mismatch_23 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_23 +mismatch_23: +li $v0, 0 +j end_23 +check_23: +bnez $a1, mismatch_23 +li $v0, 1 +end_23: +move $t3, $v0 +# If not local_main_Main_internal_16 goto continue__1507 +sw $t0, -48($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +sw $t3, -68($fp) +sw $t4, -72($fp) +beqz $t3, continue__1507 +la $a0, dispatch_error +j .raise +continue__1507: +lw $t0, -60($fp) +lw $t1, -64($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_CellularAutomaton +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -60($fp) +sw $t1, -64($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -64($fp) +# saves the return value +move $t0, $v0 +lw $t1, -76($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t1, $v0 +sw $t0, -64($fp) +sw $t1, -76($fp) +start__1517: +lw $t0, -4($fp) +# If not local_main_Main_continue_0 goto end__1517 +sw $t0, -4($fp) +beqz $t0, end__1517 +lw $t0, -0($fp) +lw $t1, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_prompt_CellularAutomaton +lw $t8, 108($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +# If local_main_Main_internal_19 goto true__1524 +sw $t0, -80($fp) +bnez $t0, true__1524 +lw $t0, -4($fp) +# Moving 0 to local_main_Main_continue_0 +li $t0, 0 +sw $t0, -4($fp) +lw $t1, -84($fp) +# Moving 0 to local_main_Main_internal_20 +li $t1, 0 +sw $t1, -84($fp) +sw $t0, -4($fp) +sw $t1, -84($fp) +j end__1524 +true__1524: +lw $t0, -0($fp) +lw $t1, -88($fp) +# local_main_Main_cells_21 <- GET self . cells +lw $t1, 28($t0) +lw $t2, -96($fp) +# local_main_Main_internal_23 <- Type of local_main_Main_cells_21 +lw $t2, 0($t1) +lw $t3, -100($fp) +# Saves in local_main_Main_internal_24 data_0 +la $t3, data_0 +# local_main_Main_internal_23 <- local_main_Main_internal_23 = local_main_Main_internal_24 +move $t8, $t2 +move $t9, $t3 +loop_24: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_24 +beqz $a1, mismatch_24 +seq $v0, $a0, $a1 +beqz $v0, mismatch_24 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_24 +mismatch_24: +li $v0, 0 +j end_24 +check_24: +bnez $a1, mismatch_24 +li $v0, 1 +end_24: +move $t2, $v0 +# If not local_main_Main_internal_23 goto continue__1534 +sw $t0, -0($fp) +sw $t1, -88($fp) +sw $t2, -96($fp) +sw $t3, -100($fp) +beqz $t2, continue__1534 +la $a0, dispatch_error +j .raise +continue__1534: +lw $t0, -88($fp) +lw $t1, -92($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_evolve_CellularAutomaton +lw $t8, 100($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -104($fp) +# local_main_Main_cells_25 <- GET self . cells +lw $t2, 28($t1) +lw $t3, -112($fp) +# local_main_Main_internal_27 <- Type of local_main_Main_cells_25 +lw $t3, 0($t2) +lw $t4, -116($fp) +# Saves in local_main_Main_internal_28 data_0 +la $t4, data_0 +# local_main_Main_internal_27 <- local_main_Main_internal_27 = local_main_Main_internal_28 +move $t8, $t3 +move $t9, $t4 +loop_25: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_25 +beqz $a1, mismatch_25 +seq $v0, $a0, $a1 +beqz $v0, mismatch_25 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_25 +mismatch_25: +li $v0, 0 +j end_25 +check_25: +bnez $a1, mismatch_25 +li $v0, 1 +end_25: +move $t3, $v0 +# If not local_main_Main_internal_27 goto continue__1548 +sw $t0, -92($fp) +sw $t1, -0($fp) +sw $t2, -104($fp) +sw $t3, -112($fp) +sw $t4, -116($fp) +beqz $t3, continue__1548 +la $a0, dispatch_error +j .raise +continue__1548: +lw $t0, -104($fp) +lw $t1, -108($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_CellularAutomaton +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -104($fp) +sw $t1, -108($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +lw $t1, -120($fp) +# Moving local_main_Main_internal_26 to local_main_Main_internal_29 +move $t1, $t0 +sw $t1, -120($fp) +lw $t2, -84($fp) +# Moving local_main_Main_internal_29 to local_main_Main_internal_20 +move $t2, $t1 +sw $t2, -84($fp) +sw $t0, -108($fp) +sw $t1, -120($fp) +sw $t2, -84($fp) +end__1524: +lw $t0, -84($fp) +lw $t1, -76($fp) +# Moving local_main_Main_internal_20 to local_main_Main_internal_18 +move $t1, $t0 +sw $t1, -76($fp) +sw $t0, -84($fp) +sw $t1, -76($fp) +j start__1517 +end__1517: +lw $t0, -76($fp) +lw $t1, -124($fp) +# Moving local_main_Main_internal_18 to local_main_Main_internal_30 +move $t1, $t0 +sw $t1, -124($fp) +lw $t2, -32($fp) +# Moving local_main_Main_internal_30 to local_main_Main_internal_7 +move $t2, $t1 +sw $t2, -32($fp) +sw $t0, -76($fp) +sw $t1, -124($fp) +sw $t2, -32($fp) +j start__1474 +end__1474: +lw $t0, -0($fp) +lw $t1, -128($fp) +# Moving self to local_main_Main_internal_31 +move $t1, $t0 +sw $t1, -128($fp) +lw $t2, -132($fp) +# Moving local_main_Main_internal_31 to local_main_Main_internal_32 +move $t2, $t1 +sw $t2, -132($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -128($fp) +sw $t2, -132($fp) +# Removing all locals from stack +addiu $sp, $sp, 136 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Board: .asciiz "Board" +type_CellularAutomaton: .asciiz "CellularAutomaton" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "" +data_2: .asciiz " +" +data_3: .asciiz " +" +data_4: .asciiz " +" +data_5: .asciiz " " +data_6: .asciiz " " +data_7: .asciiz " " +data_8: .asciiz " " +data_9: .asciiz " " +data_10: .asciiz " " +data_11: .asciiz " " +data_12: .asciiz " " +data_13: .asciiz " " +data_14: .asciiz " " +data_15: .asciiz " " +data_16: .asciiz " " +data_17: .asciiz " " +data_18: .asciiz " " +data_19: .asciiz "X" +data_20: .asciiz "X" +data_21: .asciiz "X" +data_22: .asciiz "X" +data_23: .asciiz "X" +data_24: .asciiz "X" +data_25: .asciiz "X" +data_26: .asciiz "X" +data_27: .asciiz "-" +data_28: .asciiz "X" +data_29: .asciiz "-" +data_30: .asciiz "X" +data_31: .asciiz "X" +data_32: .asciiz "" +data_33: .asciiz " +Please chose a number: +" +data_34: .asciiz " 1: A cross +" +data_35: .asciiz " 2: A slash from the upper left to lower right +" +data_36: .asciiz " 3: A slash from the upper right to lower left +" +data_37: .asciiz " 4: An X +" +data_38: .asciiz " 5: A greater than sign +" +data_39: .asciiz " 6: A less than sign +" +data_40: .asciiz " 7: Two greater than signs +" +data_41: .asciiz " 8: Two less than signs +" +data_42: .asciiz " 9: A 'V' +" +data_43: .asciiz " 10: An inverse 'V' +" +data_44: .asciiz " 11: Numbers 9 and 10 combined +" +data_45: .asciiz " 12: A full grid +" +data_46: .asciiz " 13: A 'T' +" +data_47: .asciiz " 14: A plus '+' +" +data_48: .asciiz " 15: A 'W' +" +data_49: .asciiz " 16: An 'M' +" +data_50: .asciiz " 17: An 'E' +" +data_51: .asciiz " 18: A '3' +" +data_52: .asciiz " 19: An 'O' +" +data_53: .asciiz " 20: An '8' +" +data_54: .asciiz " 21: An 'S' +" +data_55: .asciiz "Your choice => " +data_56: .asciiz " +" +data_57: .asciiz " " +data_58: .asciiz " XXXX X XX X XXXX " +data_59: .asciiz " XX X XX X XX X XX X XX " +data_60: .asciiz " XX X XX X XX " +data_61: .asciiz "XXX X X X X XXXX " +data_62: .asciiz "XXXXX X XXXXX X XXXX" +data_63: .asciiz " X X X X X X X" +data_64: .asciiz "X X X X X X X " +data_65: .asciiz " X X XXXXX X X " +data_66: .asciiz "XXXXX X X X X " +data_67: .asciiz "XXXXXXXXXXXXXXXXXXXXXXXXX" +data_68: .asciiz "X X X X X X X X" +data_69: .asciiz " X X X X X" +data_70: .asciiz "X X X X X " +data_71: .asciiz " X XX X X X " +data_72: .asciiz "X X X XX X " +data_73: .asciiz " X X X X X" +data_74: .asciiz "X X X X X " +data_75: .asciiz "X X X X X X X X X" +data_76: .asciiz "X X X X X" +data_77: .asciiz " X X X X X " +data_78: .asciiz " XX XXXX XXXX XX " +data_79: .asciiz "" +data_80: .asciiz "Would you like to continue with the next generation? +" +data_81: .asciiz "Please use lowercase y or n for your answer [y]: " +data_82: .asciiz " +" +data_83: .asciiz "n" +data_84: .asciiz "" +data_85: .asciiz " + +" +data_86: .asciiz "Would you like to choose a background pattern? +" +data_87: .asciiz "Please use lowercase y or n for your answer [n]: " +data_88: .asciiz "y" +data_89: .asciiz "" +data_90: .asciiz "" +data_91: .asciiz "Welcome to the Game of Life. +" +data_92: .asciiz "There are many initial states to choose from. +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/list.mips b/tests/codegen/list.mips new file mode 100644 index 00000000..7aa79f63 --- /dev/null +++ b/tests/codegen/list.mips @@ -0,0 +1,2652 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_isNil_List +sw $t9, 80($v0) +la $t9, function_head_List +sw $t9, 84($v0) +la $t9, function_tail_List +sw $t9, 88($v0) +la $t9, function_cons_List +sw $t9, 92($v0) +la $t9, function_Cons_Cons +sw $t9, 96($v0) +la $t9, function_isNil_Cons +sw $t9, 100($v0) +la $t9, function_head_Cons +sw $t9, 104($v0) +la $t9, function_tail_Cons +sw $t9, 108($v0) +la $t9, function_init_Cons +sw $t9, 112($v0) +la $t9, function_Main_Main +sw $t9, 116($v0) +la $t9, function_print_list_Main +sw $t9, 120($v0) +la $t9, function_main_Main +sw $t9, 124($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_List +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_isNil_List in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_head_List in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_tail_List in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_cons_List in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Cons +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_isNil_Cons in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_head_Cons in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_tail_Cons in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_cons_List in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_init_Cons in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Cons_Cons in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_print_list_Main in a0 +lw $a0, 120($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 124($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_isNil_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_List_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 1 to local_isNil_List_internal_0 +li $t0, 1 +sw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_head_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_head_List_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_head_List_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving 0 to local_head_List_internal_1 +li $t1, 0 +sw $t1, -8($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_tail_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_tail_List_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_tail_List_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Moving self to local_tail_List_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_cons_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cons_List_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_List_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_List_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_List_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# local_cons_List_internal_2 <- Type of local_cons_List_internal_0 +lw $t1, 0($t0) +lw $t2, -20($fp) +# Saves in local_cons_List_internal_3 data_0 +la $t2, data_0 +# local_cons_List_internal_2 <- local_cons_List_internal_2 = local_cons_List_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_cons_List_internal_2 goto continue__78 +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +beqz $t1, continue__78 +la $a0, dispatch_error +j .raise +continue__78: +lw $t0, -8($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -0($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -4($fp) +sw $t3, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_Cons_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Cons_Cons_cdr_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Cons_Cons_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . car <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t1, $v0 +# self . cdr <- SET local_Cons_Cons_cdr_0 +sw $t1, 16($t0) +lw $t2, -8($fp) +# Moving self to local_Cons_Cons_internal_1 +move $t2, $t0 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_isNil_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_isNil_Cons_internal_0 +li $t0, 0 +sw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_head_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_head_Cons_car_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_head_Cons_car_0 <- GET self . car +lw $t1, 12($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_tail_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_tail_Cons_cdr_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_tail_Cons_cdr_0 <- GET self . cdr +lw $t1, 16($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_init_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Pops the register with the param value rest +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_init_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# self . car <- SET i +sw $t0, 12($t1) +lw $t2, -0($fp) +# self . cdr <- SET rest +sw $t2, 16($t1) +lw $t3, -12($fp) +# Moving self to local_init_Cons_internal_0 +move $t3, $t1 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_mylist_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t0, $v0 +lw $t1, -0($fp) +# self . mylist <- SET local_Main_Main_mylist_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_Main_Main_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_print_list_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value l +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_list_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Main_internal_16 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -12($fp) +# local_print_list_Main_internal_1 <- Type of l +lw $t1, 0($t0) +lw $t2, -16($fp) +# Saves in local_print_list_Main_internal_2 data_0 +la $t2, data_0 +# local_print_list_Main_internal_1 <- local_print_list_Main_internal_1 = local_print_list_Main_internal_2 +move $t8, $t1 +move $t9, $t2 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t1, $v0 +# If not local_print_list_Main_internal_1 goto continue__135 +sw $t0, -0($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +beqz $t1, continue__135 +la $a0, dispatch_error +j .raise +continue__135: +lw $t0, -0($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_isNil_List +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +# If local_print_list_Main_internal_0 goto true__145 +sw $t0, -8($fp) +bnez $t0, true__145 +lw $t0, -0($fp) +lw $t1, -28($fp) +# local_print_list_Main_internal_5 <- Type of l +lw $t1, 0($t0) +lw $t2, -32($fp) +# Saves in local_print_list_Main_internal_6 data_0 +la $t2, data_0 +# local_print_list_Main_internal_5 <- local_print_list_Main_internal_5 = local_print_list_Main_internal_6 +move $t8, $t1 +move $t9, $t2 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t1, $v0 +# If not local_print_list_Main_internal_5 goto continue__150 +sw $t0, -0($fp) +sw $t1, -28($fp) +sw $t2, -32($fp) +beqz $t1, continue__150 +la $a0, dispatch_error +j .raise +continue__150: +lw $t0, -0($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_head_List +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -4($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Saves in local_print_list_Main_internal_8 data_1 +la $t1, data_1 +lw $t2, -4($fp) +lw $t3, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -4($fp) +sw $t3, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -52($fp) +# local_print_list_Main_internal_11 <- Type of l +lw $t2, 0($t1) +lw $t3, -56($fp) +# Saves in local_print_list_Main_internal_12 data_0 +la $t3, data_0 +# local_print_list_Main_internal_11 <- local_print_list_Main_internal_11 = local_print_list_Main_internal_12 +move $t8, $t2 +move $t9, $t3 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If not local_print_list_Main_internal_11 goto continue__173 +sw $t0, -44($fp) +sw $t1, -0($fp) +sw $t2, -52($fp) +sw $t3, -56($fp) +beqz $t2, continue__173 +la $a0, dispatch_error +j .raise +continue__173: +lw $t0, -0($fp) +lw $t1, -48($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_tail_List +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -48($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_list_Main +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# Moving local_print_list_Main_internal_13 to local_print_list_Main_internal_14 +move $t1, $t0 +sw $t1, -64($fp) +lw $t2, -20($fp) +# Moving local_print_list_Main_internal_14 to local_print_list_Main_internal_3 +move $t2, $t1 +sw $t2, -20($fp) +sw $t0, -60($fp) +sw $t1, -64($fp) +sw $t2, -20($fp) +j end__145 +true__145: +lw $t0, -68($fp) +# Saves in local_print_list_Main_internal_15 data_2 +la $t0, data_2 +lw $t1, -4($fp) +lw $t2, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -4($fp) +sw $t2, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# Moving local_print_list_Main_internal_16 to local_print_list_Main_internal_3 +move $t1, $t0 +sw $t1, -20($fp) +sw $t0, -72($fp) +sw $t1, -20($fp) +end__145: +lw $t0, -20($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 76 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_mylist_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_mylist_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_mylist_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_29 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_List +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +lw $t1, -12($fp) +# local_main_Main_internal_2 <- Type of local_main_Main_internal_0 +lw $t1, 0($t0) +lw $t2, -16($fp) +# Saves in local_main_Main_internal_3 data_0 +la $t2, data_0 +# local_main_Main_internal_2 <- local_main_Main_internal_2 = local_main_Main_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t1, $v0 +# If not local_main_Main_internal_2 goto continue__208 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +beqz $t1, continue__208 +la $a0, dispatch_error +j .raise +continue__208: +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cons_List +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_main_Main_internal_5 <- Type of local_main_Main_internal_1 +lw $t1, 0($t0) +lw $t2, -28($fp) +# Saves in local_main_Main_internal_6 data_0 +la $t2, data_0 +# local_main_Main_internal_5 <- local_main_Main_internal_5 = local_main_Main_internal_6 +move $t8, $t1 +move $t9, $t2 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t1, $v0 +# If not local_main_Main_internal_5 goto continue__221 +sw $t0, -8($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +beqz $t1, continue__221 +la $a0, dispatch_error +j .raise +continue__221: +lw $t0, -8($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cons_List +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 2 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# local_main_Main_internal_8 <- Type of local_main_Main_internal_4 +lw $t1, 0($t0) +lw $t2, -40($fp) +# Saves in local_main_Main_internal_9 data_0 +la $t2, data_0 +# local_main_Main_internal_8 <- local_main_Main_internal_8 = local_main_Main_internal_9 +move $t8, $t1 +move $t9, $t2 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t1, $v0 +# If not local_main_Main_internal_8 goto continue__234 +sw $t0, -20($fp) +sw $t1, -36($fp) +sw $t2, -40($fp) +beqz $t1, continue__234 +la $a0, dispatch_error +j .raise +continue__234: +lw $t0, -20($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cons_List +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 3 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# local_main_Main_internal_11 <- Type of local_main_Main_internal_7 +lw $t1, 0($t0) +lw $t2, -52($fp) +# Saves in local_main_Main_internal_12 data_0 +la $t2, data_0 +# local_main_Main_internal_11 <- local_main_Main_internal_11 = local_main_Main_internal_12 +move $t8, $t1 +move $t9, $t2 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t1, $v0 +# If not local_main_Main_internal_11 goto continue__247 +sw $t0, -32($fp) +sw $t1, -48($fp) +sw $t2, -52($fp) +beqz $t1, continue__247 +la $a0, dispatch_error +j .raise +continue__247: +lw $t0, -32($fp) +lw $t1, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cons_List +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 4 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -60($fp) +# local_main_Main_internal_14 <- Type of local_main_Main_internal_10 +lw $t1, 0($t0) +lw $t2, -64($fp) +# Saves in local_main_Main_internal_15 data_0 +la $t2, data_0 +# local_main_Main_internal_14 <- local_main_Main_internal_14 = local_main_Main_internal_15 +move $t8, $t1 +move $t9, $t2 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t1, $v0 +# If not local_main_Main_internal_14 goto continue__260 +sw $t0, -44($fp) +sw $t1, -60($fp) +sw $t2, -64($fp) +beqz $t1, continue__260 +la $a0, dispatch_error +j .raise +continue__260: +lw $t0, -44($fp) +lw $t1, -56($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cons_List +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 5 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . mylist <- SET local_main_Main_internal_13 +sw $t0, 12($t1) +lw $t2, -68($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t2, $v0 +sw $t0, -56($fp) +sw $t1, -0($fp) +sw $t2, -68($fp) +start__271: +lw $t0, -0($fp) +lw $t1, -76($fp) +# local_main_Main_mylist_18 <- GET self . mylist +lw $t1, 12($t0) +lw $t2, -84($fp) +# local_main_Main_internal_20 <- Type of local_main_Main_mylist_18 +lw $t2, 0($t1) +lw $t3, -88($fp) +# Saves in local_main_Main_internal_21 data_0 +la $t3, data_0 +# local_main_Main_internal_20 <- local_main_Main_internal_20 = local_main_Main_internal_21 +move $t8, $t2 +move $t9, $t3 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t2, $v0 +# If not local_main_Main_internal_20 goto continue__279 +sw $t0, -0($fp) +sw $t1, -76($fp) +sw $t2, -84($fp) +sw $t3, -88($fp) +beqz $t2, continue__279 +la $a0, dispatch_error +j .raise +continue__279: +lw $t0, -76($fp) +lw $t1, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_isNil_List +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# local_main_Main_internal_17 <- not local_main_Main_internal_19 +beqz $t0, false_16 +li $t1, 0 +j end_16 +false_16: +li $t1, 1 +end_16: +# If not local_main_Main_internal_17 goto end__271 +sw $t0, -80($fp) +sw $t1, -72($fp) +beqz $t1, end__271 +lw $t0, -0($fp) +lw $t1, -92($fp) +# local_main_Main_mylist_22 <- GET self . mylist +lw $t1, 12($t0) +lw $t2, -96($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_list_Main +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -92($fp) +sw $t2, -96($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -100($fp) +# local_main_Main_mylist_24 <- GET self . mylist +lw $t2, 12($t1) +lw $t3, -108($fp) +# local_main_Main_internal_26 <- Type of local_main_Main_mylist_24 +lw $t3, 0($t2) +lw $t4, -112($fp) +# Saves in local_main_Main_internal_27 data_0 +la $t4, data_0 +# local_main_Main_internal_26 <- local_main_Main_internal_26 = local_main_Main_internal_27 +move $t8, $t3 +move $t9, $t4 +loop_17: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_17 +beqz $a1, mismatch_17 +seq $v0, $a0, $a1 +beqz $v0, mismatch_17 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_17 +mismatch_17: +li $v0, 0 +j end_17 +check_17: +bnez $a1, mismatch_17 +li $v0, 1 +end_17: +move $t3, $v0 +# If not local_main_Main_internal_26 goto continue__301 +sw $t0, -96($fp) +sw $t1, -0($fp) +sw $t2, -100($fp) +sw $t3, -108($fp) +sw $t4, -112($fp) +beqz $t3, continue__301 +la $a0, dispatch_error +j .raise +continue__301: +lw $t0, -100($fp) +lw $t1, -104($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_tail_List +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -100($fp) +sw $t1, -104($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -104($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . mylist <- SET local_main_Main_internal_25 +sw $t0, 12($t1) +lw $t2, -116($fp) +# Moving local_main_Main_internal_25 to local_main_Main_internal_28 +move $t2, $t0 +sw $t2, -116($fp) +lw $t3, -68($fp) +# Moving local_main_Main_internal_28 to local_main_Main_internal_16 +move $t3, $t2 +sw $t3, -68($fp) +sw $t0, -104($fp) +sw $t1, -0($fp) +sw $t2, -116($fp) +sw $t3, -68($fp) +j start__271 +end__271: +lw $t0, -68($fp) +lw $t1, -120($fp) +# Moving local_main_Main_internal_16 to local_main_Main_internal_29 +move $t1, $t0 +sw $t1, -120($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -120($fp) +# Removing all locals from stack +addiu $sp, $sp, 124 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_List: .asciiz "List" +type_Cons: .asciiz "Cons" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz " " +data_2: .asciiz " +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/new_complex.cl b/tests/codegen/new_complex.cl old mode 100755 new mode 100644 index a4fe714c..ad7035b5 --- a/tests/codegen/new_complex.cl +++ b/tests/codegen/new_complex.cl @@ -1,79 +1,79 @@ -class Main inherits IO { - main() : IO { - (let c : Complex <- (new Complex).init(1, 1) in - { - -- trivially equal (see CoolAid) - if c.reflect_X() = c.reflect_0() - then out_string("=)\n") - else out_string("=(\n") - fi; - -- equal - if c.reflect_X().reflect_Y().equal(c.reflect_0()) - then out_string("=)\n") - else out_string("=(\n") - fi; - } - ) - }; -}; - -class Complex inherits IO { - x : Int; - y : Int; - - init(a : Int, b : Int) : Complex { - { - x = a; - y = b; - self; - } - }; - - print() : Object { - if y = 0 - then out_int(x) - else out_int(x).out_string("+").out_int(y).out_string("I") - fi - }; - - reflect_0() : Complex { - { - x = ~x; - y = ~y; - self; - } - }; - - reflect_X() : Complex { - { - y = ~y; - self; - } - }; - - reflect_Y() : Complex { - { - x = ~x; - self; - } - }; - - equal(d : Complex) : Bool { - if x = d.x_value() - then - if y = d.y_value() - then true - else false - fi - else false - fi - }; - - x_value() : Int { - x - }; - - y_value() : Int { - y - }; -}; +class Main inherits IO { + main() : IO { + (let c : Complex <- (new Complex).init(1, 1) in + { + -- trivially equal (see CoolAid) + if c.reflect_X() = c.reflect_0() + then out_string("=)\n") + else out_string("=(\n") + fi; + -- equal + if c.reflect_X().reflect_Y().equal(c.reflect_0()) + then out_string("=)\n") + else out_string("=(\n") + fi; + } + ) + }; +}; + +class Complex inherits IO { + x : Int; + y : Int; + + init(a : Int, b : Int) : Complex { + { + x = a; + y = b; + self; + } + }; + + print() : Object { + if y = 0 + then out_int(x) + else out_int(x).out_string("+").out_int(y).out_string("I") + fi + }; + + reflect_0() : Complex { + { + x = ~x; + y = ~y; + self; + } + }; + + reflect_X() : Complex { + { + y = ~y; + self; + } + }; + + reflect_Y() : Complex { + { + x = ~x; + self; + } + }; + + equal(d : Complex) : Bool { + if x = d.x_value() + then + if y = d.y_value() + then true + else false + fi + else false + fi + }; + + x_value() : Int { + x + }; + + y_value() : Int { + y + }; +}; diff --git a/tests/codegen/new_complex.mips b/tests/codegen/new_complex.mips new file mode 100644 index 00000000..0ea290fc --- /dev/null +++ b/tests/codegen/new_complex.mips @@ -0,0 +1,2785 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_main_Main +sw $t9, 80($v0) +la $t9, function_Complex_Complex +sw $t9, 84($v0) +la $t9, function_init_Complex +sw $t9, 88($v0) +la $t9, function_print_Complex +sw $t9, 92($v0) +la $t9, function_reflect_0_Complex +sw $t9, 96($v0) +la $t9, function_reflect_X_Complex +sw $t9, 100($v0) +la $t9, function_reflect_Y_Complex +sw $t9, 104($v0) +la $t9, function_equal_Complex +sw $t9, 108($v0) +la $t9, function_x_value_Complex +sw $t9, 112($v0) +la $t9, function_y_value_Complex +sw $t9, 116($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 36 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Complex +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 68 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_init_Complex in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_print_Complex in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_reflect_0_Complex in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_reflect_X_Complex in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_reflect_Y_Complex in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_equal_Complex in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_x_value_Complex in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_y_value_Complex in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_Complex_Complex in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_c_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_34 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Complex +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Complex +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# This function will consume the arguments +jal function_Complex_Complex +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# local_main_Main_internal_3 <- Type of local_main_Main_internal_1 +lw $t1, 0($t0) +lw $t2, -20($fp) +# Saves in local_main_Main_internal_4 data_0 +la $t2, data_0 +# local_main_Main_internal_3 <- local_main_Main_internal_3 = local_main_Main_internal_4 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_main_Main_internal_3 goto continue__56 +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +beqz $t1, continue__56 +la $a0, dispatch_error +j .raise +continue__56: +lw $t0, -8($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Complex +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# Moving local_main_Main_internal_2 to local_main_Main_c_0 +move $t1, $t0 +sw $t1, -4($fp) +lw $t2, -32($fp) +# local_main_Main_internal_7 <- Type of local_main_Main_c_0 +lw $t2, 0($t1) +lw $t3, -36($fp) +# Saves in local_main_Main_internal_8 data_0 +la $t3, data_0 +# local_main_Main_internal_7 <- local_main_Main_internal_7 = local_main_Main_internal_8 +move $t8, $t2 +move $t9, $t3 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t2, $v0 +# If not local_main_Main_internal_7 goto continue__70 +sw $t0, -12($fp) +sw $t1, -4($fp) +sw $t2, -32($fp) +sw $t3, -36($fp) +beqz $t2, continue__70 +la $a0, dispatch_error +j .raise +continue__70: +lw $t0, -4($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_X_Complex +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -44($fp) +# local_main_Main_internal_10 <- Type of local_main_Main_c_0 +lw $t2, 0($t1) +lw $t3, -48($fp) +# Saves in local_main_Main_internal_11 data_0 +la $t3, data_0 +# local_main_Main_internal_10 <- local_main_Main_internal_10 = local_main_Main_internal_11 +move $t8, $t2 +move $t9, $t3 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t2, $v0 +# If not local_main_Main_internal_10 goto continue__82 +sw $t0, -28($fp) +sw $t1, -4($fp) +sw $t2, -44($fp) +sw $t3, -48($fp) +beqz $t2, continue__82 +la $a0, dispatch_error +j .raise +continue__82: +lw $t0, -4($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_0_Complex +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +lw $t2, -24($fp) +# local_main_Main_internal_5 <- local_main_Main_internal_6 = local_main_Main_internal_9 +seq $t2, $t1, $t0 +# If local_main_Main_internal_5 goto true__93 +sw $t0, -40($fp) +sw $t1, -28($fp) +sw $t2, -24($fp) +bnez $t2, true__93 +lw $t0, -56($fp) +# Saves in local_main_Main_internal_13 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -0($fp) +sw $t2, -60($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Moving local_main_Main_internal_14 to local_main_Main_internal_12 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -60($fp) +sw $t1, -52($fp) +j end__93 +true__93: +lw $t0, -64($fp) +# Saves in local_main_Main_internal_15 data_2 +la $t0, data_2 +lw $t1, -0($fp) +lw $t2, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -64($fp) +sw $t1, -0($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Moving local_main_Main_internal_16 to local_main_Main_internal_12 +move $t1, $t0 +sw $t1, -52($fp) +sw $t0, -68($fp) +sw $t1, -52($fp) +end__93: +lw $t0, -4($fp) +lw $t1, -76($fp) +# local_main_Main_internal_18 <- Type of local_main_Main_c_0 +lw $t1, 0($t0) +lw $t2, -80($fp) +# Saves in local_main_Main_internal_19 data_0 +la $t2, data_0 +# local_main_Main_internal_18 <- local_main_Main_internal_18 = local_main_Main_internal_19 +move $t8, $t1 +move $t9, $t2 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t1, $v0 +# If not local_main_Main_internal_18 goto continue__116 +sw $t0, -4($fp) +sw $t1, -76($fp) +sw $t2, -80($fp) +beqz $t1, continue__116 +la $a0, dispatch_error +j .raise +continue__116: +lw $t0, -4($fp) +lw $t1, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_X_Complex +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# local_main_Main_internal_21 <- Type of local_main_Main_internal_17 +lw $t1, 0($t0) +lw $t2, -92($fp) +# Saves in local_main_Main_internal_22 data_0 +la $t2, data_0 +# local_main_Main_internal_21 <- local_main_Main_internal_21 = local_main_Main_internal_22 +move $t8, $t1 +move $t9, $t2 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t1, $v0 +# If not local_main_Main_internal_21 goto continue__128 +sw $t0, -72($fp) +sw $t1, -88($fp) +sw $t2, -92($fp) +beqz $t1, continue__128 +la $a0, dispatch_error +j .raise +continue__128: +lw $t0, -72($fp) +lw $t1, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_Y_Complex +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -72($fp) +sw $t1, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -100($fp) +# local_main_Main_internal_24 <- Type of local_main_Main_c_0 +lw $t2, 0($t1) +lw $t3, -104($fp) +# Saves in local_main_Main_internal_25 data_0 +la $t3, data_0 +# local_main_Main_internal_24 <- local_main_Main_internal_24 = local_main_Main_internal_25 +move $t8, $t2 +move $t9, $t3 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t2, $v0 +# If not local_main_Main_internal_24 goto continue__141 +sw $t0, -84($fp) +sw $t1, -4($fp) +sw $t2, -100($fp) +sw $t3, -104($fp) +beqz $t2, continue__141 +la $a0, dispatch_error +j .raise +continue__141: +lw $t0, -4($fp) +lw $t1, -96($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_reflect_0_Complex +lw $t8, 40($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -96($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -84($fp) +lw $t2, -112($fp) +# local_main_Main_internal_27 <- Type of local_main_Main_internal_20 +lw $t2, 0($t1) +lw $t3, -116($fp) +# Saves in local_main_Main_internal_28 data_0 +la $t3, data_0 +# local_main_Main_internal_27 <- local_main_Main_internal_27 = local_main_Main_internal_28 +move $t8, $t2 +move $t9, $t3 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t2, $v0 +# If not local_main_Main_internal_27 goto continue__153 +sw $t0, -96($fp) +sw $t1, -84($fp) +sw $t2, -112($fp) +sw $t3, -116($fp) +beqz $t2, continue__153 +la $a0, dispatch_error +j .raise +continue__153: +lw $t0, -84($fp) +lw $t1, -108($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_equal_Complex +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -96($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -108($fp) +sw $t2, -96($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -108($fp) +# saves the return value +move $t0, $v0 +# If local_main_Main_internal_26 goto true__163 +sw $t0, -108($fp) +bnez $t0, true__163 +lw $t0, -124($fp) +# Saves in local_main_Main_internal_30 data_3 +la $t0, data_3 +lw $t1, -0($fp) +lw $t2, -128($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -124($fp) +sw $t1, -0($fp) +sw $t2, -128($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -128($fp) +# saves the return value +move $t0, $v0 +lw $t1, -120($fp) +# Moving local_main_Main_internal_31 to local_main_Main_internal_29 +move $t1, $t0 +sw $t1, -120($fp) +sw $t0, -128($fp) +sw $t1, -120($fp) +j end__163 +true__163: +lw $t0, -132($fp) +# Saves in local_main_Main_internal_32 data_4 +la $t0, data_4 +lw $t1, -0($fp) +lw $t2, -136($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -132($fp) +sw $t1, -0($fp) +sw $t2, -136($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -136($fp) +# saves the return value +move $t0, $v0 +lw $t1, -120($fp) +# Moving local_main_Main_internal_33 to local_main_Main_internal_29 +move $t1, $t0 +sw $t1, -120($fp) +sw $t0, -136($fp) +sw $t1, -120($fp) +end__163: +lw $t0, -120($fp) +lw $t1, -140($fp) +# Moving local_main_Main_internal_29 to local_main_Main_internal_34 +move $t1, $t0 +sw $t1, -140($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -120($fp) +sw $t1, -140($fp) +# Removing all locals from stack +addiu $sp, $sp, 144 +jr $ra + + +function_Complex_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Complex_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . x <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +# self . y <- SET 0 +li $t9, 0 +sw $t9, 16($t0) +lw $t1, -4($fp) +# Moving self to local_Complex_Complex_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_init_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value a +addiu $fp, $fp, 4 +# Pops the register with the param value b +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_init_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_x_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_y_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_init_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +lw $t1, -16($fp) +# local_init_Complex_x_1 <- GET self . x +lw $t1, 12($t0) +lw $t2, -4($fp) +lw $t3, -12($fp) +# local_init_Complex_internal_0 <- local_init_Complex_x_1 = a +seq $t3, $t1, $t2 +lw $t4, -24($fp) +# local_init_Complex_y_3 <- GET self . y +lw $t4, 16($t0) +lw $t5, -0($fp) +lw $t6, -20($fp) +# local_init_Complex_internal_2 <- local_init_Complex_y_3 = b +seq $t6, $t4, $t5 +lw $t7, -28($fp) +# Moving self to local_init_Complex_internal_4 +move $t7, $t0 +sw $t7, -28($fp) +move $v0, $t7 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -12($fp) +sw $t4, -24($fp) +sw $t5, -0($fp) +sw $t6, -20($fp) +sw $t7, -28($fp) +# Removing all locals from stack +addiu $sp, $sp, 32 +jr $ra + + +function_print_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_y_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_x_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_y_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_x_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_Complex_internal_18 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_print_Complex_y_1 <- GET self . y +lw $t1, 16($t0) +lw $t2, -4($fp) +# local_print_Complex_internal_0 <- local_print_Complex_y_1 = 0 +li $t9, 0 +seq $t2, $t1, $t9 +# If local_print_Complex_internal_0 goto true__215 +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -4($fp) +bnez $t2, true__215 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_print_Complex_x_3 <- GET self . x +lw $t1, 12($t0) +lw $t2, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Saves in local_print_Complex_internal_5 data_5 +la $t1, data_5 +lw $t2, -32($fp) +# local_print_Complex_internal_7 <- Type of local_print_Complex_internal_4 +lw $t2, 0($t0) +lw $t3, -36($fp) +# Saves in local_print_Complex_internal_8 data_0 +la $t3, data_0 +# local_print_Complex_internal_7 <- local_print_Complex_internal_7 = local_print_Complex_internal_8 +move $t8, $t2 +move $t9, $t3 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t2, $v0 +# If not local_print_Complex_internal_7 goto continue__229 +sw $t0, -20($fp) +sw $t1, -24($fp) +sw $t2, -32($fp) +sw $t3, -36($fp) +beqz $t2, continue__229 +la $a0, dispatch_error +j .raise +continue__229: +lw $t0, -20($fp) +lw $t1, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -24($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -28($fp) +sw $t2, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -40($fp) +# local_print_Complex_y_9 <- GET self . y +lw $t2, 16($t1) +lw $t3, -48($fp) +# local_print_Complex_internal_11 <- Type of local_print_Complex_internal_6 +lw $t3, 0($t0) +lw $t4, -52($fp) +# Saves in local_print_Complex_internal_12 data_0 +la $t4, data_0 +# local_print_Complex_internal_11 <- local_print_Complex_internal_11 = local_print_Complex_internal_12 +move $t8, $t3 +move $t9, $t4 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t3, $v0 +# If not local_print_Complex_internal_11 goto continue__244 +sw $t0, -28($fp) +sw $t1, -0($fp) +sw $t2, -40($fp) +sw $t3, -48($fp) +sw $t4, -52($fp) +beqz $t3, continue__244 +la $a0, dispatch_error +j .raise +continue__244: +lw $t0, -28($fp) +lw $t1, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -40($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -44($fp) +sw $t2, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Saves in local_print_Complex_internal_13 data_6 +la $t1, data_6 +lw $t2, -64($fp) +# local_print_Complex_internal_15 <- Type of local_print_Complex_internal_10 +lw $t2, 0($t0) +lw $t3, -68($fp) +# Saves in local_print_Complex_internal_16 data_0 +la $t3, data_0 +# local_print_Complex_internal_15 <- local_print_Complex_internal_15 = local_print_Complex_internal_16 +move $t8, $t2 +move $t9, $t3 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t2, $v0 +# If not local_print_Complex_internal_15 goto continue__260 +sw $t0, -44($fp) +sw $t1, -56($fp) +sw $t2, -64($fp) +sw $t3, -68($fp) +beqz $t2, continue__260 +la $a0, dispatch_error +j .raise +continue__260: +lw $t0, -44($fp) +lw $t1, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -56($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -60($fp) +sw $t2, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_print_Complex_internal_14 to local_print_Complex_internal_2 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -60($fp) +sw $t1, -12($fp) +j end__215 +true__215: +lw $t0, -0($fp) +lw $t1, -72($fp) +# local_print_Complex_x_17 <- GET self . x +lw $t1, 12($t0) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving local_print_Complex_internal_18 to local_print_Complex_internal_2 +move $t1, $t0 +sw $t1, -12($fp) +sw $t0, -76($fp) +sw $t1, -12($fp) +end__215: +lw $t0, -12($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 80 +jr $ra + + +function_reflect_0_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_reflect_0_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_x_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_x_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_y_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_y_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_0_Complex_internal_8 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_reflect_0_Complex_x_1 <- GET self . x +lw $t1, 12($t0) +lw $t2, -16($fp) +# local_reflect_0_Complex_x_3 <- GET self . x +lw $t2, 12($t0) +lw $t3, -12($fp) +# local_reflect_0_Complex_internal_2 <- ~local_reflect_0_Complex_x_3 +not $t3, $t2 +addi $t3, $t3, 1 +lw $t4, -4($fp) +# local_reflect_0_Complex_internal_0 <- local_reflect_0_Complex_x_1 = local_reflect_0_Complex_internal_2 +seq $t4, $t1, $t3 +lw $t5, -24($fp) +# local_reflect_0_Complex_y_5 <- GET self . y +lw $t5, 16($t0) +lw $t6, -32($fp) +# local_reflect_0_Complex_y_7 <- GET self . y +lw $t6, 16($t0) +lw $t7, -28($fp) +# local_reflect_0_Complex_internal_6 <- ~local_reflect_0_Complex_y_7 +not $t7, $t6 +addi $t7, $t7, 1 +lw $a1, -20($fp) +# local_reflect_0_Complex_internal_4 <- local_reflect_0_Complex_y_5 = local_reflect_0_Complex_internal_6 +seq $a1, $t5, $t7 +lw $a2, -36($fp) +# Moving self to local_reflect_0_Complex_internal_8 +move $a2, $t0 +sw $a2, -36($fp) +move $v0, $a2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -4($fp) +sw $t5, -24($fp) +sw $t6, -32($fp) +sw $t7, -28($fp) +sw $a1, -20($fp) +sw $a2, -36($fp) +# Removing all locals from stack +addiu $sp, $sp, 40 +jr $ra + + +function_reflect_X_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_reflect_X_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_y_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_y_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_X_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_reflect_X_Complex_y_1 <- GET self . y +lw $t1, 16($t0) +lw $t2, -16($fp) +# local_reflect_X_Complex_y_3 <- GET self . y +lw $t2, 16($t0) +lw $t3, -12($fp) +# local_reflect_X_Complex_internal_2 <- ~local_reflect_X_Complex_y_3 +not $t3, $t2 +addi $t3, $t3, 1 +lw $t4, -4($fp) +# local_reflect_X_Complex_internal_0 <- local_reflect_X_Complex_y_1 = local_reflect_X_Complex_internal_2 +seq $t4, $t1, $t3 +lw $t5, -20($fp) +# Moving self to local_reflect_X_Complex_internal_4 +move $t5, $t0 +sw $t5, -20($fp) +move $v0, $t5 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -4($fp) +sw $t5, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_reflect_Y_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_reflect_Y_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_x_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_x_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_reflect_Y_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -8($fp) +# local_reflect_Y_Complex_x_1 <- GET self . x +lw $t1, 12($t0) +lw $t2, -16($fp) +# local_reflect_Y_Complex_x_3 <- GET self . x +lw $t2, 12($t0) +lw $t3, -12($fp) +# local_reflect_Y_Complex_internal_2 <- ~local_reflect_Y_Complex_x_3 +not $t3, $t2 +addi $t3, $t3, 1 +lw $t4, -4($fp) +# local_reflect_Y_Complex_internal_0 <- local_reflect_Y_Complex_x_1 = local_reflect_Y_Complex_internal_2 +seq $t4, $t1, $t3 +lw $t5, -20($fp) +# Moving self to local_reflect_Y_Complex_internal_4 +move $t5, $t0 +sw $t5, -20($fp) +move $v0, $t5 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -8($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -4($fp) +sw $t5, -20($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_equal_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value d +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_equal_Complex_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_x_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_y_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_equal_Complex_internal_11 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -12($fp) +# local_equal_Complex_x_1 <- GET self . x +lw $t1, 12($t0) +lw $t2, -0($fp) +lw $t3, -20($fp) +# local_equal_Complex_internal_3 <- Type of d +lw $t3, 0($t2) +lw $t4, -24($fp) +# Saves in local_equal_Complex_internal_4 data_0 +la $t4, data_0 +# local_equal_Complex_internal_3 <- local_equal_Complex_internal_3 = local_equal_Complex_internal_4 +move $t8, $t3 +move $t9, $t4 +loop_16: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_16 +beqz $a1, mismatch_16 +seq $v0, $a0, $a1 +beqz $v0, mismatch_16 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_16 +mismatch_16: +li $v0, 0 +j end_16 +check_16: +bnez $a1, mismatch_16 +li $v0, 1 +end_16: +move $t3, $v0 +# If not local_equal_Complex_internal_3 goto continue__337 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +sw $t3, -20($fp) +sw $t4, -24($fp) +beqz $t3, continue__337 +la $a0, dispatch_error +j .raise +continue__337: +lw $t0, -0($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_x_value_Complex +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_equal_Complex_internal_0 <- local_equal_Complex_x_1 = local_equal_Complex_internal_2 +seq $t2, $t1, $t0 +# If local_equal_Complex_internal_0 goto true__348 +sw $t0, -16($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +bnez $t2, true__348 +lw $t0, -28($fp) +# Moving 0 to local_equal_Complex_internal_5 +li $t0, 0 +sw $t0, -28($fp) +sw $t0, -28($fp) +j end__348 +true__348: +lw $t0, -4($fp) +lw $t1, -36($fp) +# local_equal_Complex_y_7 <- GET self . y +lw $t1, 16($t0) +lw $t2, -0($fp) +lw $t3, -44($fp) +# local_equal_Complex_internal_9 <- Type of d +lw $t3, 0($t2) +lw $t4, -48($fp) +# Saves in local_equal_Complex_internal_10 data_0 +la $t4, data_0 +# local_equal_Complex_internal_9 <- local_equal_Complex_internal_9 = local_equal_Complex_internal_10 +move $t8, $t3 +move $t9, $t4 +loop_17: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_17 +beqz $a1, mismatch_17 +seq $v0, $a0, $a1 +beqz $v0, mismatch_17 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_17 +mismatch_17: +li $v0, 0 +j end_17 +check_17: +bnez $a1, mismatch_17 +li $v0, 1 +end_17: +move $t3, $v0 +# If not local_equal_Complex_internal_9 goto continue__358 +sw $t0, -4($fp) +sw $t1, -36($fp) +sw $t2, -0($fp) +sw $t3, -44($fp) +sw $t4, -48($fp) +beqz $t3, continue__358 +la $a0, dispatch_error +j .raise +continue__358: +lw $t0, -0($fp) +lw $t1, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_y_value_Complex +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +lw $t2, -32($fp) +# local_equal_Complex_internal_6 <- local_equal_Complex_y_7 = local_equal_Complex_internal_8 +seq $t2, $t1, $t0 +# If local_equal_Complex_internal_6 goto true__369 +sw $t0, -40($fp) +sw $t1, -36($fp) +sw $t2, -32($fp) +bnez $t2, true__369 +lw $t0, -52($fp) +# Moving 0 to local_equal_Complex_internal_11 +li $t0, 0 +sw $t0, -52($fp) +sw $t0, -52($fp) +j end__369 +true__369: +lw $t0, -52($fp) +# Moving 1 to local_equal_Complex_internal_11 +li $t0, 1 +sw $t0, -52($fp) +sw $t0, -52($fp) +end__369: +lw $t0, -52($fp) +lw $t1, -28($fp) +# Moving local_equal_Complex_internal_11 to local_equal_Complex_internal_5 +move $t1, $t0 +sw $t1, -28($fp) +sw $t0, -52($fp) +sw $t1, -28($fp) +end__348: +lw $t0, -28($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +# Removing all locals from stack +addiu $sp, $sp, 56 +jr $ra + + +function_x_value_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_x_value_Complex_x_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_x_value_Complex_x_0 <- GET self . x +lw $t1, 12($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_y_value_Complex: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_y_value_Complex_y_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_y_value_Complex_y_0 <- GET self . y +lw $t1, 16($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +type_Complex: .asciiz "Complex" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "=( +" +data_2: .asciiz "=) +" +data_3: .asciiz "=( +" +data_4: .asciiz "=) +" +data_5: .asciiz "+" +data_6: .asciiz "I" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/palindrome.cl b/tests/codegen/palindrome.cl old mode 100755 new mode 100644 index 7f24789f..6acbeb73 --- a/tests/codegen/palindrome.cl +++ b/tests/codegen/palindrome.cl @@ -1,25 +1,25 @@ -class Main inherits IO { - pal(s : String) : Bool { - if s.length() = 0 - then true - else if s.length() = 1 - then true - else if s.substr(0, 1) = s.substr(s.length() - 1, 1) - then pal(s.substr(1, s.length() -2)) - else false - fi fi fi - }; - - i : Int; - - main() : IO { - { - i <- ~1; - out_string("enter a string\n"); - if pal(in_string()) - then out_string("that was a palindrome\n") - else out_string("that was not a palindrome\n") - fi; - } - }; -}; +class Main inherits IO { + pal(s : String) : Bool { + if s.length() = 0 + then true + else if s.length() = 1 + then true + else if s.substr(0, 1) = s.substr(s.length() - 1, 1) + then pal(s.substr(1, s.length() -2)) + else false + fi fi fi + }; + + i : Int; + + main() : IO { + { + i <- ~1; + out_string("enter a string\n"); + if pal(in_string()) + then out_string("that was a palindrome\n") + else out_string("that was not a palindrome\n") + fi; + } + }; +}; diff --git a/tests/codegen/palindrome.mips b/tests/codegen/palindrome.mips new file mode 100644 index 00000000..4f718d0c --- /dev/null +++ b/tests/codegen/palindrome.mips @@ -0,0 +1,1941 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_pal_Main +sw $t9, 84($v0) +la $t9, function_main_Main +sw $t9, 88($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_pal_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . i <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Moving self to local_Main_Main_internal_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_pal_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value s +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_pal_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_pal_Main_internal_29 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -16($fp) +# local_pal_Main_internal_2 <- Type of s +la $t1, type_String +lw $t2, -20($fp) +# Saves in local_pal_Main_internal_3 data_0 +la $t2, data_0 +# local_pal_Main_internal_2 <- local_pal_Main_internal_2 = local_pal_Main_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_pal_Main_internal_2 goto continue__59 +sw $t0, -0($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +beqz $t1, continue__59 +la $a0, dispatch_error +j .raise +continue__59: +lw $t0, -12($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# local_pal_Main_internal_0 <- local_pal_Main_internal_1 = 0 +li $t9, 0 +seq $t1, $t0, $t9 +# If local_pal_Main_internal_0 goto true__70 +sw $t0, -12($fp) +sw $t1, -8($fp) +bnez $t1, true__70 +lw $t0, -0($fp) +lw $t1, -36($fp) +# local_pal_Main_internal_7 <- Type of s +la $t1, type_String +lw $t2, -40($fp) +# Saves in local_pal_Main_internal_8 data_0 +la $t2, data_0 +# local_pal_Main_internal_7 <- local_pal_Main_internal_7 = local_pal_Main_internal_8 +move $t8, $t1 +move $t9, $t2 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t1, $v0 +# If not local_pal_Main_internal_7 goto continue__75 +sw $t0, -0($fp) +sw $t1, -36($fp) +sw $t2, -40($fp) +beqz $t1, continue__75 +la $a0, dispatch_error +j .raise +continue__75: +lw $t0, -32($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -28($fp) +# local_pal_Main_internal_5 <- local_pal_Main_internal_6 = 1 +li $t9, 1 +seq $t1, $t0, $t9 +# If local_pal_Main_internal_5 goto true__86 +sw $t0, -32($fp) +sw $t1, -28($fp) +bnez $t1, true__86 +lw $t0, -0($fp) +lw $t1, -56($fp) +# local_pal_Main_internal_12 <- Type of s +la $t1, type_String +lw $t2, -60($fp) +# Saves in local_pal_Main_internal_13 data_0 +la $t2, data_0 +# local_pal_Main_internal_12 <- local_pal_Main_internal_12 = local_pal_Main_internal_13 +move $t8, $t1 +move $t9, $t2 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t1, $v0 +# If not local_pal_Main_internal_12 goto continue__93 +sw $t0, -0($fp) +sw $t1, -56($fp) +sw $t2, -60($fp) +beqz $t1, continue__93 +la $a0, dispatch_error +j .raise +continue__93: +lw $t0, -52($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 0 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -72($fp) +# local_pal_Main_internal_16 <- Type of s +la $t2, type_String +lw $t3, -76($fp) +# Saves in local_pal_Main_internal_17 data_0 +la $t3, data_0 +# local_pal_Main_internal_16 <- local_pal_Main_internal_16 = local_pal_Main_internal_17 +move $t8, $t2 +move $t9, $t3 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If not local_pal_Main_internal_16 goto continue__107 +sw $t0, -52($fp) +sw $t1, -0($fp) +sw $t2, -72($fp) +sw $t3, -76($fp) +beqz $t2, continue__107 +la $a0, dispatch_error +j .raise +continue__107: +lw $t0, -68($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# local_pal_Main_internal_14 <- local_pal_Main_internal_15 - 1 +addi $t1, $t0, -1 +lw $t2, -0($fp) +lw $t3, -84($fp) +# local_pal_Main_internal_19 <- Type of s +la $t3, type_String +lw $t4, -88($fp) +# Saves in local_pal_Main_internal_20 data_0 +la $t4, data_0 +# local_pal_Main_internal_19 <- local_pal_Main_internal_19 = local_pal_Main_internal_20 +move $t8, $t3 +move $t9, $t4 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t3, $v0 +# If not local_pal_Main_internal_19 goto continue__121 +sw $t0, -68($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +sw $t3, -84($fp) +sw $t4, -88($fp) +beqz $t3, continue__121 +la $a0, dispatch_error +j .raise +continue__121: +lw $t0, -80($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -64($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -80($fp) +sw $t1, -64($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +lw $t2, -48($fp) +# local_pal_Main_internal_10 <- local_pal_Main_internal_11 = local_pal_Main_internal_18 +move $t8, $t1 +move $t9, $t0 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t2, $v0 +# If local_pal_Main_internal_10 goto true__132 +sw $t0, -80($fp) +sw $t1, -52($fp) +sw $t2, -48($fp) +bnez $t2, true__132 +lw $t0, -92($fp) +# Moving 0 to local_pal_Main_internal_21 +li $t0, 0 +sw $t0, -92($fp) +sw $t0, -92($fp) +j end__132 +true__132: +lw $t0, -0($fp) +lw $t1, -104($fp) +# local_pal_Main_internal_24 <- Type of s +la $t1, type_String +lw $t2, -108($fp) +# Saves in local_pal_Main_internal_25 data_0 +la $t2, data_0 +# local_pal_Main_internal_24 <- local_pal_Main_internal_24 = local_pal_Main_internal_25 +move $t8, $t1 +move $t9, $t2 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t1, $v0 +# If not local_pal_Main_internal_24 goto continue__142 +sw $t0, -0($fp) +sw $t1, -104($fp) +sw $t2, -108($fp) +beqz $t1, continue__142 +la $a0, dispatch_error +j .raise +continue__142: +lw $t0, -100($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -100($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -100($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# local_pal_Main_internal_22 <- local_pal_Main_internal_23 - 2 +addi $t1, $t0, -2 +lw $t2, -0($fp) +lw $t3, -116($fp) +# local_pal_Main_internal_27 <- Type of s +la $t3, type_String +lw $t4, -120($fp) +# Saves in local_pal_Main_internal_28 data_0 +la $t4, data_0 +# local_pal_Main_internal_27 <- local_pal_Main_internal_27 = local_pal_Main_internal_28 +move $t8, $t3 +move $t9, $t4 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t3, $v0 +# If not local_pal_Main_internal_27 goto continue__156 +sw $t0, -100($fp) +sw $t1, -96($fp) +sw $t2, -0($fp) +sw $t3, -116($fp) +sw $t4, -120($fp) +beqz $t3, continue__156 +la $a0, dispatch_error +j .raise +continue__156: +lw $t0, -112($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -96($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -112($fp) +sw $t1, -96($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -112($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -124($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_pal_Main +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -112($fp) +sw $t1, -4($fp) +sw $t2, -124($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -124($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Moving local_pal_Main_internal_29 to local_pal_Main_internal_21 +move $t1, $t0 +sw $t1, -92($fp) +sw $t0, -124($fp) +sw $t1, -92($fp) +end__132: +lw $t0, -92($fp) +lw $t1, -44($fp) +# Moving local_pal_Main_internal_21 to local_pal_Main_internal_9 +move $t1, $t0 +sw $t1, -44($fp) +sw $t0, -92($fp) +sw $t1, -44($fp) +j end__86 +true__86: +lw $t0, -44($fp) +# Moving 1 to local_pal_Main_internal_9 +li $t0, 1 +sw $t0, -44($fp) +sw $t0, -44($fp) +end__86: +lw $t0, -44($fp) +lw $t1, -24($fp) +# Moving local_pal_Main_internal_9 to local_pal_Main_internal_4 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -44($fp) +sw $t1, -24($fp) +j end__70 +true__70: +lw $t0, -24($fp) +# Moving 1 to local_pal_Main_internal_4 +li $t0, 1 +sw $t0, -24($fp) +sw $t0, -24($fp) +end__70: +lw $t0, -24($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 128 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +li $t9, 1 +# local_main_Main_internal_0 <- ~1 +not $t0, $t9 +addi $t0, $t0, 1 +lw $t1, -0($fp) +# self . i <- SET local_main_Main_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Saves in local_main_Main_internal_1 data_1 +la $t2, data_1 +lw $t3, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_string_IO +lw $t8, 24($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_pal_Main +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +# If local_main_Main_internal_4 goto true__201 +sw $t0, -20($fp) +bnez $t0, true__201 +lw $t0, -28($fp) +# Saves in local_main_Main_internal_6 data_2 +la $t0, data_2 +lw $t1, -0($fp) +lw $t2, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -0($fp) +sw $t2, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Moving local_main_Main_internal_7 to local_main_Main_internal_5 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -32($fp) +sw $t1, -24($fp) +j end__201 +true__201: +lw $t0, -36($fp) +# Saves in local_main_Main_internal_8 data_3 +la $t0, data_3 +lw $t1, -0($fp) +lw $t2, -40($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -0($fp) +sw $t2, -40($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -40($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# Moving local_main_Main_internal_9 to local_main_Main_internal_5 +move $t1, $t0 +sw $t1, -24($fp) +sw $t0, -40($fp) +sw $t1, -24($fp) +end__201: +lw $t0, -24($fp) +lw $t1, -44($fp) +# Moving local_main_Main_internal_5 to local_main_Main_internal_10 +move $t1, $t0 +sw $t1, -44($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -44($fp) +# Removing all locals from stack +addiu $sp, $sp, 48 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "enter a string +" +data_2: .asciiz "that was not a palindrome +" +data_3: .asciiz "that was a palindrome +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/primes.mips b/tests/codegen/primes.mips new file mode 100644 index 00000000..0b90b827 --- /dev/null +++ b/tests/codegen/primes.mips @@ -0,0 +1,1595 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 32 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 32 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_out_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_testee_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_testee_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_divisor_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_divisor_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_testee_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_divisor_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_testee_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_divisor_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_divisor_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_25 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_testee_26 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_27 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_divisor_28 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_divisor_29 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_30 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_testee_31 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_out_32 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_33 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_34 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_35 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_36 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_37 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_stop_38 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_testee_39 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_40 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_41 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_42 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_43 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_44 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_45 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_46 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_47 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_Main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Moving 2 to local_Main_Main_internal_2 +li $t1, 2 +sw $t1, -12($fp) +lw $t2, -0($fp) +# self . out <- SET local_Main_Main_internal_2 +sw $t1, 12($t2) +lw $t3, -16($fp) +# local_Main_Main_out_3 <- GET self . out +lw $t3, 12($t2) +# self . testee <- SET local_Main_Main_out_3 +sw $t3, 16($t2) +# self . divisor <- SET 0 +li $t9, 0 +sw $t9, 20($t2) +# self . stop <- SET 500 +li $t9, 500 +sw $t9, 24($t2) +lw $t4, -20($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t4, $v0 +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +sw $t3, -16($fp) +sw $t4, -20($fp) +start__64: +li $t9, 1 +# If not 1 goto end__64 +beqz $t9, end__64 +lw $t0, -0($fp) +lw $t1, -28($fp) +# local_Main_Main_testee_6 <- GET self . testee +lw $t1, 16($t0) +lw $t2, -24($fp) +# local_Main_Main_internal_5 <- local_Main_Main_testee_6 + 1 +addi $t2, $t1, 1 +# self . testee <- SET local_Main_Main_internal_5 +sw $t2, 16($t0) +# self . divisor <- SET 2 +li $t9, 2 +sw $t9, 20($t0) +lw $t3, -32($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t3, $v0 +sw $t0, -0($fp) +sw $t1, -28($fp) +sw $t2, -24($fp) +sw $t3, -32($fp) +start__74: +lw $t0, -0($fp) +lw $t1, -40($fp) +# local_Main_Main_testee_9 <- GET self . testee +lw $t1, 16($t0) +lw $t2, -48($fp) +# local_Main_Main_divisor_11 <- GET self . divisor +lw $t2, 20($t0) +lw $t3, -52($fp) +# local_Main_Main_divisor_12 <- GET self . divisor +lw $t3, 20($t0) +lw $t4, -44($fp) +# local_Main_Main_internal_10 <- local_Main_Main_divisor_11 * local_Main_Main_divisor_12 +mult $t2, $t3 +mflo $t4 +lw $t5, -36($fp) +# local_Main_Main_internal_8 <- local_Main_Main_testee_9 < local_Main_Main_internal_10 +slt $t5, $t1, $t4 +# If local_Main_Main_internal_8 goto true__87 +sw $t0, -0($fp) +sw $t1, -40($fp) +sw $t2, -48($fp) +sw $t3, -52($fp) +sw $t4, -44($fp) +sw $t5, -36($fp) +bnez $t5, true__87 +lw $t0, -0($fp) +lw $t1, -68($fp) +# local_Main_Main_testee_16 <- GET self . testee +lw $t1, 16($t0) +lw $t2, -76($fp) +# local_Main_Main_divisor_18 <- GET self . divisor +lw $t2, 20($t0) +lw $t3, -84($fp) +# local_Main_Main_testee_20 <- GET self . testee +lw $t3, 16($t0) +lw $t4, -88($fp) +# local_Main_Main_divisor_21 <- GET self . divisor +lw $t4, 20($t0) +lw $t5, -80($fp) +# local_Main_Main_internal_19 <- local_Main_Main_testee_20 / local_Main_Main_divisor_21 +la $a0, zero_error +beqz $t4, .raise +div $t3, $t4 +mflo $t5 +lw $t6, -72($fp) +# local_Main_Main_internal_17 <- local_Main_Main_divisor_18 * local_Main_Main_internal_19 +mult $t2, $t5 +mflo $t6 +lw $t7, -64($fp) +# local_Main_Main_internal_15 <- local_Main_Main_testee_16 - local_Main_Main_internal_17 +sub $t7, $t1, $t6 +lw $a1, -60($fp) +# local_Main_Main_internal_14 <- local_Main_Main_internal_15 = 0 +li $t9, 0 +seq $a1, $t7, $t9 +# If local_Main_Main_internal_14 goto true__105 +sw $t0, -0($fp) +sw $t1, -68($fp) +sw $t2, -76($fp) +sw $t3, -84($fp) +sw $t4, -88($fp) +sw $t5, -80($fp) +sw $t6, -72($fp) +sw $t7, -64($fp) +sw $a1, -60($fp) +bnez $a1, true__105 +lw $t0, -92($fp) +# Moving 1 to local_Main_Main_internal_22 +li $t0, 1 +sw $t0, -92($fp) +sw $t0, -92($fp) +j end__105 +true__105: +lw $t0, -92($fp) +# Moving 0 to local_Main_Main_internal_22 +li $t0, 0 +sw $t0, -92($fp) +sw $t0, -92($fp) +end__105: +lw $t0, -92($fp) +lw $t1, -56($fp) +# Moving local_Main_Main_internal_22 to local_Main_Main_internal_13 +move $t1, $t0 +sw $t1, -56($fp) +sw $t0, -92($fp) +sw $t1, -56($fp) +j end__87 +true__87: +lw $t0, -56($fp) +# Moving 0 to local_Main_Main_internal_13 +li $t0, 0 +sw $t0, -56($fp) +sw $t0, -56($fp) +end__87: +lw $t0, -56($fp) +# If not local_Main_Main_internal_13 goto end__74 +sw $t0, -56($fp) +beqz $t0, end__74 +lw $t0, -0($fp) +lw $t1, -100($fp) +# local_Main_Main_divisor_24 <- GET self . divisor +lw $t1, 20($t0) +lw $t2, -96($fp) +# local_Main_Main_internal_23 <- local_Main_Main_divisor_24 + 1 +addi $t2, $t1, 1 +# self . divisor <- SET local_Main_Main_internal_23 +sw $t2, 20($t0) +lw $t3, -32($fp) +# Moving local_Main_Main_internal_23 to local_Main_Main_internal_7 +move $t3, $t2 +sw $t3, -32($fp) +sw $t0, -0($fp) +sw $t1, -100($fp) +sw $t2, -96($fp) +sw $t3, -32($fp) +j start__74 +end__74: +lw $t0, -0($fp) +lw $t1, -108($fp) +# local_Main_Main_testee_26 <- GET self . testee +lw $t1, 16($t0) +lw $t2, -116($fp) +# local_Main_Main_divisor_28 <- GET self . divisor +lw $t2, 20($t0) +lw $t3, -120($fp) +# local_Main_Main_divisor_29 <- GET self . divisor +lw $t3, 20($t0) +lw $t4, -112($fp) +# local_Main_Main_internal_27 <- local_Main_Main_divisor_28 * local_Main_Main_divisor_29 +mult $t2, $t3 +mflo $t4 +lw $t5, -104($fp) +# local_Main_Main_internal_25 <- local_Main_Main_testee_26 < local_Main_Main_internal_27 +slt $t5, $t1, $t4 +# If local_Main_Main_internal_25 goto true__136 +sw $t0, -0($fp) +sw $t1, -108($fp) +sw $t2, -116($fp) +sw $t3, -120($fp) +sw $t4, -112($fp) +sw $t5, -104($fp) +bnez $t5, true__136 +lw $t0, -124($fp) +# Moving 0 to local_Main_Main_internal_30 +li $t0, 0 +sw $t0, -124($fp) +sw $t0, -124($fp) +j end__136 +true__136: +lw $t0, -0($fp) +lw $t1, -128($fp) +# local_Main_Main_testee_31 <- GET self . testee +lw $t1, 16($t0) +# self . out <- SET local_Main_Main_testee_31 +sw $t1, 12($t0) +lw $t2, -132($fp) +# local_Main_Main_out_32 <- GET self . out +lw $t2, 12($t0) +lw $t3, -136($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -128($fp) +sw $t2, -132($fp) +sw $t3, -136($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -136($fp) +# saves the return value +move $t0, $v0 +lw $t1, -140($fp) +# Saves in local_Main_Main_internal_34 data_2 +la $t1, data_2 +lw $t2, -0($fp) +lw $t3, -144($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -136($fp) +sw $t1, -140($fp) +sw $t2, -0($fp) +sw $t3, -144($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -144($fp) +# saves the return value +move $t0, $v0 +lw $t1, -148($fp) +# Moving local_Main_Main_internal_35 to local_Main_Main_internal_36 +move $t1, $t0 +sw $t1, -148($fp) +lw $t2, -124($fp) +# Moving local_Main_Main_internal_36 to local_Main_Main_internal_30 +move $t2, $t1 +sw $t2, -124($fp) +sw $t0, -144($fp) +sw $t1, -148($fp) +sw $t2, -124($fp) +end__136: +lw $t0, -0($fp) +lw $t1, -156($fp) +# local_Main_Main_stop_38 <- GET self . stop +lw $t1, 24($t0) +lw $t2, -160($fp) +# local_Main_Main_testee_39 <- GET self . testee +lw $t2, 16($t0) +lw $t3, -152($fp) +# local_Main_Main_internal_37 <- local_Main_Main_stop_38 <= local_Main_Main_testee_39 +sle $t3, $t1, $t2 +# If local_Main_Main_internal_37 goto true__167 +sw $t0, -0($fp) +sw $t1, -156($fp) +sw $t2, -160($fp) +sw $t3, -152($fp) +bnez $t3, true__167 +lw $t0, -168($fp) +# Saves in local_Main_Main_internal_41 data_3 +la $t0, data_3 +lw $t1, -164($fp) +# Moving local_Main_Main_internal_41 to local_Main_Main_internal_40 +move $t1, $t0 +sw $t1, -164($fp) +sw $t0, -168($fp) +sw $t1, -164($fp) +j end__167 +true__167: +lw $t0, -172($fp) +# Saves in local_Main_Main_internal_42 data_4 +la $t0, data_4 +lw $t1, -180($fp) +# local_Main_Main_internal_44 <- Type of local_Main_Main_internal_42 +la $t1, type_String +lw $t2, -184($fp) +# Saves in local_Main_Main_internal_45 data_0 +la $t2, data_0 +# local_Main_Main_internal_44 <- local_Main_Main_internal_44 = local_Main_Main_internal_45 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_Main_Main_internal_44 goto continue__180 +sw $t0, -172($fp) +sw $t1, -180($fp) +sw $t2, -184($fp) +beqz $t1, continue__180 +la $a0, dispatch_error +j .raise +continue__180: +lw $t0, -176($fp) +# Static Dispatch of the method abort +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -172($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -176($fp) +sw $t1, -172($fp) +# This function will consume the arguments +jal function_abort_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -176($fp) +# saves the return value +move $t0, $v0 +lw $t1, -164($fp) +# Moving local_Main_Main_internal_43 to local_Main_Main_internal_40 +move $t1, $t0 +sw $t1, -164($fp) +sw $t0, -176($fp) +sw $t1, -164($fp) +end__167: +lw $t0, -164($fp) +lw $t1, -188($fp) +# Moving local_Main_Main_internal_40 to local_Main_Main_internal_46 +move $t1, $t0 +sw $t1, -188($fp) +lw $t2, -20($fp) +# Moving local_Main_Main_internal_46 to local_Main_Main_internal_4 +move $t2, $t1 +sw $t2, -20($fp) +sw $t0, -164($fp) +sw $t1, -188($fp) +sw $t2, -20($fp) +j start__64 +end__64: +lw $t0, -20($fp) +lw $t1, -0($fp) +# self . m <- SET local_Main_Main_internal_4 +sw $t0, 28($t1) +lw $t2, -192($fp) +# Moving self to local_Main_Main_internal_47 +move $t2, $t1 +sw $t2, -192($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -0($fp) +sw $t2, -192($fp) +# Removing all locals from stack +addiu $sp, $sp, 196 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_main_Main_internal_0 +li $t0, 0 +sw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "2 is trivially prime. +" +data_2: .asciiz " is prime. +" +data_3: .asciiz "continue" +data_4: .asciiz "halt" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/print-cool.mips b/tests/codegen/print-cool.mips new file mode 100644 index 00000000..35a7ef07 --- /dev/null +++ b/tests/codegen/print-cool.mips @@ -0,0 +1,1488 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_main_Main +sw $t9, 80($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 36 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Object +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t0) +lw $t1, -12($fp) +# local_main_Main_internal_2 <- Type of local_main_Main_internal_0 +lw $t1, 0($t0) +lw $t2, -16($fp) +# Saves in local_main_Main_internal_3 data_0 +la $t2, data_0 +# local_main_Main_internal_2 <- local_main_Main_internal_2 = local_main_Main_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t1, $v0 +# If not local_main_Main_internal_2 goto continue__53 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -16($fp) +beqz $t1, continue__53 +la $a0, dispatch_error +j .raise +continue__53: +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_main_Main_internal_5 <- Type of local_main_Main_internal_1 +la $t1, type_String +lw $t2, -28($fp) +# Saves in local_main_Main_internal_6 data_0 +la $t2, data_0 +# local_main_Main_internal_5 <- local_main_Main_internal_5 = local_main_Main_internal_6 +move $t8, $t1 +move $t9, $t2 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t1, $v0 +# If not local_main_Main_internal_5 goto continue__67 +sw $t0, -8($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +beqz $t1, continue__67 +la $a0, dispatch_error +j .raise +continue__67: +lw $t0, -20($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 4 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -8($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -0($fp) +sw $t2, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -36($fp) +# local_main_Main_internal_8 <- Type of self +lw $t2, 0($t1) +lw $t3, -40($fp) +# Saves in local_main_Main_internal_9 data_0 +la $t3, data_0 +# local_main_Main_internal_8 <- local_main_Main_internal_8 = local_main_Main_internal_9 +move $t8, $t2 +move $t9, $t3 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t2, $v0 +lw $t4, -48($fp) +# local_main_Main_internal_11 <- Type of local_main_Main_internal_8 +la $t4, type_String +lw $t5, -52($fp) +# Saves in local_main_Main_internal_12 data_0 +la $t5, data_0 +# local_main_Main_internal_11 <- local_main_Main_internal_11 = local_main_Main_internal_12 +move $t8, $t4 +move $t9, $t5 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t4, $v0 +# If not local_main_Main_internal_11 goto continue__88 +sw $t0, -32($fp) +sw $t1, -0($fp) +sw $t2, -36($fp) +sw $t3, -40($fp) +sw $t4, -48($fp) +sw $t5, -52($fp) +beqz $t4, continue__88 +la $a0, dispatch_error +j .raise +continue__88: +lw $t0, -44($fp) +# Static Dispatch of the method type_name +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -36($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -36($fp) +# This function will consume the arguments +jal function_type_name_Bool +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -60($fp) +# local_main_Main_internal_14 <- Type of local_main_Main_internal_10 +la $t1, type_String +lw $t2, -64($fp) +# Saves in local_main_Main_internal_15 data_0 +la $t2, data_0 +# local_main_Main_internal_14 <- local_main_Main_internal_14 = local_main_Main_internal_15 +move $t8, $t1 +move $t9, $t2 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t1, $v0 +# If not local_main_Main_internal_14 goto continue__102 +sw $t0, -44($fp) +sw $t1, -60($fp) +sw $t2, -64($fp) +beqz $t1, continue__102 +la $a0, dispatch_error +j .raise +continue__102: +lw $t0, -56($fp) +# Static Dispatch of the method substr +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +li $t9, 3 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +li $t9, 1 +sw $t9, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t1, -44($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -44($fp) +# This function will consume the arguments +jal function_substr_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +lw $t2, -72($fp) +# local_main_Main_internal_17 <- Type of local_main_Main_internal_7 +lw $t2, 0($t1) +lw $t3, -76($fp) +# Saves in local_main_Main_internal_18 data_0 +la $t3, data_0 +# local_main_Main_internal_17 <- local_main_Main_internal_17 = local_main_Main_internal_18 +move $t8, $t2 +move $t9, $t3 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t2, $v0 +# If not local_main_Main_internal_17 goto continue__114 +sw $t0, -56($fp) +sw $t1, -32($fp) +sw $t2, -72($fp) +sw $t3, -76($fp) +beqz $t2, continue__114 +la $a0, dispatch_error +j .raise +continue__114: +lw $t0, -32($fp) +lw $t1, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -56($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -68($fp) +sw $t2, -56($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Saves in local_main_Main_internal_19 data_1 +la $t1, data_1 +lw $t2, -0($fp) +lw $t3, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -80($fp) +sw $t2, -0($fp) +sw $t3, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Moving local_main_Main_internal_20 to local_main_Main_internal_21 +move $t1, $t0 +sw $t1, -88($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +# Removing all locals from stack +addiu $sp, $sp, 92 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz " +" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen/sort-list.mips b/tests/codegen/sort-list.mips new file mode 100644 index 00000000..88691e37 --- /dev/null +++ b/tests/codegen/sort-list.mips @@ -0,0 +1,4086 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_isNil_List +sw $t9, 80($v0) +la $t9, function_cons_List +sw $t9, 84($v0) +la $t9, function_car_List +sw $t9, 88($v0) +la $t9, function_cdr_List +sw $t9, 92($v0) +la $t9, function_rev_List +sw $t9, 96($v0) +la $t9, function_sort_List +sw $t9, 100($v0) +la $t9, function_insert_List +sw $t9, 104($v0) +la $t9, function_rcons_List +sw $t9, 108($v0) +la $t9, function_print_list_List +sw $t9, 112($v0) +la $t9, function_Cons_Cons +sw $t9, 116($v0) +la $t9, function_isNil_Cons +sw $t9, 120($v0) +la $t9, function_init_Cons +sw $t9, 124($v0) +la $t9, function_car_Cons +sw $t9, 128($v0) +la $t9, function_cdr_Cons +sw $t9, 132($v0) +la $t9, function_rev_Cons +sw $t9, 136($v0) +la $t9, function_sort_Cons +sw $t9, 140($v0) +la $t9, function_insert_Cons +sw $t9, 144($v0) +la $t9, function_rcons_Cons +sw $t9, 148($v0) +la $t9, function_print_list_Cons +sw $t9, 152($v0) +la $t9, function_isNil_Nil +sw $t9, 156($v0) +la $t9, function_rev_Nil +sw $t9, 160($v0) +la $t9, function_sort_Nil +sw $t9, 164($v0) +la $t9, function_insert_Nil +sw $t9, 168($v0) +la $t9, function_rcons_Nil +sw $t9, 172($v0) +la $t9, function_print_list_Nil +sw $t9, 176($v0) +la $t9, function_Main_Main +sw $t9, 180($v0) +la $t9, function_iota_Main +sw $t9, 184($v0) +la $t9, function_main_Main +sw $t9, 188($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_List +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 68 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_isNil_List in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_cons_List in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_car_List in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_cdr_List in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_rev_List in a0 +lw $a0, 96($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_sort_List in a0 +lw $a0, 100($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_insert_List in a0 +lw $a0, 104($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_rcons_List in a0 +lw $a0, 108($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_print_list_List in a0 +lw $a0, 112($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Cons +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 76 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_isNil_Cons in a0 +lw $a0, 120($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_cons_List in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_car_Cons in a0 +lw $a0, 128($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_cdr_Cons in a0 +lw $a0, 132($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_rev_Cons in a0 +lw $a0, 136($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_sort_Cons in a0 +lw $a0, 140($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_insert_Cons in a0 +lw $a0, 144($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_rcons_Cons in a0 +lw $a0, 148($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_print_list_Cons in a0 +lw $a0, 152($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +# Save the direction of the method function_init_Cons in a0 +lw $a0, 124($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 68($v0) +# Save the direction of the method function_Cons_Cons in a0 +lw $a0, 116($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 72($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Nil +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 68 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_isNil_Nil in a0 +lw $a0, 156($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_cons_List in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_car_List in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +# Save the direction of the method function_cdr_List in a0 +lw $a0, 92($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 44($v0) +# Save the direction of the method function_rev_Nil in a0 +lw $a0, 160($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 48($v0) +# Save the direction of the method function_sort_Nil in a0 +lw $a0, 164($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 52($v0) +# Save the direction of the method function_insert_Nil in a0 +lw $a0, 168($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 56($v0) +# Save the direction of the method function_rcons_Nil in a0 +lw $a0, 172($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 60($v0) +# Save the direction of the method function_print_list_Nil in a0 +lw $a0, 176($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 64($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_iota_Main in a0 +lw $a0, 184($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 188($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 180($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) +sw $t1, -4($fp) + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_isNil_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_List_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_isNil_List_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving 1 to local_isNil_List_internal_1 +li $t1, 1 +sw $t1, -8($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_cons_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value hd +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cons_List_new_cell_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_List_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_List_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_List_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cons_List_internal_4 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Moving local_cons_List_internal_1 to local_cons_List_new_cell_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -20($fp) +# local_cons_List_internal_3 <- Type of local_cons_List_new_cell_0 +lw $t2, 0($t1) +lw $t3, -24($fp) +# Saves in local_cons_List_internal_4 data_0 +la $t3, data_0 +# local_cons_List_internal_3 <- local_cons_List_internal_3 = local_cons_List_internal_4 +move $t8, $t2 +move $t9, $t3 +loop_6: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_6 +beqz $a1, mismatch_6 +seq $v0, $a0, $a1 +beqz $v0, mismatch_6 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_6 +mismatch_6: +li $v0, 0 +j end_6 +check_6: +bnez $a1, mismatch_6 +li $v0, 1 +end_6: +move $t2, $v0 +# If not local_cons_List_internal_3 goto continue__67 +sw $t0, -12($fp) +sw $t1, -8($fp) +sw $t2, -20($fp) +sw $t3, -24($fp) +beqz $t2, continue__67 +la $a0, dispatch_error +j .raise +continue__67: +lw $t0, -8($fp) +lw $t1, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 68($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -0($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -4($fp) +sw $t3, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 28 +jr $ra + + +function_car_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_car_List_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_car_List_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_car_List_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Int +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 4($t8) +sw $v0, 8($t1) +lw $t2, -12($fp) +# Moving local_car_List_internal_1 to local_car_List_internal_2 +move $t2, $t1 +sw $t2, -12($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_cdr_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cdr_List_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cdr_List_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_cdr_List_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_List +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t1) +lw $t2, -12($fp) +# Moving local_cdr_List_internal_1 to local_cdr_List_internal_2 +move $t2, $t1 +sw $t2, -12($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_rev_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_rev_List_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cdr_List +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_sort_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_sort_List_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cdr_List +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_insert_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_insert_List_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cdr_List +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_rcons_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_rcons_List_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_cdr_List +lw $t8, 44($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_print_list_List: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_list_List_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_abort_Object +lw $t8, 4($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_Cons_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Cons_Cons_xcdr_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Cons_Cons_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# self . xcar <- SET 0 +li $t9, 0 +sw $t9, 12($t0) +lw $t1, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t1, $v0 +# self . xcdr <- SET local_Cons_Cons_xcdr_0 +sw $t1, 16($t0) +lw $t2, -8($fp) +# Moving self to local_Cons_Cons_internal_1 +move $t2, $t0 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_isNil_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 0 to local_isNil_Cons_internal_0 +li $t0, 0 +sw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_init_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value hd +addiu $fp, $fp, 4 +# Pops the register with the param value tl +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_init_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# self . xcar <- SET hd +sw $t0, 12($t1) +lw $t2, -0($fp) +# self . xcdr <- SET tl +sw $t2, 16($t1) +lw $t3, -12($fp) +# Moving self to local_init_Cons_internal_0 +move $t3, $t1 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_car_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_car_Cons_xcar_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_car_Cons_xcar_0 <- GET self . xcar +lw $t1, 12($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_cdr_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_cdr_Cons_xcdr_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_cdr_Cons_xcdr_0 <- GET self . xcdr +lw $t1, 16($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_rev_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_rev_Cons_xcdr_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rev_Cons_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rev_Cons_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rev_Cons_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rev_Cons_xcar_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rev_Cons_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rev_Cons_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rev_Cons_internal_7 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_rev_Cons_xcdr_0 <- GET self . xcdr +lw $t1, 16($t0) +lw $t2, -12($fp) +# local_rev_Cons_internal_2 <- Type of local_rev_Cons_xcdr_0 +lw $t2, 0($t1) +lw $t3, -16($fp) +# Saves in local_rev_Cons_internal_3 data_0 +la $t3, data_0 +# local_rev_Cons_internal_2 <- local_rev_Cons_internal_2 = local_rev_Cons_internal_3 +move $t8, $t2 +move $t9, $t3 +loop_7: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_7 +beqz $a1, mismatch_7 +seq $v0, $a0, $a1 +beqz $v0, mismatch_7 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_7 +mismatch_7: +li $v0, 0 +j end_7 +check_7: +bnez $a1, mismatch_7 +li $v0, 1 +end_7: +move $t2, $v0 +# If not local_rev_Cons_internal_2 goto continue__169 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +beqz $t2, continue__169 +la $a0, dispatch_error +j .raise +continue__169: +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_rev_List +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_rev_Cons_xcar_4 <- GET self . xcar +lw $t2, 12($t1) +lw $t3, -28($fp) +# local_rev_Cons_internal_6 <- Type of local_rev_Cons_internal_1 +lw $t3, 0($t0) +lw $t4, -32($fp) +# Saves in local_rev_Cons_internal_7 data_0 +la $t4, data_0 +# local_rev_Cons_internal_6 <- local_rev_Cons_internal_6 = local_rev_Cons_internal_7 +move $t8, $t3 +move $t9, $t4 +loop_8: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_8 +beqz $a1, mismatch_8 +seq $v0, $a0, $a1 +beqz $v0, mismatch_8 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_8 +mismatch_8: +li $v0, 0 +j end_8 +check_8: +bnez $a1, mismatch_8 +li $v0, 1 +end_8: +move $t3, $v0 +# If not local_rev_Cons_internal_6 goto continue__184 +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +sw $t3, -28($fp) +sw $t4, -32($fp) +beqz $t3, continue__184 +la $a0, dispatch_error +j .raise +continue__184: +lw $t0, -8($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_rcons_List +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -20($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -24($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_sort_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_sort_Cons_xcdr_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_sort_Cons_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_sort_Cons_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_sort_Cons_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_sort_Cons_xcar_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_sort_Cons_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_sort_Cons_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_sort_Cons_internal_7 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_sort_Cons_xcdr_0 <- GET self . xcdr +lw $t1, 16($t0) +lw $t2, -12($fp) +# local_sort_Cons_internal_2 <- Type of local_sort_Cons_xcdr_0 +lw $t2, 0($t1) +lw $t3, -16($fp) +# Saves in local_sort_Cons_internal_3 data_0 +la $t3, data_0 +# local_sort_Cons_internal_2 <- local_sort_Cons_internal_2 = local_sort_Cons_internal_3 +move $t8, $t2 +move $t9, $t3 +loop_9: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_9 +beqz $a1, mismatch_9 +seq $v0, $a0, $a1 +beqz $v0, mismatch_9 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_9 +mismatch_9: +li $v0, 0 +j end_9 +check_9: +bnez $a1, mismatch_9 +li $v0, 1 +end_9: +move $t2, $v0 +# If not local_sort_Cons_internal_2 goto continue__201 +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +beqz $t2, continue__201 +la $a0, dispatch_error +j .raise +continue__201: +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_sort_List +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_sort_Cons_xcar_4 <- GET self . xcar +lw $t2, 12($t1) +lw $t3, -28($fp) +# local_sort_Cons_internal_6 <- Type of local_sort_Cons_internal_1 +lw $t3, 0($t0) +lw $t4, -32($fp) +# Saves in local_sort_Cons_internal_7 data_0 +la $t4, data_0 +# local_sort_Cons_internal_6 <- local_sort_Cons_internal_6 = local_sort_Cons_internal_7 +move $t8, $t3 +move $t9, $t4 +loop_10: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_10 +beqz $a1, mismatch_10 +seq $v0, $a0, $a1 +beqz $v0, mismatch_10 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_10 +mismatch_10: +li $v0, 0 +j end_10 +check_10: +bnez $a1, mismatch_10 +li $v0, 1 +end_10: +move $t3, $v0 +# If not local_sort_Cons_internal_6 goto continue__216 +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +sw $t3, -28($fp) +sw $t4, -32($fp) +beqz $t3, continue__216 +la $a0, dispatch_error +j .raise +continue__216: +lw $t0, -8($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_insert_List +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -20($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -24($fp) +sw $t2, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# Removing all locals from stack +addiu $sp, $sp, 36 +jr $ra + + +function_insert_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_insert_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_xcar_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_xcar_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_xcdr_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_insert_Cons_internal_15 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -12($fp) +# local_insert_Cons_xcar_1 <- GET self . xcar +lw $t1, 12($t0) +lw $t2, -0($fp) +lw $t3, -8($fp) +# local_insert_Cons_internal_0 <- i < local_insert_Cons_xcar_1 +slt $t3, $t2, $t1 +# If local_insert_Cons_internal_0 goto true__234 +sw $t0, -4($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +sw $t3, -8($fp) +bnez $t3, true__234 +lw $t0, -20($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -24($fp) +# local_insert_Cons_xcar_4 <- GET self . xcar +lw $t2, 12($t1) +lw $t3, -28($fp) +# local_insert_Cons_xcdr_5 <- GET self . xcdr +lw $t3, 16($t1) +lw $t4, -36($fp) +# local_insert_Cons_internal_7 <- Type of local_insert_Cons_xcdr_5 +lw $t4, 0($t3) +lw $t5, -40($fp) +# Saves in local_insert_Cons_internal_8 data_0 +la $t5, data_0 +# local_insert_Cons_internal_7 <- local_insert_Cons_internal_7 = local_insert_Cons_internal_8 +move $t8, $t4 +move $t9, $t5 +loop_11: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_11 +beqz $a1, mismatch_11 +seq $v0, $a0, $a1 +beqz $v0, mismatch_11 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_11 +mismatch_11: +li $v0, 0 +j end_11 +check_11: +bnez $a1, mismatch_11 +li $v0, 1 +end_11: +move $t4, $v0 +# If not local_insert_Cons_internal_7 goto continue__247 +sw $t0, -20($fp) +sw $t1, -4($fp) +sw $t2, -24($fp) +sw $t3, -28($fp) +sw $t4, -36($fp) +sw $t5, -40($fp) +beqz $t4, continue__247 +la $a0, dispatch_error +j .raise +continue__247: +lw $t0, -28($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_insert_List +lw $t8, 56($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +lw $t2, -48($fp) +# local_insert_Cons_internal_10 <- Type of local_insert_Cons_internal_3 +lw $t2, 0($t1) +lw $t3, -52($fp) +# Saves in local_insert_Cons_internal_11 data_0 +la $t3, data_0 +# local_insert_Cons_internal_10 <- local_insert_Cons_internal_10 = local_insert_Cons_internal_11 +move $t8, $t2 +move $t9, $t3 +loop_12: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_12 +beqz $a1, mismatch_12 +seq $v0, $a0, $a1 +beqz $v0, mismatch_12 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_12 +mismatch_12: +li $v0, 0 +j end_12 +check_12: +bnez $a1, mismatch_12 +li $v0, 1 +end_12: +move $t2, $v0 +# If not local_insert_Cons_internal_10 goto continue__260 +sw $t0, -32($fp) +sw $t1, -20($fp) +sw $t2, -48($fp) +sw $t3, -52($fp) +beqz $t2, continue__260 +la $a0, dispatch_error +j .raise +continue__260: +lw $t0, -20($fp) +lw $t1, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 68($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -32($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -24($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -44($fp) +sw $t2, -32($fp) +sw $t3, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Moving local_insert_Cons_internal_9 to local_insert_Cons_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -44($fp) +sw $t1, -16($fp) +j end__234 +true__234: +lw $t0, -56($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# local_insert_Cons_internal_14 <- Type of local_insert_Cons_internal_12 +lw $t1, 0($t0) +lw $t2, -68($fp) +# Saves in local_insert_Cons_internal_15 data_0 +la $t2, data_0 +# local_insert_Cons_internal_14 <- local_insert_Cons_internal_14 = local_insert_Cons_internal_15 +move $t8, $t1 +move $t9, $t2 +loop_13: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_13 +beqz $a1, mismatch_13 +seq $v0, $a0, $a1 +beqz $v0, mismatch_13 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_13 +mismatch_13: +li $v0, 0 +j end_13 +check_13: +bnez $a1, mismatch_13 +li $v0, 1 +end_13: +move $t1, $v0 +# If not local_insert_Cons_internal_14 goto continue__280 +sw $t0, -56($fp) +sw $t1, -64($fp) +sw $t2, -68($fp) +beqz $t1, continue__280 +la $a0, dispatch_error +j .raise +continue__280: +lw $t0, -56($fp) +lw $t1, -60($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 68($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -0($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -60($fp) +sw $t2, -4($fp) +sw $t3, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -60($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# Moving local_insert_Cons_internal_13 to local_insert_Cons_internal_2 +move $t1, $t0 +sw $t1, -16($fp) +sw $t0, -60($fp) +sw $t1, -16($fp) +end__234: +lw $t0, -16($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 72 +jr $ra + + +function_rcons_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_rcons_Cons_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_xcar_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_xcdr_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Cons_internal_8 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -12($fp) +# local_rcons_Cons_xcar_1 <- GET self . xcar +lw $t2, 12($t1) +lw $t3, -16($fp) +# local_rcons_Cons_xcdr_2 <- GET self . xcdr +lw $t3, 16($t1) +lw $t4, -24($fp) +# local_rcons_Cons_internal_4 <- Type of local_rcons_Cons_xcdr_2 +lw $t4, 0($t3) +lw $t5, -28($fp) +# Saves in local_rcons_Cons_internal_5 data_0 +la $t5, data_0 +# local_rcons_Cons_internal_4 <- local_rcons_Cons_internal_4 = local_rcons_Cons_internal_5 +move $t8, $t4 +move $t9, $t5 +loop_14: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_14 +beqz $a1, mismatch_14 +seq $v0, $a0, $a1 +beqz $v0, mismatch_14 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_14 +mismatch_14: +li $v0, 0 +j end_14 +check_14: +bnez $a1, mismatch_14 +li $v0, 1 +end_14: +move $t4, $v0 +# If not local_rcons_Cons_internal_4 goto continue__307 +sw $t0, -8($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +sw $t4, -24($fp) +sw $t5, -28($fp) +beqz $t4, continue__307 +la $a0, dispatch_error +j .raise +continue__307: +lw $t0, -16($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_rcons_List +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -8($fp) +lw $t2, -36($fp) +# local_rcons_Cons_internal_7 <- Type of local_rcons_Cons_internal_0 +lw $t2, 0($t1) +lw $t3, -40($fp) +# Saves in local_rcons_Cons_internal_8 data_0 +la $t3, data_0 +# local_rcons_Cons_internal_7 <- local_rcons_Cons_internal_7 = local_rcons_Cons_internal_8 +move $t8, $t2 +move $t9, $t3 +loop_15: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_15 +beqz $a1, mismatch_15 +seq $v0, $a0, $a1 +beqz $v0, mismatch_15 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_15 +mismatch_15: +li $v0, 0 +j end_15 +check_15: +bnez $a1, mismatch_15 +li $v0, 1 +end_15: +move $t2, $v0 +# If not local_rcons_Cons_internal_7 goto continue__320 +sw $t0, -20($fp) +sw $t1, -8($fp) +sw $t2, -36($fp) +sw $t3, -40($fp) +beqz $t2, continue__320 +la $a0, dispatch_error +j .raise +continue__320: +lw $t0, -8($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 68($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -20($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -12($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -32($fp) +sw $t2, -20($fp) +sw $t3, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +# Removing all locals from stack +addiu $sp, $sp, 44 +jr $ra + + +function_print_list_Cons: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_list_Cons_xcar_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_xcdr_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_print_list_Cons_internal_8 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_print_list_Cons_xcar_0 <- GET self . xcar +lw $t1, 12($t0) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_int_IO +lw $t8, 20($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +# Saves in local_print_list_Cons_internal_2 data_1 +la $t1, data_1 +lw $t2, -0($fp) +lw $t3, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -0($fp) +sw $t3, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_print_list_Cons_xcdr_4 <- GET self . xcdr +lw $t2, 16($t1) +lw $t3, -28($fp) +# local_print_list_Cons_internal_6 <- Type of local_print_list_Cons_xcdr_4 +lw $t3, 0($t2) +lw $t4, -32($fp) +# Saves in local_print_list_Cons_internal_7 data_0 +la $t4, data_0 +# local_print_list_Cons_internal_6 <- local_print_list_Cons_internal_6 = local_print_list_Cons_internal_7 +move $t8, $t3 +move $t9, $t4 +loop_16: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_16 +beqz $a1, mismatch_16 +seq $v0, $a0, $a1 +beqz $v0, mismatch_16 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_16 +mismatch_16: +li $v0, 0 +j end_16 +check_16: +bnez $a1, mismatch_16 +li $v0, 1 +end_16: +move $t3, $v0 +# If not local_print_list_Cons_internal_6 goto continue__350 +sw $t0, -16($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +sw $t3, -28($fp) +sw $t4, -32($fp) +beqz $t3, continue__350 +la $a0, dispatch_error +j .raise +continue__350: +lw $t0, -20($fp) +lw $t1, -24($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_list_List +lw $t8, 64($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -24($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# Moving local_print_list_Cons_internal_5 to local_print_list_Cons_internal_8 +move $t1, $t0 +sw $t1, -36($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -36($fp) +# Removing all locals from stack +addiu $sp, $sp, 40 +jr $ra + + +function_isNil_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_isNil_Nil_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 1 to local_isNil_Nil_internal_0 +li $t0, 1 +sw $t0, -4($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_rev_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +lw $t0, -0($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 4 +jr $ra + + +function_sort_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +lw $t0, -0($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 4 +jr $ra + + +function_insert_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_insert_Nil_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_rcons_Nil +lw $t8, 60($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -0($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_rcons_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_rcons_Nil_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Nil_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Nil_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_rcons_Nil_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -16($fp) +# local_rcons_Nil_internal_2 <- Type of local_rcons_Nil_internal_0 +lw $t1, 0($t0) +lw $t2, -20($fp) +# Saves in local_rcons_Nil_internal_3 data_0 +la $t2, data_0 +# local_rcons_Nil_internal_2 <- local_rcons_Nil_internal_2 = local_rcons_Nil_internal_3 +move $t8, $t1 +move $t9, $t2 +loop_17: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_17 +beqz $a1, mismatch_17 +seq $v0, $a0, $a1 +beqz $v0, mismatch_17 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_17 +mismatch_17: +li $v0, 0 +j end_17 +check_17: +bnez $a1, mismatch_17 +li $v0, 1 +end_17: +move $t1, $v0 +# If not local_rcons_Nil_internal_2 goto continue__392 +sw $t0, -8($fp) +sw $t1, -16($fp) +sw $t2, -20($fp) +beqz $t1, continue__392 +la $a0, dispatch_error +j .raise +continue__392: +lw $t0, -8($fp) +lw $t1, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 68($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -4($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -0($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -12($fp) +sw $t2, -4($fp) +sw $t3, -0($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 24 +jr $ra + + +function_print_list_Nil: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_print_list_Nil_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Moving 1 to local_print_list_Nil_internal_0 +li $t0, 1 +sw $t0, -4($fp) +# Initialize new node +li $a0, 12 +li $v0, 9 +syscall +la $t9, type_Bool +sw $t9, 0($v0) +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Saving the methods of object +# Adding Type Info addr +la $t8, types +lw $v0, 8($t8) +sw $v0, 8($t0) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_l_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t0, $v0 +lw $t1, -0($fp) +# self . l <- SET local_Main_Main_l_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_Main_Main_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_iota_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value i +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_iota_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_j_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_l_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_l_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_iota_Main_internal_12 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Nil +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# self . l <- SET local_iota_Main_internal_0 +sw $t0, 12($t1) +lw $t2, -12($fp) +# Moving 0 to local_iota_Main_j_1 +li $t2, 0 +sw $t2, -12($fp) +lw $t3, -16($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t3, $v0 +sw $t0, -8($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -16($fp) +start__425: +lw $t0, -12($fp) +lw $t1, -0($fp) +lw $t2, -20($fp) +# local_iota_Main_internal_3 <- local_iota_Main_j_1 < i +slt $t2, $t0, $t1 +# If not local_iota_Main_internal_3 goto end__425 +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -20($fp) +beqz $t2, end__425 +lw $t0, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Cons +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Cons +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +# This function will consume the arguments +jal function_Cons_Cons +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -24($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -28($fp) +# local_iota_Main_l_5 <- GET self . l +lw $t2, 12($t1) +lw $t3, -36($fp) +# local_iota_Main_internal_7 <- Type of local_iota_Main_internal_4 +lw $t3, 0($t0) +lw $t4, -40($fp) +# Saves in local_iota_Main_internal_8 data_0 +la $t4, data_0 +# local_iota_Main_internal_7 <- local_iota_Main_internal_7 = local_iota_Main_internal_8 +move $t8, $t3 +move $t9, $t4 +loop_18: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_18 +beqz $a1, mismatch_18 +seq $v0, $a0, $a1 +beqz $v0, mismatch_18 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_18 +mismatch_18: +li $v0, 0 +j end_18 +check_18: +bnez $a1, mismatch_18 +li $v0, 1 +end_18: +move $t3, $v0 +# If not local_iota_Main_internal_7 goto continue__440 +sw $t0, -24($fp) +sw $t1, -4($fp) +sw $t2, -28($fp) +sw $t3, -36($fp) +sw $t4, -40($fp) +beqz $t3, continue__440 +la $a0, dispatch_error +j .raise +continue__440: +lw $t0, -24($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_init_Cons +lw $t8, 68($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t3, -12($fp) +sw $t3, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -24($fp) +sw $t1, -32($fp) +sw $t2, -28($fp) +sw $t3, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +# self . l <- SET local_iota_Main_internal_6 +sw $t0, 12($t1) +lw $t2, -12($fp) +lw $t3, -44($fp) +# local_iota_Main_internal_9 <- local_iota_Main_j_1 + 1 +addi $t3, $t2, 1 +# Moving local_iota_Main_internal_9 to local_iota_Main_j_1 +move $t2, $t3 +sw $t2, -12($fp) +lw $t4, -48($fp) +# Moving local_iota_Main_internal_9 to local_iota_Main_internal_10 +move $t4, $t3 +sw $t4, -48($fp) +lw $t5, -16($fp) +# Moving local_iota_Main_internal_10 to local_iota_Main_internal_2 +move $t5, $t4 +sw $t5, -16($fp) +sw $t0, -32($fp) +sw $t1, -4($fp) +sw $t2, -12($fp) +sw $t3, -44($fp) +sw $t4, -48($fp) +sw $t5, -16($fp) +j start__425 +end__425: +lw $t0, -4($fp) +lw $t1, -52($fp) +# local_iota_Main_l_11 <- GET self . l +lw $t1, 12($t0) +lw $t2, -56($fp) +# Moving local_iota_Main_l_11 to local_iota_Main_internal_12 +move $t2, $t1 +sw $t2, -56($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -52($fp) +sw $t2, -56($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_2 +la $t0, data_2 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -12($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_in_int_IO +lw $t8, 28($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -12($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +lw $t2, -16($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_iota_Main +lw $t8, 32($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -0($fp) +sw $t2, -16($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -16($fp) +# saves the return value +move $t0, $v0 +lw $t1, -24($fp) +# local_main_Main_internal_5 <- Type of local_main_Main_internal_3 +lw $t1, 0($t0) +lw $t2, -28($fp) +# Saves in local_main_Main_internal_6 data_0 +la $t2, data_0 +# local_main_Main_internal_5 <- local_main_Main_internal_5 = local_main_Main_internal_6 +move $t8, $t1 +move $t9, $t2 +loop_19: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_19 +beqz $a1, mismatch_19 +seq $v0, $a0, $a1 +beqz $v0, mismatch_19 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_19 +mismatch_19: +li $v0, 0 +j end_19 +check_19: +bnez $a1, mismatch_19 +li $v0, 1 +end_19: +move $t1, $v0 +# If not local_main_Main_internal_5 goto continue__482 +sw $t0, -16($fp) +sw $t1, -24($fp) +sw $t2, -28($fp) +beqz $t1, continue__482 +la $a0, dispatch_error +j .raise +continue__482: +lw $t0, -16($fp) +lw $t1, -20($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_rev_List +lw $t8, 48($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -20($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -20($fp) +# saves the return value +move $t0, $v0 +lw $t1, -36($fp) +# local_main_Main_internal_8 <- Type of local_main_Main_internal_4 +lw $t1, 0($t0) +lw $t2, -40($fp) +# Saves in local_main_Main_internal_9 data_0 +la $t2, data_0 +# local_main_Main_internal_8 <- local_main_Main_internal_8 = local_main_Main_internal_9 +move $t8, $t1 +move $t9, $t2 +loop_20: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_20 +beqz $a1, mismatch_20 +seq $v0, $a0, $a1 +beqz $v0, mismatch_20 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_20 +mismatch_20: +li $v0, 0 +j end_20 +check_20: +bnez $a1, mismatch_20 +li $v0, 1 +end_20: +move $t1, $v0 +# If not local_main_Main_internal_8 goto continue__494 +sw $t0, -20($fp) +sw $t1, -36($fp) +sw $t2, -40($fp) +beqz $t1, continue__494 +la $a0, dispatch_error +j .raise +continue__494: +lw $t0, -20($fp) +lw $t1, -32($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_sort_List +lw $t8, 52($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -32($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -32($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# local_main_Main_internal_11 <- Type of local_main_Main_internal_7 +lw $t1, 0($t0) +lw $t2, -52($fp) +# Saves in local_main_Main_internal_12 data_0 +la $t2, data_0 +# local_main_Main_internal_11 <- local_main_Main_internal_11 = local_main_Main_internal_12 +move $t8, $t1 +move $t9, $t2 +loop_21: +lb $a0, ($t8) +lb $a1, ($t9) +beqz $a0, check_21 +beqz $a1, mismatch_21 +seq $v0, $a0, $a1 +beqz $v0, mismatch_21 +addi $t8, $t8, 1 +addi $t9, $t9, 1 +j loop_21 +mismatch_21: +li $v0, 0 +j end_21 +check_21: +bnez $a1, mismatch_21 +li $v0, 1 +end_21: +move $t1, $v0 +# If not local_main_Main_internal_11 goto continue__506 +sw $t0, -32($fp) +sw $t1, -48($fp) +sw $t2, -52($fp) +beqz $t1, continue__506 +la $a0, dispatch_error +j .raise +continue__506: +lw $t0, -32($fp) +lw $t1, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t0) +lw $a0, 8($t9) +# Saves in t8 the direction of function_print_list_List +lw $t8, 64($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -32($fp) +sw $t1, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Moving local_main_Main_internal_10 to local_main_Main_internal_13 +move $t1, $t0 +sw $t1, -56($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -56($fp) +# Removing all locals from stack +addiu $sp, $sp, 60 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_List: .asciiz "List" +type_Cons: .asciiz "Cons" +type_Nil: .asciiz "Nil" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz " +" +data_2: .asciiz "How many numbers to sort? " +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/codegen_test.py b/tests/codegen_test.py index 48df768f..49db4080 100644 --- a/tests/codegen_test.py +++ b/tests/codegen_test.py @@ -14,4 +14,4 @@ @pytest.mark.parametrize("cool_file", tests) def test_codegen(compiler_path, cool_file): compare_outputs(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_input.txt',\ - tests_dir + cool_file[:-3] + '_output.txt') \ No newline at end of file + tests_dir + cool_file[:-3] + '_output.txt') diff --git a/tests/conftest.py b/tests/conftest.py index 1f44eeb7..561d8baf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,6 +1,6 @@ -import pytest -import os - -@pytest.fixture -def compiler_path(): +import pytest +import os + +@pytest.fixture +def compiler_path(): return os.path.abspath('./coolc.sh') \ No newline at end of file diff --git a/tests/lexer/mixed1_error.txt b/tests/lexer/mixed1_error.txt index 99af5fbd..a142c2ed 100644 --- a/tests/lexer/mixed1_error.txt +++ b/tests/lexer/mixed1_error.txt @@ -1 +1 @@ -(2, 10) - LexicographicError: ERROR "#" +(2, 10) - LexicographicError: ERROR "#" diff --git a/tests/lexer_test.py b/tests/lexer_test.py index 2a27223d..f492b195 100644 --- a/tests/lexer_test.py +++ b/tests/lexer_test.py @@ -10,4 +10,4 @@ @pytest.mark.run(order=1) @pytest.mark.parametrize("cool_file", tests) def test_lexer_errors(compiler_path, cool_file): - compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt') \ No newline at end of file + compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt') diff --git a/tests/parser/mixed6_error.txt b/tests/parser/mixed6_error.txt index af75ca92..d72721a6 100644 --- a/tests/parser/mixed6_error.txt +++ b/tests/parser/mixed6_error.txt @@ -1 +1 @@ -(1, 1) - SyntacticError: ERROR at or near "classs" \ No newline at end of file +(1, 1) - SyntacticError: ERROR at or near "classs" \ No newline at end of file diff --git a/tests/parser_test.py b/tests/parser_test.py index 129c0f20..dc1205c3 100644 --- a/tests/parser_test.py +++ b/tests/parser_test.py @@ -10,4 +10,4 @@ @pytest.mark.run(order=2) @pytest.mark.parametrize("cool_file", tests) def test_parser_errors(compiler_path, cool_file): - compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt') \ No newline at end of file + compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt') diff --git a/tests/semantic/arithmetic1.mips b/tests/semantic/arithmetic1.mips new file mode 100644 index 00000000..77a99345 --- /dev/null +++ b/tests/semantic/arithmetic1.mips @@ -0,0 +1,1689 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 1 * 2 +li $t0, 2 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 / 3 +li $t9, 3 +la $a0, zero_error +beqz $t9, .raise +div $t0, $t9 +mflo $t1 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 - 4 +addi $t2, $t1, -4 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 + local_Main_Main_internal_13 +add $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -64($fp) +sw $t5, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- local_Main_Main_x_0 + local_Main_Main_internal_22 +add $t2, $t1, $t0 +# Moving local_Main_Main_internal_14 to local_Main_Main_x_0 +move $t1, $t2 +sw $t1, -4($fp) +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -96($fp) +# Moving self to local_Main_Main_internal_23 +move $t4, $t3 +sw $t4, -96($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -96($fp) +# Removing all locals from stack +addiu $sp, $sp, 100 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic10.mips b/tests/semantic/arithmetic10.mips new file mode 100644 index 00000000..36281451 --- /dev/null +++ b/tests/semantic/arithmetic10.mips @@ -0,0 +1,1707 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 1 / 2 +li $t0, 0 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 - 3 +addi $t1, $t0, -3 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 + 4 +addi $t2, $t1, 4 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 < local_Main_Main_internal_13 +slt $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -64($fp) +sw $t5, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -60($fp) +# local_Main_Main_internal_14 <- ~local_Main_Main_internal_23 +not $t1, $t0 +addi $t1, $t1, 1 +lw $t2, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t1, 12($t2) +lw $t3, -100($fp) +# Moving self to local_Main_Main_internal_24 +move $t3, $t2 +sw $t3, -100($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -60($fp) +sw $t2, -0($fp) +sw $t3, -100($fp) +# Removing all locals from stack +addiu $sp, $sp, 104 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic11.mips b/tests/semantic/arithmetic11.mips new file mode 100644 index 00000000..7dd489d8 --- /dev/null +++ b/tests/semantic/arithmetic11.mips @@ -0,0 +1,1717 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_25 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 1 / 2 +li $t0, 0 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 - 3 +addi $t1, $t0, -3 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 + 4 +addi $t2, $t1, 4 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 < local_Main_Main_internal_13 +slt $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -68($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -68($fp) +sw $t5, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -76($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -72($fp) +sw $t1, -76($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -84($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -88($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -80($fp) +sw $t1, -84($fp) +sw $t2, -88($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -80($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -72($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +sw $t2, -72($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -100($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -100($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -100($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# local_Main_Main_internal_15 <- 1 + local_Main_Main_internal_24 +addi $t1, $t0, 1 +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- not local_Main_Main_internal_15 +beqz $t1, false_6 +li $t2, 0 +j end_6 +false_6: +li $t2, 1 +end_6: +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -104($fp) +# Moving self to local_Main_Main_internal_25 +move $t4, $t3 +sw $t4, -104($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -100($fp) +sw $t1, -64($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -104($fp) +# Removing all locals from stack +addiu $sp, $sp, 108 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic12.mips b/tests/semantic/arithmetic12.mips new file mode 100644 index 00000000..952aafa8 --- /dev/null +++ b/tests/semantic/arithmetic12.mips @@ -0,0 +1,1718 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_25 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 1 / 2 +li $t0, 0 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 - 3 +addi $t1, $t0, -3 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 + 4 +addi $t2, $t1, 4 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 < local_Main_Main_internal_13 +slt $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -68($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -68($fp) +sw $t5, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -76($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -72($fp) +sw $t1, -76($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -84($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -88($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -80($fp) +sw $t1, -84($fp) +sw $t2, -88($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -80($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -72($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +sw $t2, -72($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -100($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -100($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -100($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# local_Main_Main_internal_15 <- 1 < local_Main_Main_internal_24 +li $t9, 1 +slt $t1, $t9, $t0 +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- not local_Main_Main_internal_15 +beqz $t1, false_6 +li $t2, 0 +j end_6 +false_6: +li $t2, 1 +end_6: +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -104($fp) +# Moving self to local_Main_Main_internal_25 +move $t4, $t3 +sw $t4, -104($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -100($fp) +sw $t1, -64($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -104($fp) +# Removing all locals from stack +addiu $sp, $sp, 108 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic2.mips b/tests/semantic/arithmetic2.mips new file mode 100644 index 00000000..57ecac8a --- /dev/null +++ b/tests/semantic/arithmetic2.mips @@ -0,0 +1,1689 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 2 * 3 +li $t0, 6 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 / 4 +li $t9, 4 +la $a0, zero_error +beqz $t9, .raise +div $t0, $t9 +mflo $t1 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- 1 + local_Main_Main_internal_3 +addi $t2, $t1, 1 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 - local_Main_Main_internal_13 +sub $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -64($fp) +sw $t5, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- local_Main_Main_x_0 - local_Main_Main_internal_22 +sub $t2, $t1, $t0 +# Moving local_Main_Main_internal_14 to local_Main_Main_x_0 +move $t1, $t2 +sw $t1, -4($fp) +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -96($fp) +# Moving self to local_Main_Main_internal_23 +move $t4, $t3 +sw $t4, -96($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -96($fp) +# Removing all locals from stack +addiu $sp, $sp, 100 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic3.mips b/tests/semantic/arithmetic3.mips new file mode 100644 index 00000000..9ca5e0bf --- /dev/null +++ b/tests/semantic/arithmetic3.mips @@ -0,0 +1,1693 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +lw $t0, -12($fp) +# local_Main_Main_internal_2 <- 1 - 2 +li $t0, -1 +lw $t1, -20($fp) +# local_Main_Main_internal_4 <- 3 * 4 +li $t1, 12 +lw $t2, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -12($fp) +sw $t1, -20($fp) +sw $t2, -24($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +lw $t2, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 / local_Main_Main_internal_13 +la $a0, zero_error +beqz $t0, .raise +div $t1, $t0 +mflo $t2 +lw $t3, -12($fp) +lw $t4, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 + local_Main_Main_internal_3 +add $t4, $t3, $t2 +lw $t5, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t5, $t4 +sw $t5, -4($fp) +lw $t6, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t6, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t6) +lw $t7, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t6) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t6, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -20($fp) +sw $t2, -16($fp) +sw $t3, -12($fp) +sw $t4, -8($fp) +sw $t5, -4($fp) +sw $t6, -64($fp) +sw $t7, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- local_Main_Main_x_0 / local_Main_Main_internal_22 +la $a0, zero_error +beqz $t0, .raise +div $t1, $t0 +mflo $t2 +# Moving local_Main_Main_internal_14 to local_Main_Main_x_0 +move $t1, $t2 +sw $t1, -4($fp) +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -96($fp) +# Moving self to local_Main_Main_internal_23 +move $t4, $t3 +sw $t4, -96($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -96($fp) +# Removing all locals from stack +addiu $sp, $sp, 100 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic4.mips b/tests/semantic/arithmetic4.mips new file mode 100644 index 00000000..d191d308 --- /dev/null +++ b/tests/semantic/arithmetic4.mips @@ -0,0 +1,1688 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +lw $t0, -16($fp) +# local_Main_Main_internal_3 <- 1 / 2 +li $t0, 0 +lw $t1, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 - 3 +addi $t1, $t0, -3 +lw $t2, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -12($fp) +sw $t2, -24($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# local_Main_Main_internal_4 <- 4 * local_Main_Main_internal_13 +li $t9, 4 +mult $t9, $t0 +mflo $t1 +lw $t2, -12($fp) +lw $t3, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 + local_Main_Main_internal_4 +add $t3, $t2, $t1 +lw $t4, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t4, $t3 +sw $t4, -4($fp) +lw $t5, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t5, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t5) +lw $t6, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t5) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t5, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -20($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +sw $t4, -4($fp) +sw $t5, -64($fp) +sw $t6, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- local_Main_Main_x_0 * local_Main_Main_internal_22 +mult $t1, $t0 +mflo $t2 +# Moving local_Main_Main_internal_14 to local_Main_Main_x_0 +move $t1, $t2 +sw $t1, -4($fp) +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -96($fp) +# Moving self to local_Main_Main_internal_23 +move $t4, $t3 +sw $t4, -96($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -96($fp) +# Removing all locals from stack +addiu $sp, $sp, 100 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic5.mips b/tests/semantic/arithmetic5.mips new file mode 100644 index 00000000..42ea51fd --- /dev/null +++ b/tests/semantic/arithmetic5.mips @@ -0,0 +1,1714 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +lw $t0, -16($fp) +# local_Main_Main_internal_3 <- 1 / 2 +li $t0, 0 +lw $t1, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 - 3 +addi $t1, $t0, -3 +lw $t2, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +lw $t3, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t2) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -16($fp) +sw $t1, -12($fp) +sw $t2, -24($fp) +sw $t3, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -20($fp) +# local_Main_Main_internal_4 <- 4 * local_Main_Main_internal_13 +li $t9, 4 +mult $t9, $t0 +mflo $t1 +lw $t2, -12($fp) +lw $t3, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 + local_Main_Main_internal_4 +add $t3, $t2, $t1 +lw $t4, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t4, $t3 +sw $t4, -4($fp) +lw $t5, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t5, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t5) +lw $t6, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t5) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t5, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -20($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +sw $t4, -4($fp) +sw $t5, -64($fp) +sw $t6, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -4($fp) +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- local_Main_Main_x_0 * local_Main_Main_internal_23 +mult $t1, $t0 +mflo $t2 +# Moving local_Main_Main_internal_14 to local_Main_Main_x_0 +move $t1, $t2 +sw $t1, -4($fp) +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -100($fp) +# Moving self to local_Main_Main_internal_24 +move $t4, $t3 +sw $t4, -100($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -4($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -100($fp) +# Removing all locals from stack +addiu $sp, $sp, 104 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic7.mips b/tests/semantic/arithmetic7.mips new file mode 100644 index 00000000..9db26efb --- /dev/null +++ b/tests/semantic/arithmetic7.mips @@ -0,0 +1,1681 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 1 / 2 +li $t0, 0 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 - 3 +addi $t1, $t0, -3 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 + 4 +addi $t2, $t1, 4 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 < local_Main_Main_internal_13 +slt $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -64($fp) +sw $t5, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -60($fp) +# local_Main_Main_internal_14 <- 1 < local_Main_Main_internal_22 +li $t9, 1 +slt $t1, $t9, $t0 +lw $t2, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t1, 12($t2) +lw $t3, -96($fp) +# Moving self to local_Main_Main_internal_23 +move $t3, $t2 +sw $t3, -96($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -60($fp) +sw $t2, -0($fp) +sw $t3, -96($fp) +# Removing all locals from stack +addiu $sp, $sp, 100 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic8.mips b/tests/semantic/arithmetic8.mips new file mode 100644 index 00000000..80bbddec --- /dev/null +++ b/tests/semantic/arithmetic8.mips @@ -0,0 +1,1707 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 1 / 2 +li $t0, 0 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 - 3 +addi $t1, $t0, -3 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 + 4 +addi $t2, $t1, 4 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 < local_Main_Main_internal_13 +slt $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -64($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -68($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -64($fp) +sw $t5, -68($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -68($fp) +# saves the return value +move $t0, $v0 +lw $t1, -72($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -76($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -68($fp) +sw $t1, -72($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -76($fp) +# saves the return value +move $t0, $v0 +lw $t1, -80($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -84($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -76($fp) +sw $t1, -80($fp) +sw $t2, -84($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -84($fp) +# saves the return value +move $t0, $v0 +lw $t1, -88($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -76($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -84($fp) +sw $t1, -88($fp) +sw $t2, -76($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -68($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -68($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -60($fp) +# local_Main_Main_internal_14 <- 1 < local_Main_Main_internal_23 +li $t9, 1 +slt $t1, $t9, $t0 +lw $t2, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t1, 12($t2) +lw $t3, -100($fp) +# Moving self to local_Main_Main_internal_24 +move $t3, $t2 +sw $t3, -100($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -60($fp) +sw $t2, -0($fp) +sw $t3, -100($fp) +# Removing all locals from stack +addiu $sp, $sp, 104 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/arithmetic9.mips b/tests/semantic/arithmetic9.mips new file mode 100644 index 00000000..b1c12016 --- /dev/null +++ b/tests/semantic/arithmetic9.mips @@ -0,0 +1,1687 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 32($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_x_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_4 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_5 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_6 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_7 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_8 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_9 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_10 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_11 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_12 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_13 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_14 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_15 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_16 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_17 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_18 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_19 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_20 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_21 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_22 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_23 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_24 to the stack +addiu $sp, $sp, -4 +lw $t0, -20($fp) +# local_Main_Main_internal_4 <- 1 / 2 +li $t0, 0 +lw $t1, -16($fp) +# local_Main_Main_internal_3 <- local_Main_Main_internal_4 - 3 +addi $t1, $t0, -3 +lw $t2, -12($fp) +# local_Main_Main_internal_2 <- local_Main_Main_internal_3 + 4 +addi $t2, $t1, 4 +lw $t3, -24($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t3) +lw $t4, -28($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t3) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t3, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -20($fp) +sw $t1, -16($fp) +sw $t2, -12($fp) +sw $t3, -24($fp) +sw $t4, -28($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -28($fp) +# saves the return value +move $t0, $v0 +lw $t1, -32($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -36($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -28($fp) +sw $t1, -32($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -36($fp) +# saves the return value +move $t0, $v0 +lw $t1, -40($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -44($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -36($fp) +sw $t1, -40($fp) +sw $t2, -44($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -44($fp) +# saves the return value +move $t0, $v0 +lw $t1, -48($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -36($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -44($fp) +sw $t1, -48($fp) +sw $t2, -36($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -48($fp) +# saves the return value +move $t0, $v0 +lw $t1, -52($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -28($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -48($fp) +sw $t1, -52($fp) +sw $t2, -28($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -52($fp) +# saves the return value +move $t0, $v0 +lw $t1, -56($fp) +# Static Dispatch of the method length +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -52($fp) +sw $t1, -56($fp) +# This function will consume the arguments +jal function_length_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -56($fp) +# saves the return value +move $t0, $v0 +lw $t1, -12($fp) +lw $t2, -8($fp) +# local_Main_Main_internal_1 <- local_Main_Main_internal_2 < local_Main_Main_internal_13 +slt $t2, $t1, $t0 +lw $t3, -4($fp) +# Moving local_Main_Main_internal_1 to local_Main_Main_x_0 +move $t3, $t2 +sw $t3, -4($fp) +lw $t4, -68($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t4, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t4) +lw $t5, -72($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t4) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t4, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -56($fp) +sw $t1, -12($fp) +sw $t2, -8($fp) +sw $t3, -4($fp) +sw $t4, -68($fp) +sw $t5, -72($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -72($fp) +# saves the return value +move $t0, $v0 +lw $t1, -76($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_B +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 24($t8) +sw $v0, 8($t1) +lw $t2, -80($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -72($fp) +sw $t1, -76($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -80($fp) +# saves the return value +move $t0, $v0 +lw $t1, -84($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t1, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t1) +lw $t2, -88($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_type_name_Object +lw $t8, 8($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -80($fp) +sw $t1, -84($fp) +sw $t2, -88($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -88($fp) +# saves the return value +move $t0, $v0 +lw $t1, -92($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -80($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -88($fp) +sw $t1, -92($fp) +sw $t2, -80($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -92($fp) +# saves the return value +move $t0, $v0 +lw $t1, -96($fp) +# Static Dispatch of the method concat +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +lw $t2, -72($fp) +sw $t2, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -92($fp) +sw $t1, -96($fp) +sw $t2, -72($fp) +# This function will consume the arguments +jal function_concat_String +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -96($fp) +# saves the return value +move $t0, $v0 +lw $t1, -64($fp) +# local_Main_Main_internal_15 <- ~local_Main_Main_internal_23 +not $t1, $t0 +addi $t1, $t1, 1 +lw $t2, -60($fp) +# local_Main_Main_internal_14 <- 1 + local_Main_Main_internal_15 +addi $t2, $t1, 1 +lw $t3, -0($fp) +# self . test <- SET local_Main_Main_internal_14 +sw $t2, 12($t3) +lw $t4, -100($fp) +# Moving self to local_Main_Main_internal_24 +move $t4, $t3 +sw $t4, -100($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -96($fp) +sw $t1, -64($fp) +sw $t2, -60($fp) +sw $t3, -0($fp) +sw $t4, -100($fp) +# Removing all locals from stack +addiu $sp, $sp, 104 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/assignment1.mips b/tests/semantic/assignment1.mips new file mode 100644 index 00000000..35b7d048 --- /dev/null +++ b/tests/semantic/assignment1.mips @@ -0,0 +1,1090 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 16 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 16 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_Main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +# self . test <- SET local_Main_Main_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Moving self to local_Main_Main_internal_1 +move $t2, $t1 +sw $t2, -8($fp) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_2 +la $t0, data_2 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "String" +data_2: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/assignment2.mips b/tests/semantic/assignment2.mips new file mode 100644 index 00000000..c8cc5fe1 --- /dev/null +++ b/tests/semantic/assignment2.mips @@ -0,0 +1,1267 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_main_Main +sw $t9, 80($v0) +la $t9, function_test_Main +sw $t9, 84($v0) +la $t9, function_test2_Main +sw $t9, 88($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_D +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 36($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 44 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_test_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +# Save the direction of the method function_test2_Main in a0 +lw $a0, 88($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 40($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 36($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t0) +lw $t1, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_test_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value a +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_test_Main_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +lw $t1, -0($fp) +# Moving local_test_Main_internal_0 to a +move $t1, $t0 +sw $t1, -0($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_test2_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value a +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_test2_Main_internal_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t0) +lw $t1, -0($fp) +# Moving local_test2_Main_internal_0 to a +move $t1, $t0 +sw $t1, -0($fp) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +sw $t1, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_D: .asciiz "D" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/assignment3.mips b/tests/semantic/assignment3.mips new file mode 100644 index 00000000..017b0d98 --- /dev/null +++ b/tests/semantic/assignment3.mips @@ -0,0 +1,1285 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_D +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 36($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 36($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 24 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 24 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_a_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_3 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Initialize void node +li $a0, 4 +li $v0, 9 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Void +sw $t9, 0($v0) +move $t0, $v0 +lw $t1, -0($fp) +# self . a <- SET local_Main_Main_a_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t2) +# self . a <- SET local_Main_Main_internal_1 +sw $t2, 12($t1) +# self . b <- SET local_Main_Main_internal_1 +sw $t2, 16($t1) +lw $t3, -12($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_C +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t3, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 28($t8) +sw $v0, 8($t3) +# self . a <- SET local_Main_Main_internal_2 +sw $t3, 12($t1) +# self . d <- SET local_Main_Main_internal_2 +sw $t3, 20($t1) +lw $t4, -16($fp) +# Moving self to local_Main_Main_internal_3 +move $t4, $t1 +sw $t4, -16($fp) +move $v0, $t4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +sw $t4, -16($fp) +# Removing all locals from stack +addiu $sp, $sp, 20 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_D: .asciiz "D" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic/attributes1.mips b/tests/semantic/attributes1.mips new file mode 100644 index 00000000..084067dd --- /dev/null +++ b/tests/semantic/attributes1.mips @@ -0,0 +1,1289 @@ +.text +.globl main +main: +# Save method directions in the methods array +la $v0, methods +la $t9, entry +sw $t9, 0($v0) +la $t9, function_abort_Object +sw $t9, 4($v0) +la $t9, function_type_name_Object +sw $t9, 8($v0) +la $t9, function_copy_Object +sw $t9, 12($v0) +la $t9, function_out_string_IO +sw $t9, 16($v0) +la $t9, function_out_int_IO +sw $t9, 20($v0) +la $t9, function_in_int_IO +sw $t9, 24($v0) +la $t9, function_in_string_IO +sw $t9, 28($v0) +la $t9, function_length_String +sw $t9, 32($v0) +la $t9, function_concat_String +sw $t9, 36($v0) +la $t9, function_substr_String +sw $t9, 40($v0) +la $t9, function_type_name_String +sw $t9, 44($v0) +la $t9, function_copy_String +sw $t9, 48($v0) +la $t9, function_type_name_Int +sw $t9, 52($v0) +la $t9, function_copy_Int +sw $t9, 56($v0) +la $t9, function_type_name_Bool +sw $t9, 60($v0) +la $t9, function_copy_Bool +sw $t9, 64($v0) +la $t9, function_abort_String +sw $t9, 68($v0) +la $t9, function_abort_Int +sw $t9, 72($v0) +la $t9, function_abort_Bool +sw $t9, 76($v0) +la $t9, function_Main_Main +sw $t9, 80($v0) +la $t9, function_main_Main +sw $t9, 84($v0) +# Save types directions in the types array +la $t9, types +# Save space to locate the type info +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_String +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 0($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 28 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_length_String in a0 +lw $a0, 32($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_concat_String in a0 +lw $a0, 36($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_substr_String in a0 +lw $a0, 40($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_abort_String in a0 +lw $a0, 68($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_type_name_String in a0 +lw $a0, 44($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_copy_String in a0 +lw $a0, 48($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Int +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 4($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Int in a0 +lw $a0, 72($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Int in a0 +lw $a0, 52($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Int in a0 +lw $a0, 56($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Object +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 8($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Bool +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 12($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Bool in a0 +lw $a0, 76($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Bool in a0 +lw $a0, 60($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Bool in a0 +lw $a0, 64($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_IO +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 16($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 32 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_A +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 20($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_B +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 24($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_C +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 28($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_D +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 32($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 16 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +sw $v0, 8($t8) +# Allocating memory +li $v0, 9 +li $a0, 12 +syscall +# Filling table methods +la $t8, type_Main +sw $t8, 0($v0) +# Copying direction to array +sw $v0, 36($t9) +# Table addr is now stored in t8 +move $t8, $v0 +# Creating the dispatch table +# Allocate dispatch table in the heap +li $v0, 9 +li $a0, 40 +syscall +# I save the offset of every one of the methods of this type +# Save the direction of methods +la $v1, methods +# Save the direction of the method function_abort_Object in a0 +lw $a0, 4($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 4($v0) +# Save the direction of the method function_type_name_Object in a0 +lw $a0, 8($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 8($v0) +# Save the direction of the method function_copy_Object in a0 +lw $a0, 12($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 12($v0) +# Save the direction of the method function_out_string_IO in a0 +lw $a0, 16($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 16($v0) +# Save the direction of the method function_out_int_IO in a0 +lw $a0, 20($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 20($v0) +# Save the direction of the method function_in_string_IO in a0 +lw $a0, 28($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 24($v0) +# Save the direction of the method function_in_int_IO in a0 +lw $a0, 24($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 28($v0) +# Save the direction of the method function_main_Main in a0 +lw $a0, 84($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 32($v0) +# Save the direction of the method function_Main_Main in a0 +lw $a0, 80($v1) +# Save the direction of the method in his position in the dispatch table +sw $a0, 36($v0) +sw $v0, 8($t8) +# Copying parents +lw $v0, 0($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 4($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 8($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 12($t9) +li $t8, 0 +sw $t8, 4($v0) +lw $v0, 16($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 20($t9) +lw $t8, 8($t9) +sw $t8, 4($v0) +lw $v0, 24($t9) +lw $t8, 20($t9) +sw $t8, 4($v0) +lw $v0, 28($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 32($t9) +lw $t8, 24($t9) +sw $t8, 4($v0) +lw $v0, 36($t9) +lw $t8, 16($t9) +sw $t8, 4($v0) + +entry: +# Gets the params from the stack +move $fp, $sp +# Gets the frame pointer from the stack +# Updates stack pointer pushing local__internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local__internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# Static Dispatch of the method main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +lw $t1, -0($fp) +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +# This function will consume the arguments +jal function_main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +li $v0, 0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Object_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_abort_Object_self_0 +move $t1, $t0 +sw $t1, -4($fp) +# Exiting the program +li $t8, 0 +# Printing abort message +li $v0, 4 +la $a0, abort_msg +syscall +li $v0, 4 +lw $a0, 0($t0) +syscall +li $v0, 4 +la $a0, new_line +syscall +li $v0, 17 +move $a0, $t8 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# local_type_name_Object_result_0 <- Type of self +lw $t1, 0($t0) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Object: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Object_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +lw $t9, 4($t0) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +move $a0, $t9 +syscall +move $t1, $v0 +# Loop to copy every field of the previous object +# t8 the register to loop +li $t8, 0 +loop_0: +# In t9 is stored the size of the object +bge $t8, $t9, exit_0 +lw $a0, ($t0) +sw $a0, ($v0) +addi $v0, $v0, 4 +addi $t0, $t0, 4 +# Increase loop counter +addi $t8, $t8, 4 +j loop_0 +exit_0: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_out_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_string_String_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_string_String_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing a string +li $v0, 4 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_out_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value number +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_out_int_IO_self_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -8($fp) +# Moving self to local_out_int_IO_self_0 +move $t1, $t0 +sw $t1, -8($fp) +lw $t2, -0($fp) +# Printing an int +li $v0, 1 +move $a0, $t2 +syscall +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -8($fp) +sw $t2, -0($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_in_int_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_int_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Reading a int +li $v0, 5 +syscall +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_in_string_IO: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_in_string_IO_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t0, $v0 +# Reading a string +# Putting buffer in a0 +move $a0, $t0 +# Putting length of string in a1 +li $a1, 356 +li $v0, 8 +syscall +# Walks to eliminate the newline +move $t9, $t0 +start_1: +lb $t8, 0($t9) +beqz $t8, end_1 +add $t9, $t9, 1 +j start_1 +end_1: +addiu $t9, $t9, -1 +sb $0, ($t9) +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_length_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_length_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +move $t8, $t0 +# Determining the length of a string +loop_2: +lb $t9, 0($t8) +beq $t9, $zero, end_2 +addi $t8, $t8, 1 +j loop_2 +end_2: +sub $t1, $t8, $t0 +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_concat_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value word +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_concat_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -8($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t2 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +# Concatenate second string on result buffer +move $a0, $t1 +move $a1, $v0 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_3 +# Definition of strcopier +strcopier: +# In a0 is the source and in a1 is the destination +loop_3: +lb $t8, ($a0) +beq $t8, $zero, end_3 +addiu $a0, $a0, 1 +sb $t8, ($a1) +addiu $a1, $a1, 1 +b loop_3 +end_3: +move $v0, $a1 +jr $ra +finish_3: +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + + +function_substr_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Pops the register with the param value begin +addiu $fp, $fp, 4 +# Pops the register with the param value end +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_substr_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +lw $t1, -0($fp) +lw $t2, -12($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t2, $v0 +lw $t3, -8($fp) +# Getting the substring of a node +# Move to the first position in the string +li $v0, 0 +move $t8, $t3 +start_4: +lb $t9, 0($t8) +beqz $t9, error_4 +addi $v0, 1 +bgt $v0, $t0, end_len_4 +addi $t8, 1 +j start_4 +end_len_4: +# Saving dest to iterate over him +move $v0, $t2 +loop_4: +sub $t9, $v0, $t2 +beq $t9, $t1, end_4 +lb $t9, 0($t8) +beqz $t9, error_4 +sb $t9, 0($v0) +addi $t8, $t8, 1 +addi $v0, $v0, 1 +j loop_4 +error_4: +la $a0, index_error +li $v0, 4 +move $a0, $t3 +syscall +li $v0, 1 +move $a0, $t0 +syscall +li $v0, 1 +move $a0, $t1 +syscall +j .raise +end_4: +sb $0, 0($v0) +move $v0, $t2 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -12($fp) +sw $t3, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_type_name_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_String_result_0 type_String +la $t0, type_String +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_String_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Allocating memory for the buffer +li $a0, 356 +li $v0, 9 +syscall +move $t1, $v0 +# Copy the first string to dest +move $a0, $t0 +move $a1, $t1 +sw $ra, ($sp) +addiu $sp, $sp, -4 +jal strcopier +sb $0, 0($v0) +addiu $sp, $sp, 4 +lw $ra, ($sp) +j finish_5 +finish_5: +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Int_result_0 type_Int +la $t0, type_Int +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_Int_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_Int_result_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_type_name_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_type_name_Bool_result_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_type_name_Bool_result_0 type_Bool +la $t0, type_Bool +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_copy_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_copy_result_Bool_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +lw $t1, -4($fp) +# Moving self to local_copy_result_Bool_0 +move $t1, $t0 +sw $t1, -4($fp) +move $v0, $t1 +# Empty all used registers and saves them to memory +sw $t0, -0($fp) +sw $t1, -4($fp) +# Removing all locals from stack +addiu $sp, $sp, 8 +jr $ra + + +function_abort_String: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_String_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self string_abort +la $t0, string_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Int: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Int_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self int_abort +la $t0, int_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_abort_Bool: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_abort_Bool_msg_0 to the stack +addiu $sp, $sp, -4 +lw $t0, -0($fp) +# Saves in self bool_abort +la $t0, bool_abort +# Printing a string +li $v0, 4 +move $a0, $t0 +syscall +# Exiting the program +li $t8, 0 +li $v0, 17 +move $a0, $t8 +syscall +sw $t0, -0($fp) + +function_Main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_Main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_Main_Main_internal_2 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 20 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_Main +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 20 +sw $t9, 4($v0) +move $t0, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 36($t8) +sw $v0, 8($t0) +# Static Dispatch of the method Main +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +# This function will consume the arguments +jal function_Main_Main +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -4($fp) +# saves the return value +move $t0, $v0 +lw $t1, -0($fp) +# self . test1 <- SET local_Main_Main_internal_0 +sw $t0, 12($t1) +lw $t2, -8($fp) +# Syscall to allocate memory of the object entry in heap +li $v0, 9 +li $a0, 12 +syscall +# Loads the name of the variable and saves the name like the first field +la $t9, type_A +sw $t9, 0($v0) +# Saves the size of the node +li $t9, 12 +sw $t9, 4($v0) +move $t2, $v0 +# Adding Type Info addr +la $t8, types +lw $v0, 20($t8) +sw $v0, 8($t2) +# self . test2 <- SET local_Main_Main_internal_1 +sw $t2, 16($t1) +lw $t3, -12($fp) +# Moving self to local_Main_Main_internal_2 +move $t3, $t1 +sw $t3, -12($fp) +move $v0, $t3 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +sw $t3, -12($fp) +# Removing all locals from stack +addiu $sp, $sp, 16 +jr $ra + + +function_main_Main: +# Gets the params from the stack +move $fp, $sp +# Pops the register with the param value self +addiu $fp, $fp, 4 +# Gets the frame pointer from the stack +# Updates stack pointer pushing local_main_Main_internal_0 to the stack +addiu $sp, $sp, -4 +# Updates stack pointer pushing local_main_Main_internal_1 to the stack +addiu $sp, $sp, -4 +lw $t0, -4($fp) +# Saves in local_main_Main_internal_0 data_1 +la $t0, data_1 +lw $t1, -0($fp) +lw $t2, -8($fp) +# Find the actual name in the dispatch table +# Gets in a0 the actual direction of the dispatch table +lw $t9, 8($t1) +lw $a0, 8($t9) +# Saves in t8 the direction of function_out_string_IO +lw $t8, 16($a0) +sw $fp, ($sp) +addiu $sp, $sp, -4 +sw $ra, ($sp) +addiu $sp, $sp, -4 +# Push the arguments to the stack +# The rest of the arguments are push into the stack +sw $t0, ($sp) +addiu $sp, $sp, -4 +# The rest of the arguments are push into the stack +sw $t1, ($sp) +addiu $sp, $sp, -4 +# Empty all used registers and saves them to memory +sw $t0, -4($fp) +sw $t1, -0($fp) +sw $t2, -8($fp) +# This function will consume the arguments +jal $t8 +# Pop ra register of return function of the stack +addiu $sp, $sp, 4 +lw $ra, ($sp) +# Pop fp register from the stack +addiu $sp, $sp, 4 +lw $fp, ($sp) +lw $t0, -8($fp) +# saves the return value +move $t0, $v0 +move $v0, $t0 +# Empty all used registers and saves them to memory +sw $t0, -8($fp) +# Removing all locals from stack +addiu $sp, $sp, 12 +jr $ra + +# Raise exception method +.raise: +li $v0, 4 +syscall +li $v0, 17 +li $a0, 1 +syscall + +.data +abort_msg: .asciiz "Abort called from class " +new_line: .asciiz " +" +string_abort: .asciiz "Abort called from class String +" +int_abort: .asciiz "Abort called from class Int +" +bool_abort: .asciiz "Abort called from class Bool +" +type_Object: .asciiz "Object" +type_IO: .asciiz "IO" +type_String: .asciiz "String" +type_Int: .asciiz "Int" +type_Bool: .asciiz "Bool" +type_A: .asciiz "A" +type_B: .asciiz "B" +type_C: .asciiz "C" +type_D: .asciiz "D" +type_Main: .asciiz "Main" +methods: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +type_Void: .asciiz "Void" +types: .word 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +data_0: .asciiz "Void" +data_1: .asciiz "Hello World!" +zero_error: .asciiz "Division by zero error +" +case_void_error: .asciiz "Case on void error +" +dispatch_error: .asciiz "Dispatch on void error +" +case_error: .asciiz "Case statement without a matching branch error +" +index_error: .asciiz "Substring out of range error +" +heap_error: .asciiz "Heap overflow error +" \ No newline at end of file diff --git a/tests/semantic_test.py b/tests/semantic_test.py index cac9cd78..5e8a203a 100644 --- a/tests/semantic_test.py +++ b/tests/semantic_test.py @@ -11,4 +11,4 @@ @pytest.mark.parametrize("cool_file", tests) def test_semantic_errors(compiler_path, cool_file): compare_errors(compiler_path, tests_dir + cool_file, tests_dir + cool_file[:-3] + '_error.txt', \ - cmp=first_error_only_line) \ No newline at end of file + cmp=first_error_only_line) diff --git a/tests/utils/utils.py b/tests/utils/utils.py index 961cf7cb..7a4c5db3 100644 --- a/tests/utils/utils.py +++ b/tests/utils/utils.py @@ -68,6 +68,7 @@ def compare_errors(compiler_path: str, cool_file_path: str, error_file_path: str def compare_outputs(compiler_path: str, cool_file_path: str, input_file_path: str, output_file_path: str, timeout=100): try: sp = subprocess.run(['bash', compiler_path, cool_file_path], capture_output=True, timeout=timeout) + print(sp.stdout.decode()) assert sp.returncode == 0, TEST_MUST_COMPILE % get_file_name(cool_file_path) except subprocess.TimeoutExpired: assert False, COMPILER_TIMEOUT